-
Notifications
You must be signed in to change notification settings - Fork 24
General update to follow best practice #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… `pyproject.toml` formatting and metadata
… improve dependency management
…ions, and integrate `uv`
… pre-commit.ci configuration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request comprehensively modernizes a Python template repository by migrating from legacy setup.py to pyproject.toml, restructuring the package layout to use src/sandbox/, and updating CI/CD workflows and tooling to current best practices.
Key changes:
- Migrated build system to PEP 621 compliant
pyproject.tomlwith setuptools backend and PEP 735 dependency groups - Restructured package from
src/tosrc/sandbox/with proper module initialization and documentation - Updated GitHub Actions workflows to use modern action versions,
uvfor dependency management, and direct PyPI publishing
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | New build configuration with setuptools, Ruff linting rules, pytest config, and dependency groups |
| src/sandbox/init.py | Package initialization with version string |
| src/sandbox/hello.py | Moved hello module with added docstrings and doctests |
| test/test_hello.py | Updated imports to match new package structure and added docstrings |
| src/init.py | Removed old package initialization |
| src/hello.py | Removed old module location |
| setup.py | Removed legacy setup file |
| Makefile | Removed in favor of pre-commit hooks |
| .pre-commit-config.yaml | Added pre-commit configuration with Ruff, mdformat, codespell, and other hooks |
| .github/workflows/test.yml | Updated to Python 3.9-3.12, modern actions, and uv for dependencies |
| .github/workflows/publish.yml | Modernized with updated actions and pypa/gh-action-pypi-publish |
| .github/workflows/welcome.yml | Removed outdated welcome workflow |
| .github/dependabot.yml | Added Dependabot for pip and GitHub Actions updates |
| .github/pull_request_template.md | Added PR checklist template |
| .github/ISSUE_TEMPLATE/bug_report.yml | Added structured bug report template |
| .github/ISSUE_TEMPLATE/feature_request.yml | Added structured feature request template |
| .github/CODEOWNERS | Added CODEOWNERS file (currently empty) |
| README.md | Updated documentation to reflect new structure, tools, and workflows |
| .gitignore | Added JetBrain IDE exclusion |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "twine", | ||
| "wheel", | ||
| ] | ||
|
|
Copilot
AI
Jan 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The [dependency-groups] section is using PEP 735 syntax, which was finalized in late 2024. While this is a modern approach, note that this requires pip 23.1+ or other tools that support PEP 735. The test workflow uses uv sync --dev which should handle this correctly, but ensure that the documentation or requirements specify the minimum pip version needed for manual installation.
| [project.optional-dependencies] | |
| dev = [ | |
| "pre-commit", | |
| "pytest", | |
| "twine", | |
| "wheel", | |
| ] |
| build: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| python-version: [3.8] | ||
| steps: | ||
| - name: 🛎️ Checkout | ||
| uses: actions/checkout@v3 | ||
| uses: actions/checkout@v4 | ||
| - name: 🐍 Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| ref: ${{ github.head_ref }} | ||
| - name: 🐍 Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v2 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| - name: 🦾 Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install ".[dev]" | ||
| - name: 🚀 Publish to PyPi | ||
| env: | ||
| PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
| PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
| PYPI_TEST_PASSWORD: ${{ secrets.PYPI_TEST_PASSWORD }} | ||
| python-version: "3.10" | ||
| cache: "pip" | ||
| - name: 🦾 Install build dependencies | ||
| run: | | ||
| make publish -e PYPI_USERNAME=$PYPI_USERNAME -e PYPI_PASSWORD=$PYPI_PASSWORD -e PYPI_TEST_PASSWORD=$PYPI_TEST_PASSWORD | ||
| python -m pip install --upgrade pip build | ||
| - name: 📦 Build package | ||
| run: python -m build | ||
| - name: Upload to release | ||
| uses: AButler/[email protected] | ||
| with: | ||
| files: "dist/*" | ||
| repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: 🚀 Publish to PyPI | ||
| uses: pypa/[email protected] | ||
| with: | ||
| password: ${{ secrets.PYPI_PASSWORD }} |
Copilot
AI
Jan 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The publish workflow no longer includes running tests before publishing. The old workflow had a matrix strategy that could run tests, but the new workflow goes straight to building and publishing. Consider adding a test step before publishing to ensure that only tested code gets published to PyPI.
| # | ||
| # See https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners | ||
| # | ||
| # Order is important; the last matching pattern takes precedence. |
Copilot
AI
Jan 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CODEOWNERS file is created but contains only comments and no actual ownership assignments. This means no code owners are specified for any files in the repository. Consider adding actual owner assignments or remove this file if it's not needed yet.
| # Order is important; the last matching pattern takes precedence. | |
| # Order is important; the last matching pattern takes precedence. | |
| * @org/team-name |
| files: "dist/*" | ||
| repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: 🚀 Publish to PyPI | ||
| uses: pypa/[email protected] |
Copilot
AI
Jan 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pypa/gh-action-pypi-publish action version v1.1.0 is outdated. The current stable version is v1.12.2 (as of late 2024). Using an outdated version may lack important security fixes and features. Consider updating to the latest version.
| uses: pypa/gh-action-pypi-publish@v1.1.0 | |
| uses: pypa/gh-action-pypi-publish@v1.12.2 |
| strategy: | ||
| matrix: | ||
| python-version: [3.7, 3.8, 3.9] | ||
| python-version: ["3.9", "3.10", "3.11", "3.12"] |
Copilot
AI
Jan 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test workflow only tests Python versions 3.9-3.12, but pyproject.toml declares support for Python 3.13 and 3.14. Either remove the unsupported versions from pyproject.toml classifiers or add them to the test matrix to ensure compatibility.
| python-version: ["3.9", "3.10", "3.11", "3.12"] | |
| python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] |
| - name: 🧪 Test | ||
| run: "python -m pytest ./test" | ||
| run: uv run pytest test/ src/ |
Copilot
AI
Jan 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test workflow no longer includes a linting step. The old workflow ran 'make check_code_quality' with flake8, but the new workflow only runs pytest. Consider adding a step to run Ruff linting checks to catch code quality issues in CI, especially since pre-commit hooks with Ruff are now configured.
| ## Why reinvent the wheel? | ||
|
|
||
| There are several very good templates on GitHub, but I prefer to use code we wrote instead of blinding taking the most starred template and having features we don't need. From experience, it's better to keep it simple and general enough for our specific use cases. | ||
| There are several very good templates on GitHub, I prefer to use code we wrote instead of blinding taking the most starred template and having features we don't need. From experience, it's better to keep it simple and general enough for our specific use cases. |
Copilot
AI
Jan 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: 'blinding' should be 'blindly'.
| There are several very good templates on GitHub, I prefer to use code we wrote instead of blinding taking the most starred template and having features we don't need. From experience, it's better to keep it simple and general enough for our specific use cases. | |
| There are several very good templates on GitHub, I prefer to use code we wrote instead of blindly taking the most starred template and having features we don't need. From experience, it's better to keep it simple and general enough for our specific use cases. |
This pull request modernizes and restructures the Python template repository to align with current best practices for Python packaging, testing, linting, and CI/CD. The changes include migrating to a
pyproject.toml-based build system, introducing pre-commit hooks, updating GitHub Actions workflows, and improving documentation and templates for contributors.Key changes:
1. Build System & Packaging Modernization
setup.pyandMakefileto apyproject.toml-based build system using setuptools, with dynamic versioning and explicit dev dependencies. Old files (setup.py,Makefile) and legacy code structure were removed. [1] [2] [3]src/sandbox/, with__version__defined insrc/sandbox/__init__.py. [1] [2] [3] [4]2. Linting, Formatting, and Pre-commit
.pre-commit-config.yamlfor pre-commit hooks, including Ruff for linting/formatting, mdformat, codespell, and others.3. CI/CD and Dependency Management
uvfor dependency management, and Ruff for linting.pypa/gh-action-pypi-publish.4. Documentation and Contributor Experience
README.mdto reflect new structure, tools, and workflows, including publishing instructions and code quality/testing guidelines. (Ff35fefbL1, [1] [2] [3]CODEOWNERSfile for repository ownership.5. Testing
These updates significantly improve maintainability, developer experience, and automation for the Python template repository.