Skip to content

chore: migrate packaging to pyproject#102

Draft
maksimzayats wants to merge 1 commit into
Constructor-io:masterfrom
maksimzayats:chore/introduce-pyproject-toml
Draft

chore: migrate packaging to pyproject#102
maksimzayats wants to merge 1 commit into
Constructor-io:masterfrom
maksimzayats:chore/introduce-pyproject-toml

Conversation

@maksimzayats

@maksimzayats maksimzayats commented Jun 15, 2026

Copy link
Copy Markdown

Summary

Migrates package metadata from setup.py into pyproject.toml using PEP 621 and setuptools' declarative configuration.

This removes setup.py entirely, adds a dedicated constructor_io/_version.py version source, and keeps constructor_io.__version__ available by re-exporting it from constructor_io/__init__.py.

Why

The previous bridge implementation used runpy.run_path() to read constructor_io/__init__.py during build metadata generation. That still executes module code, which can make builds fragile if __init__.py later 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 importing constructor_io.__version__.

Packaging changes

  • Adds [project] metadata to pyproject.toml for package name, description, README, MIT license, author, homepage, and requests~=2.26.
  • Does not add requires-python, matching the current published sdist metadata and avoiding an intentional narrowing of advertised Python install support in this packaging-only migration.
  • Uses dynamic = ["version"] with tool.setuptools.dynamic.version pointing at constructor_io._version.__version__.
  • Restricts package discovery to constructor_io and subpackages to preserve the old wheel contents.
  • Updates make build to use native uv build --sdist --wheel --out-dir dist, producing both the sdist and a universal wheel.
  • Removes the stale pytest --ignore setup.py option.

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.py output.

No uv.lock is 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 runtime Requires-Python value, which this PR intentionally leaves unset to match prior package metadata. Python 3.6 consumers should install the published py3-none-any wheel rather than build from sdist.

Validation

  • uvx --from pipenv pipenv run python -m pip wheel . --no-deps --wheel-dir /tmp/constructorio-python-wheel-test
  • make 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__)"
  • Inspected generated metadata and confirmed Requires-Dist: requests~=2.26 with no Requires-Python, matching the current published sdist.
  • Inspected wheel metadata and confirmed Root-Is-Purelib: true and Tag: py3-none-any.
  • Inspected wheel contents to confirm only constructor_io package files are included.

Test note

uvx --from pipenv pipenv run pytest tests/modules could not run because the existing Pipenv virtualenv does not have pytest installed. A one-off retry with temporary pytest, pytest-cov, and requests dependencies reached collection but was blocked by missing credentials: TEST_REQUEST_API_KEY and TEST_CATALOG_API_KEY.

No SDK request/runtime behavior was changed.

@maksimzayats maksimzayats marked this pull request as ready for review June 15, 2026 16:17
@maksimzayats maksimzayats requested a review from a team as a code owner June 15, 2026 16:17
Copilot AI review requested due to automatic review settings June 15, 2026 16:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.py by reading/executing constructor_io/__init__.py via runpy.run_path instead of importing the package.
  • Add a minimal pyproject.toml build-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.

Comment thread setup.py Outdated
Comment thread setup.py Outdated
@maksimzayats maksimzayats marked this pull request as draft June 15, 2026 16:23
@maksimzayats maksimzayats force-pushed the chore/introduce-pyproject-toml branch from ba05515 to 53c3b1d Compare June 15, 2026 16:35
@maksimzayats maksimzayats changed the title chore: introduce pyproject build system chore: migrate packaging to pyproject Jun 15, 2026
@maksimzayats maksimzayats force-pushed the chore/introduce-pyproject-toml branch 4 times, most recently from 73daaa3 to 587cd8e Compare June 15, 2026 17:02

@esezen esezen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants