Skip to content

Commit 123088e

Browse files
Relaunched project
1 parent fe11a67 commit 123088e

16 files changed

Lines changed: 1656 additions & 2 deletions

.github/workflows/ci.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
schedule:
9+
- cron: "0 6 * * 1" # Every Monday at 06:00 UTC
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
test:
16+
name: Test (Python ${{ matrix.python-version }})
17+
runs-on: ubuntu-latest
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Set up Python ${{ matrix.python-version }}
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
allow-prereleases: true
31+
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install -e ".[test]"
36+
37+
- name: Run tests with coverage
38+
run: >
39+
python -m pytest tests/ -v --tb=short
40+
--cov --cov-report=term-missing --cov-report=xml
41+
42+
- name: Upload coverage to Codecov
43+
if: matrix.python-version == '3.12'
44+
uses: codecov/codecov-action@v4
45+
with:
46+
files: coverage.xml
47+
fail_ci_if_error: false

.github/workflows/lint.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
ruff:
14+
name: Ruff
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.12"
23+
24+
- name: Install Ruff
25+
run: pip install ruff
26+
27+
- name: Ruff check
28+
run: ruff check .
29+
30+
- name: Ruff format check
31+
run: ruff format --check .
32+
33+
pre-commit:
34+
name: Pre-commit hooks
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v4
38+
39+
- name: Set up Python
40+
uses: actions/setup-python@v5
41+
with:
42+
python-version: "3.12"
43+
44+
- name: Install system dependencies for local hooks
45+
run: pip install ty
46+
47+
- uses: pre-commit/action@v3.0.1

.github/workflows/publish.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
publish:
12+
name: Build & Publish
13+
runs-on: ubuntu-latest
14+
environment: pypi
15+
permissions:
16+
id-token: write
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: "3.12"
25+
26+
- name: Install build tools
27+
run: pip install build
28+
29+
- name: Build package
30+
run: python -m build
31+
32+
- name: Publish to PyPI
33+
uses: pypa/gh-action-pypi-publish@release/v1

.pre-commit-config.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v6.0.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
- id: debug-statements
9+
- id: requirements-txt-fixer
10+
- id: detect-private-key
11+
- repo: https://github.com/asottile/setup-cfg-fmt
12+
rev: v3.2.0
13+
hooks:
14+
- id: setup-cfg-fmt
15+
- repo: https://github.com/asottile/add-trailing-comma
16+
rev: v4.0.0
17+
hooks:
18+
- id: add-trailing-comma
19+
- repo: https://github.com/asottile/pyupgrade
20+
rev: v3.21.2
21+
hooks:
22+
- id: pyupgrade
23+
args: [--py310-plus]
24+
25+
- repo: https://github.com/PyCQA/isort
26+
rev: 8.0.1
27+
hooks:
28+
- id: isort
29+
args: [ "--line-length", "78", "--profile", "black" ]
30+
31+
- repo: https://github.com/astral-sh/ruff-pre-commit
32+
# Ruff version.
33+
rev: v0.15.5
34+
hooks:
35+
# Run the linter.
36+
- id: ruff-check
37+
args: [ --fix ]
38+
# Run the formatter.
39+
- id: ruff-format
40+
41+
- repo: local
42+
hooks:
43+
- id: ty
44+
name: ty type check
45+
entry: ty check
46+
language: system
47+
types: [python]
48+
pass_filenames: false

.pre-commit-hooks.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- id: content-tree-generator
2+
name: Content Tree Generator
3+
entry: content-tree-generator
4+
language: python
5+
files: \.py$
6+
pass_filenames: false

CONTRIBUTING.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Contributing
2+
3+
Thanks for your interest in contributing! This guide will help you get
4+
started.
5+
6+
## Development Setup
7+
8+
1. **Clone the repository**
9+
10+
```bash
11+
git clone https://github.com/Wandersalamander/python-content-tree-generator.git
12+
cd python-content-tree-generator
13+
```
14+
15+
2. **Create a virtual environment**
16+
17+
```bash
18+
python -m venv .venv
19+
source .venv/bin/activate # Linux / macOS
20+
.venv\Scripts\activate # Windows
21+
```
22+
23+
3. **Install in editable mode with dev and test extras**
24+
25+
```bash
26+
pip install -e ".[dev,test]"
27+
```
28+
29+
4. **Install the pre-commit hooks**
30+
31+
```bash
32+
pre-commit install
33+
```
34+
35+
## Running Tests
36+
37+
```bash
38+
pytest
39+
```
40+
41+
With coverage:
42+
43+
```bash
44+
pytest --cov --cov-report=term-missing
45+
```
46+
47+
## Code Standards
48+
49+
- **Formatting & linting** are handled by [Ruff](https://github.com/astral-sh/ruff).
50+
- **Type checking** is done with [ty](https://github.com/astral-sh/ty).
51+
- **Pre-commit hooks** run automatically on every commit. You can also run
52+
them manually:
53+
54+
```bash
55+
pre-commit run --all-files
56+
```
57+
58+
- All code must include type annotations and pass the type checker.
59+
- Aim for clear, single-responsibility functions with docstrings.
60+
61+
## Submitting Changes
62+
63+
1. Fork the repository and create a feature branch from `main`.
64+
2. Make your changes and add tests where appropriate.
65+
3. Ensure all checks pass (`pre-commit run --all-files && pytest`).
66+
4. Open a pull request with a clear description of the change.
67+
68+
## Reporting Issues
69+
70+
Please use [GitHub Issues](https://github.com/Wandersalamander/python-content-tree-generator/issues)
71+
to report bugs or request features. Include:
72+
73+
- Steps to reproduce (for bugs).
74+
- Expected vs. actual behaviour.
75+
- Python version and OS.

0 commit comments

Comments
 (0)