CP-13290 Migrate Python packages from setup.cfg/setup.py to pyproject.toml#662
Open
SumoSourabh wants to merge 4 commits into
Open
CP-13290 Migrate Python packages from setup.cfg/setup.py to pyproject.toml#662SumoSourabh wants to merge 4 commits into
SumoSourabh wants to merge 4 commits into
Conversation
….toml Migrate the common, dvp, libs, platform, and tools packages to PEP 621 pyproject.toml. Centralize dependency version constraints in deps.toml and pin dvp-api to 1.10.0.dev3. Add company name to LICENSE files, standardize copyright headers, declare license-files in each package, replace the hardcoded dvp-api wheel path, fix flake8 warnings, and scope coverage to the tools package. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
PYT-536 made --plugin-name optional for `dvp init` (the auto-generated plugin id falls back as the display name), but the test asserting that init fails without --name was never updated. Replace it with a test that captures the current contract: init succeeds when --name is omitted and the internal init is invoked with name=None. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replace 'python setup.py sdist bdist_wheel' with 'python -m build' since setup.py was removed in the pyproject.toml migration. Drop the obsolete VERSION-file path trigger (the file no longer exists; versions live in each package's pyproject.toml). Bump checkout/setup-python action versions to match pre-commit.yml. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Migrates the repo’s Python packaging for all SDK modules from legacy setup.py/setup.cfg/requirements.txt to PEP 621 pyproject.toml, while updating build/test automation and housekeeping (licenses/headers) to match the new packaging model.
Changes:
- Replaced legacy packaging files with
pyproject.tomlacrosscommon,libs,platform,tools, anddvp, and removedVERSIONfiles. - Updated tooling/CI scripts and workflows to build/test/install using the new packaging layout.
- Updated LICENSE placeholders and refreshed/added copyright headers; updated a tools CLI test to reflect
--plugin-namebeing optional.
Reviewed changes
Copilot reviewed 47 out of 48 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/src/test/python/dlpx/virtualization/_internal/test_cli.py | Updates CLI init test to assert --plugin-name is optional and initialize.init() is invoked with name=None. |
| tools/src/test/python/dlpx/virtualization/_internal/engine_version.cfg | Bumps copyright year in test config. |
| tools/src/main/python/dlpx/virtualization/_internal/VERSION | Removes legacy version file for tools package. |
| tools/src/main/python/dlpx/virtualization/_internal/package_util.py | Switches version lookup to installed distribution metadata (importlib.metadata). |
| tools/setup.py | Removes legacy setuptools build script for tools. |
| tools/setup.cfg | Removes legacy setuptools metadata config for tools. |
| tools/requirements.txt | Removes legacy dev requirements file for tools. |
| tools/pyproject.toml | Adds PEP 621 metadata, deps, dev extras, entrypoint, setuptools config, and coverage config for tools. |
| tools/MANIFEST.in | Stops packaging removed VERSION file. |
| tools/LICENSE | Fills in Apache 2.0 template copyright placeholder. |
| platform/src/test/python/dlpx/virtualization/fake_generated_definitions.py | Adds missing standard header to test helper. |
| platform/src/main/python/dlpx/virtualization/platform/VERSION | Removes legacy version file for platform package. |
| platform/setup.py | Removes legacy setuptools build script for platform. |
| platform/setup.cfg | Removes legacy setuptools metadata config for platform. |
| platform/requirements.txt | Removes legacy dev requirements file for platform. |
| platform/pyproject.toml | Adds PEP 621 metadata/deps/dev extras and setuptools config for platform. |
| platform/LICENSE | Fills in Apache 2.0 template copyright placeholder. |
| linkcheck-skip.txt | Adds standard header to linkcheck skip list. |
| LICENSE | Fills in Apache 2.0 template copyright placeholder at repo root. |
| libs/src/test/python/dlpx/virtualization/_engine/init.py | Adds package marker with standard header for tests. |
| libs/src/main/python/dlpx/virtualization/libs/VERSION | Removes legacy version file for libs package. |
| libs/setup.py | Removes legacy setuptools build script for libs. |
| libs/setup.cfg | Removes legacy setuptools metadata config for libs. |
| libs/requirements.txt | Removes legacy dev requirements file for libs. |
| libs/pyproject.toml | Adds PEP 621 metadata/deps/dev extras and setuptools config for libs. |
| libs/LICENSE | Fills in Apache 2.0 template copyright placeholder. |
| dvp/src/test/python/test_not_used.py | Updates header years and removes trailing whitespace line. |
| dvp/src/main/python/dlpx/virtualization/VERSION | Removes legacy version file for dvp package. |
| dvp/src/main/python/dlpx/virtualization/init.py | Updates header years. |
| dvp/src/main/python/dlpx/init.py | Updates header years. |
| dvp/setup.py | Removes legacy setuptools build script for dvp. |
| dvp/setup.cfg | Removes legacy setuptools metadata config for dvp. |
| dvp/requirements.txt | Removes legacy dev requirements file for dvp. |
| dvp/pyproject.toml | Adds PEP 621 metadata/deps/dev extras and setuptools config for dvp. |
| dvp/LICENSE | Fills in Apache 2.0 template copyright placeholder. |
| docs/Pipfile | Adds standard header. |
| docs/build.sh | Adds standard header. |
| common/src/main/python/dlpx/virtualization/common/VERSION | Removes legacy version file for common package. |
| common/setup.py | Removes legacy setuptools build script for common. |
| common/setup.cfg | Removes legacy setuptools metadata config for common. |
| common/requirements.txt | Removes legacy dev requirements file for common. |
| common/pyproject.toml | Adds PEP 621 metadata/deps/dev extras and setuptools config for common. |
| common/LICENSE | Fills in Apache 2.0 template copyright placeholder. |
| bin/build_project.sh | Makes build/test/lint script more CI-friendly and aggregates failures; updates install/clean behavior for pyproject-based builds. |
| .github/workflows/publish-python-packages.yml | Updates publishing workflow to use python -m build and newer GitHub Actions versions. |
| .github/workflows/pre-commit.yml | Simplifies CI by installing all packages once per OS and running per-package test/lint steps. |
| .github/dependabot.yml | Adds standard header. |
| .bumpversion.cfg | Updates version bump configuration to target pyproject.toml instead of removed VERSION files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Problem
All five packages in this repo (
common,dvp,libs,platform,tools) used the legacysetup.cfg+setup.py+requirements.txtpackaging layout. This had a few real costs:setup.cfg, install deps insetup.py, dev deps inrequirements.txt, and the version in a separateVERSIONfile. Five places to look, five places to drift.requirements.txtused local-path entries (./../common, etc.) to install sibling packages from source. This worked but is not a standard, portable pattern — it tied developer workflow to the repo layout.pyproject.toml's[project]table, modern tooling (uv, hatch, Dependabot's pyproject support, IDEs) couldn't read the project metadata reliably. The package metadata couldn't be expressed in declarative form.Copyright [yyyy] [name of copyright owner]placeholder text from the upstream template — never filled in for Delphix/Perforce.build_project.shwas CI-hostile. It calledtputunconditionally (fails on non-TTY runners), aborted on the first module failure, and didn't clean.egg-infodirectories between builds.Solution
Packaging migration (per package)
For all five packages:
setup.cfg+setup.py+requirements.txtwith a singlepyproject.tomlusing PEP 621[project]metadata.VERSIONfiles; the version now lives as a static string in[project].version.tools/package_util.get_version()was refactored to useimportlib.metadata.version("dvp-tools")so it reads the installed-package version rather than a source-tree file.[project.dependencies]and[project.optional-dependencies].dev. Dev deps that previously lived inrequirements.txtare now published as a[dev]extra —pip install dvp-tools[dev]is now the standard way to install dev tooling.dvp-common == 5.1.0) are static strings in the dependency list..bumpversion.cfgwas extended with stanzas for eachpyproject.toml, so a singlebumpversionrun updates[project].versionand every sibling pin atomically.license = "Apache-2.0"withlicense-files = ["LICENSE"]. Requiressetuptools >= 77, which is pinned in each[build-system].requires.LICENSE files
All six
LICENSEfiles (root + per-package) had the Apache template placeholder filled in withCopyright 2026 Delphix Corp., a Perforce company.Copyright headers
Added or year-bumped the standard
# Copyright (c) YYYY by Delphix. All rights reserved.header on config files that were missing it (.bumpversion.cfg,.github/dependabot.yml,.github/workflows/publish-python-packages.yml,docs/Pipfile,docs/build.sh,linkcheck-skip.txt) and on source files modified by this commit..bumpversion.cfgcurrent_versionfrom5.0.1to5.1.0(pre-existing drift; the VERSION files were already at 5.1.0).VERSION-file stanzas (those files no longer exist).pyproject.toml, so the default{current_version}search updates both[project].versionand all sibling pins in one pass.bin/build_project.shtputcalls with a TTY check (CI now runs cleanly).failed_stepsaccumulator so all configured steps (build, flake8, pytest, coverage) run to completion and the script reports a summary instead of aborting on the first failure.*.egg-infodirectories alongsidebuild/.-iflag fromcoverage report(coverage is now scoped via[tool.coverage.run]intools/pyproject.toml).CI workflow (
.github/workflows/pre-commit.yml)Dependency version pin
Bumped the
dvp-apipin from1.10.0.dev0to1.10.0.dev3to align with the latest published TestPyPI dev release.Testing
Sdist parity check (vs
5.1.0.dev0on TestPyPI)Built local sdists for all five packages and diffed against
5.1.0.dev0(the last pre-migration sdist published).+ pyproject.toml,- setup.py,- src/.../VERSION— exactly the migration's intent.tools/plugin_template/,tools/validation_schemas/,tools/codegen/all present in the new sdist (verified viaMANIFEST.inround-trip).License-Expression: Apache-2.0replaces theClassifier: License :: ...form,Author-email: Delphix <…>replaces the legacy separateAuthor:/Author-email:fields,Project-URL: Homepage, …replaces the legacyHome-page:field.Provides-Extra: dev, which the old ones did not. Dev tooling is now installable via the standard[dev]extra mechanism instead of a separaterequirements.txt.Sdist build → wheel build round-trip
Built each package's sdist with
python -m build --sdist, then ranpip wheel --no-depsagainst the resulting tarball. All five wheels build cleanly. This was specifically the failure mode of the earlierdeps.toml-based design (sdists couldn't build into wheels becausedeps.tomlwasn't packaged) and is now fixed.Local dry-run of the new CI workflow
Created a fresh Python 3.11 virtualenv and ran the workflow steps end-to-end:
pytest common(37 tests)pytest libs(56 tests)pytest platform(282 tests)pytest tools(385 tests, 1 skipped)flake8 common / libs / platform / tools(main + test)The single failing test (
tools/.../test_cli.py::TestInitCli::test_name_required) passes in isolation but fails when run alongside its sibling tests in the same class. The test file hasn't been modified since 2019 and the migration touches no code under test. This is pre-existing test-class pollution that the new workflow surfaces; it does not block this PR.bumpversionconfig validationcurrent_version = 5.1.0now matches the static version strings in all fivepyproject.tomlfiles. The default{current_version}search in the new stanzas matches theversion = "5.1.0"line and every sibling pin in one pass; a future bump will update all of them atomically.Runtime version read
package_util.get_version()was rewritten to useimportlib.metadata.version("dvp-tools"). Afterpip install -e ./tools, callingget_version()returns'5.1.0'— the same return shape as before. Both callers (cli.py:__version__fordvp --versionandplugin_dependency_util.pyfor plugin scaffolding) consume only the string value and are unaffected.Bonus: stale test fix
Bundled in a second commit,
CP-13290 Replace stale test_name_required with test_name_optional:TestInitCli::test_name_requiredwas asserting thatdvp initfails without--name— pre-PYT-536 behavior. Commit8f19557made--plugin-nameoptional (the auto-generated plugin id falls back as the display name), but this test was never updated. It happened to pass on dev machines wheredvp initfails for unrelated reasons (no Java on PATH, write permission, etc.) and only surfaced in CI now that Ubuntu runners have Java available and the migration's install-once workflow runs the tools suite.Replaced with
test_name_optionalthat captures the current contract:dvp initsucceeds without--name, andinitialize.init()is invoked withname=None.