Migrate from setup.py to pyproject.toml (hatchling)#2770
Merged
mikejhuang merged 1 commit intoFeb 16, 2026
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
ba85e66 to
55c73e3
Compare
setup.py imports allensdk at build time to read __version__, breaking clean installs. Dependencies live in five separate requirements files instead of package metadata. 18 files use pkg_resources at runtime, forcing a setuptools runtime dependency. - Replace setup.py/setup.cfg/MANIFEST.in with pyproject.toml (hatchling) - Consolidate requirements files into optional dependency groups - Replace pkg_resources.resource_filename with importlib.resources.files - Replace pkg_resources.parse_version with packaging.version.Version - Read __version__ from importlib.metadata instead of hardcoding - Convert bps bash wrapper to a [project.scripts] console entry point - Update CI workflows, docs, and notebook cells for new install path Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
55c73e3 to
879a70c
Compare
dyf
approved these changes
Feb 16, 2026
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.
Overview:
setup.py imports allensdk at build time to read
__version__, breaking clean installs. Dependencies live in five separate requirements files instead of package metadata. 18 files use pkg_resources at runtime, forcing a deprecated setuptools runtime dependency.Addresses:
Better packaging
Type of Fix:
functionality to not work as expected)
Solution:
Switch to using a pyproject.toml for this project, and adopt more modern python packaging standards like optional dependencies.
Changes:
setup.py/setup.cfg/MANIFEST.inwithpyproject.toml(hatchling backend)[project.optional-dependencies]extraspkg_resources.resource_filenamewithimportlib.resources.files(12 source files, 7 test files)pkg_resources.parse_versionwithpackaging.version.Version(brain_observatory_nwb_data_set.py)__version__fromimportlib.metadata.version("allensdk")instead of hardcodingbpsbash wrapper to a[project.scripts]console entry pointpkg_resourcesto print version infosetuptoolsandscikit-buildfrom runtime depspackaging(stdlib replacement forpkg_resources.parse_version)Note: test files use hardcoded package strings (e.g.,
files('allensdk.test.core'))instead of
files(__package__)because__package__can be empty during pytestcollection at module level.
Deleted files
setup.pypyproject.tomlsetup.cfgpyproject.toml [tool.pytest.ini_options]MANIFEST.inrequirements.txtpyproject.toml [project] dependenciestest_requirements.txtpyproject.toml [project.optional-dependencies] testdoc_requirements.txtpyproject.toml [project.optional-dependencies] docsdev_requirements.txtpyproject.toml [project.optional-dependencies] devnotebook_requirements.txtpyproject.toml [project.optional-dependencies] notebooksValidation:
All unit tests pass, all notebooks run without error, built wheels contain correct source files and extra package resources.
Checklist
Allen Institute Contribution Guidelines
Numpy Standards
appropriate
rc/x.y.z as its merge target