Skip to content

Commit 2147ddf

Browse files
committed
Fix GitHub Actions by setting correct branch
The primary fix here is to change the branch name in .github/workflows/test.yaml from master to main. However a general attempt at modernizing the overall CI/CD has been made. Changes include: - Added .pre-commit-config.yaml and prek to automate checks easily - Bumped minimum Python version to 3.10 - Added support for Python 3.14, 3.15, and there free-threaded variants - Added a Makefile to make dev a little easier - Added various dependency_groups to pyproject.toml
1 parent c7c629c commit 2147ddf

92 files changed

Lines changed: 18211 additions & 250 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/test.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: test
33
on:
44
push: # any branch
55
pull_request:
6-
branches: [master]
6+
branches: [main]
77

88
env:
99
FORCE_COLOR: 1
@@ -14,33 +14,34 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
17+
python-version:
18+
["3.10", "3.11", "3.12", "3.13", "3.14", "3.14t", "3.15-dev"]
1819

1920
steps:
2021
- uses: actions/checkout@v4
2122
- uses: astral-sh/setup-uv@v5
2223
with:
2324
python-version: ${{ matrix.python-version }}
2425
- name: Code formatting
25-
if: ${{ matrix.python-version == '3.13' }}
26+
if: ${{ matrix.python-version == '3.14' }}
2627
run: |
2728
uvx ruff check .
2829
uvx ruff format --check .
2930
- name: Typos
30-
if: ${{ matrix.python-version == '3.13' }}
31+
if: ${{ matrix.python-version == '3.14' }}
3132
run: |
3233
uvx typos .
3334
- name: Unit test
3435
run: |
3536
uvx --with . --with pytest coverage run -m pytest tests/
3637
- name: Type Checking
37-
if: ${{ matrix.python-version != '3.8' }}
38+
if: ${{ matrix.python-version != '3.10' }}
3839
run: |
3940
uvx --with . --with asyncssh mypy --strict src/ --platform win32
4041
uvx --with . --with asyncssh mypy --strict src/ --platform linux
4142
uvx --with . --with asyncssh mypy --strict src/ --platform darwin
4243
- name: Validate README.md
43-
if: ${{ matrix.python-version == '3.13' }}
44+
if: ${{ matrix.python-version == '3.14' }}
4445
# Ensure that the README renders correctly (required for uploading to PyPI).
4546
run: |
4647
uv pip install readme_renderer

.pre-commit-config.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: "v6.0.0"
4+
hooks:
5+
- id: check-case-conflict
6+
- id: check-executables-have-shebangs
7+
- id: check-merge-conflict
8+
- id: check-toml
9+
- id: check-yaml
10+
- id: detect-private-key
11+
- id: end-of-file-fixer
12+
- id: fix-byte-order-marker
13+
- id: mixed-line-ending
14+
- id: trailing-whitespace
15+
16+
- repo: https://github.com/astral-sh/ruff-pre-commit
17+
rev: "v0.15.6"
18+
hooks:
19+
- id: ruff-format
20+
args: [--config=pyproject.toml]
21+
- id: ruff-check
22+
args: [--config=pyproject.toml, --fix, --exit-non-zero-on-fix]
23+
24+
- repo: https://github.com/crate-ci/typos
25+
rev: v1.44.0
26+
hooks:
27+
- id: typos
28+
exclude: |
29+
(?x)^(
30+
tests/.*
31+
)$

Makefile

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Simple Makefile for use with a uv-based development environment
2+
# The at (@) prefix tells make to suppress output from the command
3+
# The hyphen (-) prefix tells make to ignore errors (e.g., if a directory doesn't exist)
4+
5+
.PHONY: install
6+
install: ## Install the virtual environment with dependencies
7+
@echo "🚀 Creating uv Python virtual environment"
8+
@uv python install 3.14
9+
@uv sync --python=3.14
10+
@echo "🚀 Installing Git prek hooks locally"
11+
@uv run prek install -f
12+
13+
.PHONY: check
14+
check: ## Run code quality tools.
15+
@echo "🚀 Checking lock file consistency with 'pyproject.toml'"
16+
@uv lock --locked
17+
@echo "🚀 Auto-formatting/Linting code and documentation: Running prek"
18+
@uv run prek run -a
19+
@echo "🚀 Static type checking: Running mypy"
20+
@uv run mypy
21+
22+
.PHONY: format
23+
format: ## Perform ruff formatting
24+
@uv run ruff format
25+
26+
.PHONY: lint
27+
lint: ## Perform ruff linting
28+
@uv run ruff check --fix
29+
30+
.PHONY: typecheck
31+
typecheck: ## Perform type checking
32+
@uv run mypy
33+
34+
.PHONY: test
35+
test: ## Test the code with pytest.
36+
@echo "🚀 Testing code: Running pytest"
37+
@uv run python -Xutf8 -m pytest --cov --cov-config=pyproject.toml --cov-report=xml tests
38+
39+
# TODO Add stuff for building Sphinx docs
40+
41+
.PHONY: build
42+
build: clean-build ## Build wheel file
43+
@echo "🚀 Creating wheel file"
44+
@uv build
45+
46+
.PHONY: tag
47+
tag: ## Add a Git tag and push it to origin with syntax: make tag TAG=tag_name
48+
@echo "🚀 Creating git tag: ${TAG}"
49+
@git tag -a ${TAG} -m ""
50+
@echo "🚀 Pushing tag to origin: ${TAG}"
51+
@git push origin ${TAG}
52+
53+
# Define variables for files/directories to clean
54+
BUILD_DIRS = build dist *.egg-info
55+
DOC_DIRS = build
56+
MYPY_DIRS = .mypy_cache dmypy.json dmypy.sock
57+
TEST_DIRS = .cache .pytest_cache htmlcov
58+
TEST_FILES = .coverage coverage.xml
59+
60+
.PHONY: clean-build
61+
clean-build: ## Clean build artifacts
62+
@echo "🚀 Removing build artifacts"
63+
@uv run python -c "import shutil; import os; [shutil.rmtree(d, ignore_errors=True) for d in '$(BUILD_DIRS)'.split() if os.path.isdir(d)]"
64+
65+
.PHONY: clean-docs
66+
clean-docs: ## Clean documentation artifacts
67+
@echo "🚀 Removing documentation artifacts"
68+
@uv run python -c "import shutil; import os; [shutil.rmtree(d, ignore_errors=True) for d in '$(DOC_DIRS)'.split() if os.path.isdir(d)]"
69+
70+
.PHONY: clean-mypy
71+
clean-mypy: ## Clean mypy artifacts
72+
@echo "🚀 Removing mypy artifacts"
73+
@uv run python -c "import shutil; import os; [shutil.rmtree(d, ignore_errors=True) for d in '$(MYPY_DIRS)'.split() if os.path.isdir(d)]"
74+
75+
.PHONY: clean-pycache
76+
clean-pycache: ## Clean pycache artifacts
77+
@echo "🚀 Removing pycache artifacts"
78+
@-find . -type d -name "__pycache__" -exec rm -r {} +
79+
80+
.PHONY: clean-ruff
81+
clean-ruff: ## Clean ruff artifacts
82+
@echo "🚀 Removing ruff artifacts"
83+
@uv run ruff clean
84+
85+
.PHONY: clean-test
86+
clean-test: ## Clean test artifacts
87+
@echo "🚀 Removing test artifacts"
88+
@uv run python -c "import shutil; import os; [shutil.rmtree(d, ignore_errors=True) for d in '$(TEST_DIRS)'.split() if os.path.isdir(d)]"
89+
@uv run python -c "from pathlib import Path; [Path(f).unlink(missing_ok=True) for f in '$(TEST_FILES)'.split()]"
90+
91+
.PHONY: clean
92+
clean: clean-build clean-docs clean-mypy clean-pycache clean-ruff clean-test ## Clean all artifacts
93+
@echo "🚀 Cleaned all artifacts"
94+
95+
.PHONY: help
96+
help:
97+
@uv run python -c "import re; \
98+
[[print(f'\033[36m{m[0]:<20}\033[0m {m[1]}') for m in re.findall(r'^([a-zA-Z_-]+):.*?## (.*)$$', open(makefile).read(), re.M)] for makefile in ('$(MAKEFILE_LIST)').strip().split()]"
99+
100+
.DEFAULT_GOAL := help

PROJECTS.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Shells:
3737
- `athenacli <https://github.com/dbcli/athenacli>`_: A CLI for AWS Athena.
3838
- `vulcano <https://github.com/dgarana/vulcano>`_: A framework for creating command-line applications that also runs in REPL mode.
3939
- `kafka-shell <https://github.com/devshawn/kafka-shell>`_: A supercharged shell for Apache Kafka.
40-
- `starterTree <https://github.com/thomas10-10/starterTree>`_: A command launcher organized in a tree structure with fuzzy autocompletion
40+
- `starterTree <https://github.com/thomas10-10/starterTree>`_: A command launcher organized in a tree structure with fuzzy autocompletion
4141
- `git-delete-merged-branches <https://github.com/hartwork/git-delete-merged-branches>`_: Command-line tool to delete merged Git branches
4242
- `radian <https://github.com/randy3k/radian>`_: A 21 century R console
4343

README.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,3 @@ Special thanks to
141141

142142
.. |Codecov| image:: https://codecov.io/gh/prompt-toolkit/python-prompt-toolkit/branch/master/graphs/badge.svg?style=flat
143143
:target: https://codecov.io/gh/prompt-toolkit/python-prompt-toolkit/
144-

0 commit comments

Comments
 (0)