Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
13 changes: 7 additions & 6 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: test
on:
push: # any branch
pull_request:
branches: [master]
branches: [main]

env:
FORCE_COLOR: 1
Expand All @@ -14,33 +14,34 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
python-version:
["3.10", "3.11", "3.12", "3.13", "3.14", "3.14t", "3.15-dev"]

steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
- name: Code formatting
if: ${{ matrix.python-version == '3.13' }}
if: ${{ matrix.python-version == '3.14' }}
run: |
uvx ruff check .
uvx ruff format --check .
- name: Typos
if: ${{ matrix.python-version == '3.13' }}
if: ${{ matrix.python-version == '3.14' }}
run: |
uvx typos .
- name: Unit test
run: |
uvx --with . --with pytest coverage run -m pytest tests/
- name: Type Checking
if: ${{ matrix.python-version != '3.8' }}
if: ${{ matrix.python-version != '3.10' }}
run: |
uvx --with . --with asyncssh mypy --strict src/ --platform win32
uvx --with . --with asyncssh mypy --strict src/ --platform linux
uvx --with . --with asyncssh mypy --strict src/ --platform darwin
- name: Validate README.md
if: ${{ matrix.python-version == '3.13' }}
if: ${{ matrix.python-version == '3.14' }}
# Ensure that the README renders correctly (required for uploading to PyPI).
run: |
uv pip install readme_renderer
Expand Down
31 changes: 31 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v6.0.0"
hooks:
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-toml
Comment thread
jonathanslenders marked this conversation as resolved.
- id: check-yaml
Comment thread
jonathanslenders marked this conversation as resolved.
Outdated
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.15.6"
hooks:
- id: ruff-format
args: [--config=pyproject.toml]
- id: ruff-check
args: [--config=pyproject.toml, --fix, --exit-non-zero-on-fix]

- repo: https://github.com/crate-ci/typos
rev: v1.44.0
hooks:
- id: typos
exclude: |
(?x)^(
tests/.*
)$
100 changes: 100 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Simple Makefile for use with a uv-based development environment
# The at (@) prefix tells make to suppress output from the command
# The hyphen (-) prefix tells make to ignore errors (e.g., if a directory doesn't exist)

.PHONY: install
install: ## Install the virtual environment with dependencies
@echo "🚀 Creating uv Python virtual environment"
@uv python install 3.14
@uv sync --python=3.14
@echo "🚀 Installing Git prek hooks locally"
@uv run prek install -f

.PHONY: check
check: ## Run code quality tools.
@echo "🚀 Checking lock file consistency with 'pyproject.toml'"
@uv lock --locked
@echo "🚀 Auto-formatting/Linting code and documentation: Running prek"
@uv run prek run -a
@echo "🚀 Static type checking: Running mypy"
@uv run mypy

.PHONY: format
format: ## Perform ruff formatting
@uv run ruff format

.PHONY: lint
lint: ## Perform ruff linting
@uv run ruff check --fix

.PHONY: typecheck
typecheck: ## Perform type checking
@uv run mypy

.PHONY: test
test: ## Test the code with pytest.
@echo "🚀 Testing code: Running pytest"
@uv run python -Xutf8 -m pytest --cov --cov-config=pyproject.toml --cov-report=xml tests

# TODO Add stuff for building Sphinx docs

.PHONY: build
build: clean-build ## Build wheel file
@echo "🚀 Creating wheel file"
@uv build

.PHONY: tag
Comment thread
tleonhardt marked this conversation as resolved.
Outdated
tag: ## Add a Git tag and push it to origin with syntax: make tag TAG=tag_name
@echo "🚀 Creating git tag: ${TAG}"
@git tag -a ${TAG} -m ""
@echo "🚀 Pushing tag to origin: ${TAG}"
@git push origin ${TAG}

# Define variables for files/directories to clean
BUILD_DIRS = build dist *.egg-info
DOC_DIRS = build
MYPY_DIRS = .mypy_cache dmypy.json dmypy.sock
TEST_DIRS = .cache .pytest_cache htmlcov
TEST_FILES = .coverage coverage.xml

.PHONY: clean-build
clean-build: ## Clean build artifacts
@echo "🚀 Removing build artifacts"
@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)]"

.PHONY: clean-docs
clean-docs: ## Clean documentation artifacts
@echo "🚀 Removing documentation artifacts"
@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)]"

.PHONY: clean-mypy
clean-mypy: ## Clean mypy artifacts
@echo "🚀 Removing mypy artifacts"
@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)]"

.PHONY: clean-pycache
clean-pycache: ## Clean pycache artifacts
@echo "🚀 Removing pycache artifacts"
@-find . -type d -name "__pycache__" -exec rm -r {} +

.PHONY: clean-ruff
clean-ruff: ## Clean ruff artifacts
@echo "🚀 Removing ruff artifacts"
@uv run ruff clean

.PHONY: clean-test
clean-test: ## Clean test artifacts
@echo "🚀 Removing test artifacts"
@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)]"
@uv run python -c "from pathlib import Path; [Path(f).unlink(missing_ok=True) for f in '$(TEST_FILES)'.split()]"

.PHONY: clean
clean: clean-build clean-docs clean-mypy clean-pycache clean-ruff clean-test ## Clean all artifacts
@echo "🚀 Cleaned all artifacts"

.PHONY: help
help:
@uv run python -c "import re; \
[[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()]"

.DEFAULT_GOAL := help
2 changes: 1 addition & 1 deletion PROJECTS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Shells:
- `athenacli <https://github.com/dbcli/athenacli>`_: A CLI for AWS Athena.
- `vulcano <https://github.com/dgarana/vulcano>`_: A framework for creating command-line applications that also runs in REPL mode.
- `kafka-shell <https://github.com/devshawn/kafka-shell>`_: A supercharged shell for Apache Kafka.
- `starterTree <https://github.com/thomas10-10/starterTree>`_: A command launcher organized in a tree structure with fuzzy autocompletion
- `starterTree <https://github.com/thomas10-10/starterTree>`_: A command launcher organized in a tree structure with fuzzy autocompletion
- `git-delete-merged-branches <https://github.com/hartwork/git-delete-merged-branches>`_: Command-line tool to delete merged Git branches
- `radian <https://github.com/randy3k/radian>`_: A 21 century R console

Expand Down
1 change: 0 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,3 @@ Special thanks to

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

Loading