Modernize Build System and CI/CD with uv and PEP Standards#123
Open
abstract-333 wants to merge 4 commits intoipinfo:masterfrom
Open
Modernize Build System and CI/CD with uv and PEP Standards#123abstract-333 wants to merge 4 commits intoipinfo:masterfrom
uv and PEP Standards#123abstract-333 wants to merge 4 commits intoipinfo:masterfrom
Conversation
- Replace imperative setup.py with declarative pyproject.toml (PEP 621) - Adopt PEP 517/518 compliant build system using hatchling - Pin `requires-python = ">=3.10"` to align with Build CI defaults - Remove pip-tools as uv natively handles locking and syncing - Initialize uv.lock for deterministic and faster dependency resolution - Reorganize dev dependencies into [dependency-groups]
- Update ipinfo/handler_utils.py to use __version__ instead of SDK_VERSION - Remove legacy version imports in setup.py to follow PEP 517 - Ensure User-Agent strings reflect the standardized version attribute - Align internal API with PEP 396 module versioning conventions
- Replace legacy `uv pip install` with `uv sync --all-groups` for locked dev environments - Remove manual `requirements.txt` installation in favor of pyproject.toml discovery - Clean up `uv build` by removing unnecessary `--no-build-isolation` flag - Leverage `astral-sh/setup-uv` caching for faster test and publish runs
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
This PR modernizes the ipinfo Python library’s packaging and CI/CD workflows by migrating from a legacy
setup.py-based setup to a fully declarative, standards-compliant build system. By adoptingpyproject.toml,uv, and current PEP standards, we improve reproducibility, security, performance, and long-term maintainability while simplifying the contributor experience.Proposed Changes
🛠 Build System Migration (PEP 621)
setup.pyscript with a staticpyproject.tomlfollowing PEP 621 (Standard tool for project metadata).hatchlingas the build backend to ensure a secure and standardized build process.pip-toolsandrequirements.txt. All dependencies are now declared inpyproject.tomland locked inuv.lockfor 100% deterministic builds.requires-python = "=3.10"for CI alignment, while keeping the library’s minimum supported version aspython>=3.9.🏷 Versioning Standardization (PEP 396)
SDK_VERSIONwith the industry-standard__version__in compliance with PEP 396 (Module version numbers).ipinfo/handler_utils.pyand legacy build references to use the__version__dunder attribute.🚀 CI/CD Optimization (GitHub Actions)
pip installtouv sync --all-groupsin GitHub Actions. This ensures the CI environment is an exact mirror of the local development environment.uv buildby removing unnecessary flags and leveragingastral-sh/setup-uvcaching.Testing Performed
uv lockgenerates a valid lockfile.uv buildto generate.whland.tar.gzdistributions.uv run pytest(Pro API-dependent tests were not executed due to missing Pro API key).User-Agentheaders correctly reflect the version string from__version__.