Skip to content

Conversation

@Borda
Copy link
Member

@Borda Borda commented Jan 8, 2026

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

  • Migrated from setup.py and Makefile to a pyproject.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]
  • Refactored package structure: code now resides in src/sandbox/, with __version__ defined in src/sandbox/__init__.py. [1] [2] [3] [4]

2. Linting, Formatting, and Pre-commit

  • Added .pre-commit-config.yaml for pre-commit hooks, including Ruff for linting/formatting, mdformat, codespell, and others.
  • Updated documentation to describe pre-commit usage instead of Makefile-based code quality checks.

3. CI/CD and Dependency Management

  • Overhauled GitHub Actions workflows:
    • Test workflow now uses Python 3.9–3.12, uv for dependency management, and Ruff for linting.
    • Publish workflow updated for modern actions, caching, and direct PyPI publishing via pypa/gh-action-pypi-publish.
  • Added Dependabot configuration for pip and GitHub Actions updates.
  • Removed the outdated welcome workflow.

4. Documentation and Contributor Experience

  • Updated README.md to reflect new structure, tools, and workflows, including publishing instructions and code quality/testing guidelines. (Ff35fefbL1, [1] [2] [3]
  • Added PR checklist template and improved issue templates for bugs and feature requests. [1] [2] [3]
  • Introduced a CODEOWNERS file for repository ownership.

5. Testing

  • Refactored tests to match new package structure and improved docstrings for clarity. [1] [2]

These updates significantly improve maintainability, developer experience, and automation for the Python template repository.

@Borda Borda marked this pull request as ready for review January 8, 2026 17:12
Copilot AI review requested due to automatic review settings January 8, 2026 17:12
@Borda Borda merged commit dbce859 into main Jan 8, 2026
4 checks passed
@Borda Borda deleted the update branch January 8, 2026 17:17
Copy link

Copilot AI left a 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.toml with setuptools backend and PEP 735 dependency groups
  • Restructured package from src/ to src/sandbox/ with proper module initialization and documentation
  • Updated GitHub Actions workflows to use modern action versions, uv for 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",
]

Copy link

Copilot AI Jan 8, 2026

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.

Suggested change
[project.optional-dependencies]
dev = [
"pre-commit",
"pytest",
"twine",
"wheel",
]

Copilot uses AI. Check for mistakes.
Comment on lines 7 to 31
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 }}
Copy link

Copilot AI Jan 8, 2026

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.

Copilot uses AI. Check for mistakes.
#
# 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.
Copy link

Copilot AI Jan 8, 2026

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.

Suggested change
# Order is important; the last matching pattern takes precedence.
# Order is important; the last matching pattern takes precedence.
* @org/team-name

Copilot uses AI. Check for mistakes.
files: "dist/*"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: 🚀 Publish to PyPI
uses: pypa/[email protected]
Copy link

Copilot AI Jan 8, 2026

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.

Suggested change
uses: pypa/gh-action-pypi-publish@v1.1.0
uses: pypa/gh-action-pypi-publish@v1.12.2

Copilot uses AI. Check for mistakes.
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: ["3.9", "3.10", "3.11", "3.12"]
Copy link

Copilot AI Jan 8, 2026

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.

Suggested change
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]

Copilot uses AI. Check for mistakes.
Comment on lines 23 to 25
- name: 🧪 Test
run: "python -m pytest ./test"
run: uv run pytest test/ src/
Copy link

Copilot AI Jan 8, 2026

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.

Copilot uses AI. Check for mistakes.
## 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.
Copy link

Copilot AI Jan 8, 2026

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'.

Suggested change
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.

Copilot uses AI. Check for mistakes.
@Borda Borda mentioned this pull request Jan 8, 2026
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.

2 participants