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
4 changes: 2 additions & 2 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Changes here will be overwritten by Copier
_commit: 9c45cb7
_commit: b3a2452
_src_path: [email protected]:inokufu/python-project-template.git
author_email: [email protected]
author_name: Inokufu
min_python_version: '3.13'
min_python_version: '3.14'
package_name: logger
project_description: Python logger
project_name: Logger
37 changes: 14 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Rye
id: setup-rye
uses: eifinger/setup-rye@v4
- name: Install uv
id: setup-uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Python
run: uv python install

- name: Install dependencies
if: steps.setup-rye.outputs.cache-hit != 'true'
run: make install

- name: Cache pre-commit
Expand All @@ -38,37 +39,24 @@ jobs:
- name: Run pre-commit checks
run: make precommit

- name: Lint
run: make lint

- name: Lint GitHub Actions
uses: eifinger/actionlint-action@v1

test:
name: Test Python
needs: lint
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.13"] # Add additional versions as needed
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Rye
id: setup-rye
uses: eifinger/setup-rye@v4
- name: Install uv
id: setup-uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-prefix: ${{ matrix.python-version }}
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Pin Python ${{ matrix.python-version }}
run: rye pin ${{ matrix.python-version }}

- name: Install dependencies
if: steps.setup-rye.outputs.cache-hit != 'true'
run: make install

- name: Run tests with coverage
Expand All @@ -77,16 +65,19 @@ jobs:
- name: Upload coverage report as artifact
uses: actions/upload-artifact@v4
with:
name: coverage-report-${{ matrix.python-version }}
name: coverage-report
retention-days: 7
path: |
htmlcov/
coverage.xml
retention-days: 7

greeting:
name: Greet first-time contributors
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || github.event_name == 'issues'
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/first-interaction@v1
with:
Expand Down
44 changes: 29 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: check-added-large-files
- id: check-builtin-literals
Expand All @@ -22,7 +22,7 @@ repos:
- id: name-tests-test

- repo: https://github.com/asottile/pyupgrade
rev: v3.20.0
rev: v3.21.2
hooks:
- id: pyupgrade
args: [ --py312-plus ]
Expand All @@ -34,12 +34,15 @@ repos:
additional_dependencies:
- tomli

- repo: https://github.com/Lucas-C/pre-commit-hooks-safety
rev: v1.4.0
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.9.22
hooks:
- id: python-safety-dependencies-check
args: [ --disable-optional-telemetry ]
files: requirements.lock
- id: uv-lock

- repo: https://github.com/owenlamont/uv-secure
rev: 0.15.4
hooks:
- id: uv-secure

- repo: https://github.com/mrtazz/checkmake.git
rev: 0.2.2
Expand All @@ -48,18 +51,29 @@ repos:

- repo: local
hooks:
- id: rye-fmt
name: rye fmt
description: "Run 'rye fmt' for Python formatting"
entry: rye fmt
- id: uv-fmt
name: uv run ruff format
description: "Run Python formatting"
entry: uv run ruff format
language: python
types_or: [ python, pyi, jupyter ]
require_serial: true
pass_filenames: false

- id: uv-lint
name: uv run ruff check
description: "Run Python linting"
entry: uv run ruff check
language: python
types_or: [ python, pyi, jupyter ]
require_serial: true
pass_filenames: false

- id: rye-lint
name: rye lint
description: "Run 'rye lint' for Python linting"
entry: rye lint
- id: ty-check
name: uv run ty check
description: "Run Ty Type checker"
entry: uv run ty check
language: python
types_or: [ python, pyi, jupyter ]
require_serial: true
pass_filenames: false
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.13
3.14
66 changes: 35 additions & 31 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,71 +1,75 @@
.DEFAULT_GOAL := help

# Check if Rye is installed
RYE_COMMAND := $(shell command -v rye 2> /dev/null)
# Check if uv is installed
UV_COMMAND := $(shell command -v uv 2> /dev/null)

.PHONY: help
help: ## Display this help message
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'

.PHONY: all
all: check-rye install format lint check ## Build everything
all: check-uv install format lint check ## Build everything

.PHONY: check-rye
check-rye: ## Check if Rye is installed
ifndef RYE_COMMAND
$(error "Rye is not installed. Please visit https://rye.astral.sh for installation instructions.")
.PHONY: check-uv
check-uv: ## Check if uv is installed
ifndef UV_COMMAND
$(error "uv is not installed. Please visit https://docs.astral.sh/uv for installation instructions.")
endif

.PHONY: install
install: check-rye pyproject.toml ## Synchronize dependencies
rye sync
install: check-uv pyproject.toml ## Synchronize dependencies
uv sync

.PHONY: init
init: check-rye pyproject.toml .pre-commit-config.yaml install ## Initialize project (first installation)
rye run pre-commit install
init: check-uv pyproject.toml .pre-commit-config.yaml install ## Initialize project (first installation)
uv run -- pre-commit install
cp .env.example .env || true

.PHONY: format
format: check-rye ## Format code
-rye fmt
rye lint --fix
format: check-uv ## Format code
-uv run -- ruff format
uv run -- ruff check --fix

.PHONY: lint
lint: check-rye ## Run linting checks
rye lint
lint: check-uv ## Run linting checks
uv run -- ruff check

.PHONY: typecheck
typecheck: check-uv ## Run type checking with ty
uv run -- ty check

.PHONY: test
test: check-rye tests ## Run tests with coverage
rye test
test: check-uv tests ## Run tests with coverage
uv run -- pytest

.PHONY: diff-cover
diff-cover: check-rye test coverage.xml ## Show code coverage for recent changes
rye run diff-cover coverage.xml
diff-cover: check-uv test coverage.xml ## Show code coverage for recent changes
uv run -- diff-cover coverage.xml

.PHONY: precommit
precommit: check-rye install ## Run pre-commit on all files
rye run pre-commit run --all-files
precommit: check-uv install ## Run pre-commit on all files
uv run -- pre-commit run --all-files

.PHONY: check
check: check-rye install ## Run all checks (precommit + test)
check: check-uv install ## Run all checks (precommit + test)
make precommit
make test

.PHONY: build
build: check-rye install ## Build package
rye build
build: check-uv install ## Build package
uv build

.PHONY: docs
docs: check-rye install ## Build documentation
rye run mkdocs build
docs: check-uv install ## Build documentation
uv run -- mkdocs build

.PHONY: docs-serve
docs-serve: check-rye install ## Serve documentation locally
rye run mkdocs serve
docs-serve: check-uv install ## Serve documentation locally
uv run -- mkdocs serve

.PHONY: docs-deploy
docs-deploy: check-rye install ## Deploy documentation to GitHub Pages
rye run mkdocs gh-deploy
docs-deploy: check-uv install ## Deploy documentation to GitHub Pages
uv run -- mkdocs gh-deploy

.PHONY: gitignore
gitignore: ## Generate .gitignore file for this project
Expand Down
22 changes: 15 additions & 7 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.3.0] - 2026-01-06

### Changed

- Python version to 3.14
- Migrated from Rye to uv
- Type checking with ty

## [0.2.0] - 2025-07-17

### Changed

- Python version to 3.13
- Upgrade dependencies

## [0.1.0] - 2025-03-20

### Added
Expand All @@ -17,10 +32,3 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Comprehensive test suite for all components
- Support for structured logging with context information
- Exception logging with type and message extraction

## [0.2.0] - 2025-07-17

### Changed

- Python version to 3.13
- Upgrade dependencies
4 changes: 3 additions & 1 deletion docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ the [Code of Conduct](CODE_OF_CONDUCT.md).
### Prerequisites

- Python 3.13 or higher
- [Rye](https://rye.astral.sh) for dependency management
- [uv](https://docs.astral.sh/uv/) for dependency management
- Git for version control

### Editor Configuration
Expand All @@ -34,6 +34,7 @@ This project uses pre-commit to enforce code quality checks before each commit.

### Pre-commit hooks installed
- Code formatting with Ruff
- Type checking with Ty
- Python syntax checking
- Security vulnerability scanning
- Trailing whitespace removal
Expand Down Expand Up @@ -132,6 +133,7 @@ make help
This project follows these conventions:

- Code formatting with [ruff](https://docs.astral.sh/ruff/)
- Type checking with [ty](https://docs.astral.sh/ty/)
- Type annotations for all functions
- Documentation
using [Google style docstrings](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html)
Expand Down
7 changes: 4 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
[![GitHub Actions](https://img.shields.io/badge/GitHub_Actions-E6F0FF?logo=githubactions)](https://github.com/features/actions)
[![Pytest](https://img.shields.io/badge/pytest-E6F7FF?logo=pytest)](https://docs.pytest.org/)
[![EditorConfig](https://img.shields.io/badge/EditorConfig-333333?logo=editorconfig)](https://editorconfig.org/)
[![Rye](https://img.shields.io/badge/Rye-000000?logo=rye)](https://rye.astral.sh/)
[![uv](https://img.shields.io/badge/uv-261230?logo=astral)](https://docs.astral.sh/uv/)
[![Ruff](https://img.shields.io/badge/Ruff-3A3A3A?logo=ruff)](https://docs.astral.sh/ruff/)
[![ty](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ty/main/assets/badge/v0.json)](https://github.com/astral-sh/ty)
[![Pre-commit](https://img.shields.io/badge/pre--commit-40332E?logo=pre-commit)](https://pre-commit.com/)
[![Makefile](https://img.shields.io/badge/Makefile-427819?logo=gnu)](https://www.gnu.org/software/make/manual/make.html)
[![MkDocs](https://img.shields.io/badge/MkDocs-526CFE?logo=markdown)](https://www.mkdocs.org/)
Expand All @@ -31,8 +32,8 @@ Key features:

### Prerequisites

- Python 3.13 or higher
- [Rye](https://rye.astral.sh) for dependency management
- Python 3.14 or higher
- [uv](https://docs.astral.sh/uv/) for dependency management

### Installation

Expand Down
Loading