Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 4 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ jobs:
with:
enable-cache: true

- name: Install just
uses: extractions/setup-just@v3

- name: Install dependencies
run: uv sync --only-dev

Expand All @@ -27,4 +30,4 @@ jobs:
key: precommit-${{ hashFiles('.pre-commit-config.yaml') }}

- name: Run pre-commit
run: uv run pre-commit run --all-files
run: just fmt
5 changes: 4 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ jobs:
with:
enable-cache: true

- name: Install just
uses: extractions/setup-just@v3

- name: Install dependencies
run: uv sync

- name: Run tests and generate coverage report
run: make coverage
run: just cov
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.11.6
rev: v0.15.4
hooks:
- id: ruff
- id: ruff-check
- id: ruff-format

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: pretty-format-json
args: [--autofix, --no-sort-keys]

- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.14.0
rev: v2.16.0
hooks:
- id: pretty-format-toml
args: [--autofix, --no-sort, --trailing-commas]
exclude: uv.lock
- id: pretty-format-yaml
args: [--autofix, --offset=2, --preserve-quotes]

- repo: https://github.com/executablebooks/mdformat
rev: 0.7.22
- repo: https://github.com/hukkin/mdformat
rev: 1.0.0
hooks:
- id: mdformat

- repo: https://github.com/crate-ci/typos
rev: v1.29.5
rev: v1.44.0
hooks:
- id: typos
args: [--force-exclude]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.14.1
rev: v1.19.1
hooks:
- id: mypy
args: []
Expand Down
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.13
3.14
30 changes: 0 additions & 30 deletions Makefile

This file was deleted.

18 changes: 7 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This README includes some justification and references for the choices made in t

- [pre-commit](#pre-commit)
- [pytest](#pytest)
- [Makefile](#makefile)
- [just](#just)
- [uv](#uv)
- [GitHub Actions](#github-actions)

Expand All @@ -35,15 +35,15 @@ pytest is extensible. I advise using [`pytest-mock`](https://pytest-mock.readthe

Test coverage is calculated using the `coverage` package.

## Makefile
## just

The [Makefile](https://www.gnu.org/software/make/manual/make.html) is used in this repo as a collection of small useful scripts. Most notably:
[just](https://just.systems/man/en/) is a handy way to save and run project-specific commands. These are stored in the `justfile`. The following commands are available in this repo:

- `make fmt` runs autoformatting and linting
- `make test` runs tests
- `make coverage` runs tests and generates a coverage report
- `just fmt` runs autoformatting and linting
- `just test` runs tests
- `just cov` runs tests and generates a coverage report

Simply run `make` to get an overview of available commands.
Run `just --list` to get an overview of available commands.

## uv

Expand All @@ -66,7 +66,3 @@ For open source repos, I recommend use the [official pre-commit CI](https://pre-
The repo also includes a Dependabot configuration. This can help keep your Python dependencies and GitHub Actions up-to-date.

Because Dependabot can get a bit spammy with its pull requests, it's configured to skip patch versions and only open pull requests once a week.

> [!WARNING]
> Dependabot does not yet support uv.
> Support is planned for Q1 2025 and can be tracked [here](https://github.com/dependabot/dependabot-core/issues/10478).
14 changes: 14 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
alias t := test

# Run autoformatting and linting
fmt:
@uv run pre-commit run --all-files

# Run tests
test:
@uv run pytest

# Run tests and report coverage
cov:
@uv run coverage run -m pytest
@uv run coverage report
31 changes: 12 additions & 19 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,30 @@ authors = [
]
repository = "https://github.com/stinodego/python-ci"
readme = "README.md"
requires-python = ">=3.11"
requires-python = ">=3.14"
dependencies = [
"polars>=1.21.0",
"polars>=1.38.1",
]

[project.scripts]
mycli = 'mypackage.__main__:main'

[dependency-groups]
dev = [
"coverage>=7.6.10",
"mypy>=1.14.1",
"pre-commit>=4.1.0",
"pytest>=8.3.4",
"pytest-mock>=3.14.0",
"ruff>=0.9.4",
"coverage>=7.13.4",
"mypy>=1.19.1",
"pre-commit>=4.5.1",
"pytest>=9.0.2",
"pytest-mock>=3.15.1",
"ruff>=0.15.4",
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.uv]
required-version = ">=0.6,<0.7"
required-version = ">=0.10,<0.11"

[tool.ruff]
src = ["src"]
Expand Down Expand Up @@ -65,9 +65,6 @@ ignore = [
[tool.ruff.lint.pycodestyle]
max-doc-length = 88

[tool.ruff.lint.isort]
force-single-line = true

[tool.ruff.lint.pydocstyle]
convention = "google"

Expand All @@ -78,16 +75,13 @@ ban-relative-imports = "all"
files = "src"
mypy_path = "src"
strict = true
enable_error_code = [
"redundant-expr",
"truthy-bool",
"ignore-without-code",
]

[tool.pytest.ini_options]
[tool.pytest]
strict = true
addopts = [
"--import-mode=importlib",
]
filterwarnings = ["error"]

[tool.coverage.run]
source = ["src"]
Expand All @@ -97,6 +91,5 @@ branch = true
skip_covered = true
show_missing = true
exclude_also = [
"if TYPE_CHECKING:",
"if __name__ == .__main__.:",
]
4 changes: 4 additions & 0 deletions src/mypackage/__main__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
def main() -> None:
"""Run the main pipeline."""
print("This is my package.")


if __name__ == "__main__":
main()
Empty file removed tests/__init__.py
Empty file.
Empty file removed tests/integration/__init__.py
Empty file.
Empty file removed tests/unit/__init__.py
Empty file.
Loading