Skip to content

Commit 5aeede2

Browse files
committed
Move ndi_common/ into src/ndi/ so it ships with the installed package
The ndi_common directory (containing database_documents, schema_documents, and other shared resources) was at the repo root, outside the wheel build target of src/ndi/. This meant pip-installed copies of NDI could not find document definitions at runtime, causing a ValueError in PathConstants._find_ndi_root(). - Move ndi_common/ to src/ndi/ndi_common/ - Simplify _find_ndi_root() to look for ndi_common as a sibling inside the ndi package directory (parent.parent from common/__init__.py) - Update MANIFEST.in and pyproject.toml sdist includes https://claude.ai/code/session_01NGmmNwo8UuRLbeuwEDGuDZ
1 parent 5c9b944 commit 5aeede2

210 files changed

Lines changed: 13 additions & 19 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

MANIFEST.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ include README.md
33
include CHANGELOG.md
44
include MATLAB_MAPPING.md
55

6-
recursive-include ndi_common *.json *.txt *.tsv *.tsv.gz *.obo *.md
7-
recursive-include ndi_common/example_binaries *
8-
recursive-include ndi_common/example_datasets *
9-
recursive-include ndi_common/daq_systems *
6+
recursive-include src/ndi/ndi_common *.json *.txt *.tsv *.tsv.gz *.obo *.md
7+
recursive-include src/ndi/ndi_common/example_binaries *
8+
recursive-include src/ndi/ndi_common/example_datasets *
9+
recursive-include src/ndi/ndi_common/daq_systems *

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ allow-direct-references = true
9090
packages = ["src/ndi"]
9191

9292
[tool.hatch.build.targets.sdist]
93-
include = ["/src", "/ndi_common", "/tests", "/examples", "LICENSE", "README.md", "CHANGELOG.md", "MATLAB_MAPPING.md"]
93+
include = ["/src", "/tests", "/examples", "LICENSE", "README.md", "CHANGELOG.md", "MATLAB_MAPPING.md"]
9494

9595
[tool.pytest.ini_options]
9696
testpaths = ["tests"]

src/ndi/common/__init__.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,19 @@ def _find_ndi_root(cls) -> Path:
3434
"""Find the NDI root directory.
3535
3636
Looks for environment variable NDI_ROOT, or tries to find it
37-
relative to this package. Searches multiple possible locations.
37+
relative to this package. The ndi_common directory lives inside
38+
the ndi package (src/ndi/ndi_common), so the root is the ndi
39+
package directory itself.
3840
"""
3941
if os.environ.get("NDI_ROOT"):
4042
return Path(os.environ["NDI_ROOT"])
4143

42-
# Try to find it relative to this file
43-
# src/ndi/common/__init__.py -> src/ndi/common -> src/ndi -> src -> repo_root
44-
package_dir = Path(__file__).parent.parent.parent.parent
44+
# ndi_common is inside the ndi package directory.
45+
# src/ndi/common/__init__.py -> common -> ndi (package root)
46+
package_dir = Path(__file__).parent.parent
4547

46-
# Check multiple possible locations for ndi_common
47-
possible_paths = [
48-
package_dir / "ndi_common", # repo_root/ndi_common
49-
package_dir / "src" / "ndi" / "ndi_common", # repo_root/src/ndi/ndi_common
50-
]
51-
52-
for path in possible_paths:
53-
if path.exists() and (path / "database_documents").exists():
54-
# Return the parent that contains ndi_common
55-
return path.parent
48+
if (package_dir / "ndi_common" / "database_documents").exists():
49+
return package_dir
5650

5751
raise ValueError(
5852
"Cannot find NDI root directory. "

ndi_common/config/ndi_document2table_abbreviations.json renamed to src/ndi/ndi_common/config/ndi_document2table_abbreviations.json

File renamed without changes.
File renamed without changes.

ndi_common/controlled_vocabulary/GenBankControlledVocabulary-info.txt renamed to src/ndi/ndi_common/controlled_vocabulary/GenBankControlledVocabulary-info.txt

File renamed without changes.

ndi_common/controlled_vocabulary/GenBankControlledVocabulary.tsv.gz renamed to src/ndi/ndi_common/controlled_vocabulary/GenBankControlledVocabulary.tsv.gz

File renamed without changes.
File renamed without changes.

ndi_common/controlled_vocabulary/NIFBrainAreaControlledVocabulary-info.txt renamed to src/ndi/ndi_common/controlled_vocabulary/NIFBrainAreaControlledVocabulary-info.txt

File renamed without changes.

ndi_common/controlled_vocabulary/NIFBrainAreaControlledVocabulary.tsv.gz renamed to src/ndi/ndi_common/controlled_vocabulary/NIFBrainAreaControlledVocabulary.tsv.gz

File renamed without changes.

0 commit comments

Comments
 (0)