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
Empty file added .env.example
Empty file.
51 changes: 51 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: ci

on:
push:
branches:
- main
pull_request:
branches:
- main

permissions:
contents: read

jobs:
quality:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7.0.0
# - name: Setup python
# uses: actions/setup-python@7
# with:
# python-version-file: ".python-version"
- name: Setup uv
uses: astral-sh/setup-uv@v10.0.0
with:
version-file: "pyproject.toml"

- name: Install dependencies
run: uv sync --locked

- name: Lint
run: uv run ruff check .

- name: Check formatting
run: uv run ruff format --check .

- name: Type check
run: uv run mypy src tests

- name: Test
run: |
uv run pytest
exit_code=$?

if [ "$exit_code" -eq 5 ]; then
echo "No tests collected — continuing."
exit 0
fi

exit "$exit_code"
53 changes: 27 additions & 26 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
Expand Down Expand Up @@ -128,24 +128,24 @@ ipython_config.py
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid
# celerybeat-schedule
# celerybeat.pid

# Redis
*.rdb
*.aof
*.pid
# *.rdb
# *.aof
# *.pid

# RabbitMQ
mnesia/
rabbitmq/
rabbitmq-data/
# mnesia/
# rabbitmq/
# rabbitmq-data/

# ActiveMQ
activemq-data/
# activemq-data/

# SageMath parsed files
*.sage.py
# *.sage.py

# Environments
.env
Expand All @@ -158,29 +158,38 @@ env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject
# .spyderproject
# .spyproject

# Rope project settings
.ropeproject
# .ropeproject

# mkdocs documentation
/site
# /site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
# .pyre/

# pytype static type analyzer
.pytype/
# .pytype/

# Cython debug symbols
cython_debug/

# Visual Studio Code
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
# and can be added to the global gitignore or merged into this file. However, if you prefer,
# you could uncomment the following to ignore the entire vscode folder
.vscode/
# Temporary file for partial code execution
tempCodeRunnerFile.py

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
Expand All @@ -192,16 +201,8 @@ cython_debug/
# Abstra is an AI-powered process automation framework.
# Ignore directories containing user credentials, local state, and settings.
# Learn more at https://abstra.io/docs
.abstra/
# .abstra/

# Visual Studio Code
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
# and can be added to the global gitignore or merged into this file. However, if you prefer,
# you could uncomment the following to ignore the entire vscode folder
# .vscode/
# Temporary file for partial code execution
tempCodeRunnerFile.py

# Ruff stuff:
.ruff_cache/
Expand Down
43 changes: 43 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
repos:
# General checking
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: check-yaml
- id: check-toml
- id: check-added-large-files

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.16.7
hooks:
- id: ruff-check # Run the linter
args: [--fix]
- id: ruff-format # Run the formatter

- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.12.13
hooks:
- id: uv-lock # Make sure uv.lock is up to date
- id: uv-export # Sync requirements.txt with uv.lock

# - repo: local
# hooks:
# # Run pytest
# - id: pytest
# name: pytest
# entry: uv run pytest tests
# language: system
# types: [python]
# args: [-v]
# pass_filenames: false
# always_run: true

- repo: local
hooks:
- id: mypy
name: mypy
entry: uv run mypy src tests
language: system
types: [python]
pass_filenames: false
72 changes: 72 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,74 @@
# python-template
A boilerplate for fresh Python projects containing the most necessary parts.

## Requirements
- Python 3.14+
- uv

## Setup
```bash
uv sync
uv run pre-commit install
cp .env.example .env

```

Update in pyproject.toml:
- [project.scripts]

app = "project_name.main:main"

- [project]

name = "project-name"

version = "0.1.0"

description = "Short project description"

## Development
Run the application
```bash

uv run python -m project_name.main
```
or
```bash

uv run app

```

Run tests:

```bash
uv run pytest
```

Lint:

```bash
uv run ruff check .
```

Format:

```bash
uv run ruff format .
```

Type check:

```bash
uv run mypy src tests
```

Run all pre-commit checks:

```bash
uv run pre-commit run --all-files
```

## License

MIT
55 changes: 55 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Project meta-data
[project]
name = "project-name"
version = "0.1.0"
description = "Short project description"
readme = "README.md"
requires-python = ">=3.14"
dependencies = []

[project.scripts]
app = "project_name.main:main"

# Dependencies for development
[dependency-groups]
dev = [
"mypy",
"pre-commit",
"pytest",
"pytest-asyncio",
"ruff",
]

# System and module used for building
[build-system]
requires = ["uv_build>=0.12.13,<0.13"]
build-backend = "uv_build"

# Mypy
[tool.mypy]
python_version = "3.14"
strict = true
warn_unreachable = true
pretty = true
files = ["src", "tests"]

# Ruff used for linting and formatting
[tool.ruff]
target-version = "py314"
line-length = 88

[tool.ruff.lint]
extend-select = [
"B", # flake8-bugbear,
"I" # Isort
]
ignore = ["E501"] # Don't enforce line-length violations

unfixable = ["B"]

[tool.ruff.format]
quote-style = "double"
indent-style = "space"

[tool.uv]
required-version = ">=0.12.13"
Loading