Add MATLAB to Python porting guide with strict mirroring rules#8
Merged
Conversation
Documents the core rules for porting MATLAB code to Python, including naming conventions, namespace mapping, Pydantic validation, error handling, and docstring requirements. https://claude.ai/code/session_012qih1bFF69sgSPvBnWzEHo
…ule) Apply the Strict Mirror Rule from PYTHON_PORTING_GUIDE.md: every Python function name must be an identical string match to its MATLAB counterpart. Renamed ~80+ functions across 17 source files, 6 test files, and 2 tutorials from snake_case to camelCase. Updated MATLAB_MAPPING.md to reflect new names. https://claude.ai/code/session_01Skj3WbRtzYBdW5uk6nazhE
Rename functions across ndi.fun.* to use MATLAB-style camelCase naming: - utils: name2variable_name → name2variableName - data: read_image_stack → readImageStack - doc: all_types → allTypes, find_fuid → findFuid, etc. - doc_table: ontology_table_row_doc_to_table → ontologyTableRowDoc2Table, etc. - epoch: t0_t1_to_array → t0_t1cell2array - file: md5 → MD5, date_created → dateCreated, date_updated → dateUpdated - table: identify_matching_rows → identifyMatchingRows, etc. - stimulus: find_mixture_name → findMixtureName, etc. - name_utils: name_to_variable_name → name2variableName All old snake_case names preserved as backward-compatible aliases. New ndi.fun.plot module ported from MATLAB with bar3, multichan, stimulusTimeseries. Updated all references in tests and tutorials. https://claude.ai/code/session_01Skj3WbRtzYBdW5uk6nazhE
…unctions-python-L9MAj Rename Python API functions to match MATLAB camelCase naming
…ive.py Apply black auto-formatting to resolve CI lint failures. https://claude.ai/code/session_014koNTAiN4GCfCArsHWxnDW
…atting-nbwSK Reformat long lines to improve code readability
Aligns Python's APIResponse with the richer structure returned by MATLAB's ndi.cloud.api apiResponse output argument. All new fields use safe defaults so existing call-sites (including manually-constructed APIResponse instances in pagination helpers) are fully backward-compatible. https://claude.ai/code/session_01Y9G6ysXeXzrXRsZGe2Pe3G
…source of truth Renames (with backward-compatible aliases): - download.downloadFullDataset → download.dataset - filehandler.rewrite_file_info_for_cloud → filehandler.updateFileInfoForRemoteFiles - sync._delete_local_docs → sync.deleteLocalDocuments (now public) - sync._download_docs_by_ids → sync.downloadNdiDocuments (now public) New functions ported from MATLAB: - download.datasetDocuments — per-document download with mode handling - download.downloadGenericFiles — download generic_file docs with extensions - download.setFileInfo — set file_info for local/hybrid modes - download.structsToNdiDocuments — alias for jsons2documents - upload.uploadToNDICloud — legacy upload entry point - upload.scanForUpload — moved from orchestration to match MATLAB location - filehandler.updateFileInfoForLocalFiles — update file_info for local files - internal.duplicateDocuments — find/remove duplicate cloud documents Test cleanup: - Add module-scoped autouse fixture to sweep up any leftover NDI_PYTEST_* datasets after all tests complete, preventing stale dataset accumulation. https://claude.ai/code/session_01Y9G6ysXeXzrXRsZGe2Pe3G
The safety-net fixture now prints a warnings.warn with the names and IDs of every leftover dataset it deletes, making silent teardown failures visible in CI logs. https://claude.ai/code/session_01Y9G6ysXeXzrXRsZGe2Pe3G
…api-response-fUucA Expand APIResponse to capture additional HTTP response metadata
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces a comprehensive porting guide that establishes the principles and standards for converting MATLAB code to Python while maintaining strict architectural symmetry with the original codebase.
Key Changes
PYTHON_PORTING_GUIDE.mdwith six core sections defining the porting philosophy:+packages to Python directory structure@pydantic.validate_calldecorator for input validation parity with MATLAB'sargumentsblockNotable Implementation Details
double→ Pythonfloat/int, etc.)https://claude.ai/code/session_012qih1bFF69sgSPvBnWzEHo