chore: migrate packaging to pyproject#102
Draft
maksimzayats wants to merge 1 commit into
Draft
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates packaging/build configuration to avoid importing the package at build time and to support PEP 517 builds.
Changes:
- Derive package version in
setup.pyby reading/executingconstructor_io/__init__.pyviarunpy.run_pathinstead of importing the package. - Add a minimal
pyproject.tomlbuild-system configuration (setuptools + wheel).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| setup.py | Changes version resolution to avoid importing the package during setup, and uses the resolved version for download_url. |
| pyproject.toml | Adds PEP 517 build-system metadata for setuptools builds. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ba05515 to
53c3b1d
Compare
73daaa3 to
587cd8e
Compare
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
Migrates package metadata from
setup.pyintopyproject.tomlusing PEP 621 and setuptools' declarative configuration.This removes
setup.pyentirely, adds a dedicatedconstructor_io/_version.pyversion source, and keepsconstructor_io.__version__available by re-exporting it fromconstructor_io/__init__.py.Why
The previous bridge implementation used
runpy.run_path()to readconstructor_io/__init__.pyduring build metadata generation. That still executes module code, which can make builds fragile if__init__.pylater imports dependencies that are not installed yet or performs runtime initialization.A full pyproject migration avoids that helper entirely. Setuptools reads the literal version from
constructor_io._version.__version__via dynamic metadata, while runtime callers can continue importingconstructor_io.__version__.Packaging changes
[project]metadata topyproject.tomlfor package name, description, README, MIT license, author, homepage, andrequests~=2.26.requires-python, matching the current published sdist metadata and avoiding an intentional narrowing of advertised Python install support in this packaging-only migration.dynamic = ["version"]withtool.setuptools.dynamic.versionpointing atconstructor_io._version.__version__.constructor_ioand subpackages to preserve the old wheel contents.make buildto use nativeuv build --sdist --wheel --out-dir dist, producing both the sdist and a universal wheel.--ignore setup.pyoption.Metadata note
This accepts modern PEP 621 metadata shape changes. Generated metadata is equivalent for package identity, version, README, and runtime dependency, but not byte-for-byte identical to the old
setup.pyoutput.No
uv.lockis added; this remains a library package using Pipfile/Pipfile.lock for the existing development environment.The selected build backend requirement,
setuptools>=77.0.0, has its own Python floor for building from source. That is separate from declaring a runtimeRequires-Pythonvalue, which this PR intentionally leaves unset to match prior package metadata. Python 3.6 consumers should install the publishedpy3-none-anywheel rather than build from sdist.Validation
uvx --from pipenv pipenv run python -m pip wheel . --no-deps --wheel-dir /tmp/constructorio-python-wheel-testmake build(uv build --sdist --wheel --out-dir dist)uvx --from twine twine check dist/*uvx --from pipenv pipenv run python -c "from constructor_io import __version__; print(__version__)"Requires-Dist: requests~=2.26with noRequires-Python, matching the current published sdist.Root-Is-Purelib: trueandTag: py3-none-any.constructor_iopackage files are included.Test note
uvx --from pipenv pipenv run pytest tests/modulescould not run because the existing Pipenv virtualenv does not havepytestinstalled. A one-off retry with temporarypytest,pytest-cov, andrequestsdependencies reached collection but was blocked by missing credentials:TEST_REQUEST_API_KEYandTEST_CATALOG_API_KEY.No SDK request/runtime behavior was changed.