Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.13"]
python-version: ["3.14"]

steps:
- uses: actions/checkout@v6
Expand All @@ -28,7 +28,7 @@ jobs:
uv sync --all-extras --dev
- name: Pre-commit checks
run: |
uv run pre-commit run --all-files
uv run prek run --all-files
- name: Run tests
run: |
uv run pytest
Expand All @@ -44,11 +44,3 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/build/html/
force_orphan: true

# TODO in the future
# - name: Build and push Docker image
# uses: docker/build-push-action@v2
# with:
# context: .
# push: true
# tags: nathfitz/test:latest
27 changes: 11 additions & 16 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,36 +1,31 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
- repo: builtin
hooks:
- id: trailing-whitespace
- id: check-added-large-files
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: check-toml
- id: check-yaml
- id: check-added-large-files
# Python-specific
- id: check-ast
- id: check-docstring-first
- id: debug-statements
- id: mixed-line-ending
- id: check-merge-conflict
- id: detect-private-key
- id: no-commit-to-branch

- repo: https://github.com/crate-ci/typos
rev: typos-dict-v0.12.4
rev: v1.40.0
hooks:
- id: typos
args: []

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.4
rev: v0.14.9
hooks:
- id: ruff
- id: ruff-check
Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

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

The hook ID has changed from 'ruff' to 'ruff-check'. Verify that this is the correct hook ID for the version of ruff-pre-commit being used (v0.14.9), as this may break pre-commit functionality if the hook ID doesn't exist in that version.

Suggested change
- id: ruff-check
- id: ruff

Copilot uses AI. Check for mistakes.
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format

- repo: https://github.com/dosisod/refurb
rev: v2.0.0
rev: v2.2.0
hooks:
- id: refurb

- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.393
hooks:
- id: pyright
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Use a Python image with uv pre-installed
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim
FROM ghcr.io/astral-sh/uv:python3.14-bookworm-slim

# Set the working directory to /pytemplate
WORKDIR /pytemplate
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ tests:
uv run pytest .

lint:
uv run pre-commit run --all-files
uv run prek run --all-files
uvx ty check

docs:
uv run sphinx-apidoc -f -o docs/source/ pytemplate
Expand Down
36 changes: 3 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# pytemplate

This is a Python 3.13 app called pytemplate. The project includes Docker, pyright, ruff, typos, GitHub Actions, pre-commit, and Sphinx.
This is a Python 3.14 app called pytemplate. The project includes Docker, ty, uv, ruff, typos, GitHub Actions, prek, and Sphinx.

The extremely fast Python package and project manager, [uv](https://docs.astral.sh/uv/#getting-started), is required.

Expand All @@ -10,43 +10,13 @@ The extremely fast Python package and project manager, [uv](https://docs.astral.

## Project Structure

The project structure is as follows:

```sh
pytemplate
├── .dockerignore
├── .github
│ ├── dependabot.yml
│ └── workflows
│ └── python-app.yml
├── .gitignore
├── .pre-commit-config.yaml
├── Dockerfile
├── Makefile
├── README.md
├── docs
│ ├── Makefile
│ └── source
│ ├── conf.py
│ └── index.rst
├── pyproject.toml
├── pytemplate
│ ├── __init__.py
│ ├── main.py
│ └── utils.py
├── ruff.toml
└── tests
├── test_main.py
└── test_utils.py
```

The source code is located in the `pytemplate` folder, which contains the `__init__.py`, `main.py`, and `utils.py` files. The tests are located in the `tests` folder, which contains the `test_main.py` and `test_utils.py` files.

The project uses toml for configuration instead of `setup.py`. The configuration file is located in `pyproject.toml`.

The project includes Docker, with a `Dockerfile` located in the root directory. The `.dockerignore` file is also located in the root directory.

The project includes `pyright` for static type checking, `typos` for code spell check, `ruff` for linting & code formatting, and `pre-commit` for enforcing these checks before git commits and on the CI. The configuration for these tools is located in the `ruff.toml` and `.pre-commit-config.yaml` files.
The project includes `pyright` for static type checking, `typos` for code spell check, `ruff` for linting & code formatting, and `prek` for enforcing these checks before git commits and on the CI. The configuration for these tools is located in the `ruff.toml` and `.pre-commit-config.yaml` files.
Comment thread
qartik marked this conversation as resolved.
Outdated

The project includes Sphinx for documentation, with the documentation located in the `docs` folder. The `source/conf.py` file contains the configuration for Sphinx.

Expand All @@ -65,7 +35,7 @@ To install the project, clone the repository and run:

```sh
uv sync
uv run pre-commit install
uv run prek install
```

See `Makefile` for other useful commands.
Expand Down
17 changes: 5 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ name = "pytemplate"
version = "0.0.1"
description = "A python library"
readme = "README.md"
requires-python = ">=3.13"
requires-python = ">=3.14"
authors = [{ name = "Author", email = "author@email.com" }]

[dependency-groups]
dev = [
"pre-commit==4.5.0",
"pytest==9.0.1",
"sphinx==9.0.1",
"prek~=0.2.22",
Comment thread
qartik marked this conversation as resolved.
"pytest~=9.0.2",
"sphinx~=9.0.4",
]

[tool.setuptools.packages.find]
Expand All @@ -23,15 +23,8 @@ where = ["."]
[project.urls]
Repository = "https://github.com/CQCL/pytemplate.git"

# See https://microsoft.github.io/pyright/#/getting-started
[tool.pyright]
include = ["pytemplate", "tests"]
ignore = ["**/*.ipynb"]
pythonVersion = "3.13"
typeCheckingMode = "strict"

[tool.pytest.ini_options]
pythonpath = ["."]

[tool.refurb]
python_version = "3.13"
python_version = "3.14"
2 changes: 1 addition & 1 deletion ruff.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# See https://docs.astral.sh/ruff/rules/
target-version = "py313"
target-version = "py314"

line-length = 88

Expand Down
Loading