-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from datarootsio/feature/replace_poetry_with_rye
Feature/replace poetry with rye
- Loading branch information
Showing
12 changed files
with
156 additions
and
504 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Multiple Python Versions CI boilerplate | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
linter_and_test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.10", "3.11", "3.12"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
architecture: 'x64' | ||
- uses: eifinger/setup-rye@v2 | ||
- run: rye sync | ||
- run: rye fmt | ||
- run: rye lint | ||
- run: rye test | ||
- run: rye run mypy src |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,40 @@ | ||
|
||
repos: | ||
- repo: local | ||
- repo: local | ||
hooks: | ||
- id: isort | ||
name: isort | ||
stages: [commit] | ||
types: [python] | ||
entry: poetry run isort . | ||
language: system | ||
pass_filenames: false | ||
always_run: true | ||
- id: black | ||
name: black | ||
stages: [commit] | ||
types: [python] | ||
entry: poetry run black . | ||
language: system | ||
pass_filenames: false | ||
always_run: true | ||
- id: ruff | ||
name: ruff | ||
stages: [commit] | ||
types: [python] | ||
entry: poetry run ruff . | ||
language: system | ||
pass_filenames: false | ||
always_run: true | ||
fail_fast: true | ||
- id: pytest | ||
name: pytest | ||
stages: [commit] | ||
types: [python] | ||
entry: poetry run pytest | ||
language: system | ||
pass_filenames: false | ||
always_run: true | ||
fail_fast: true | ||
- id: rye-lint | ||
name: rye-lint | ||
description: "Lint Python via 'rye lint'" | ||
entry: rye lint --fix | ||
language: system | ||
types_or: [python, pyi] | ||
args: [] | ||
require_serial: true | ||
additional_dependencies: [] | ||
minimum_pre_commit_version: "2.9.2" | ||
- id: rye-format | ||
name: rye-format | ||
description: "Format Python via 'rye fmt'" | ||
entry: rye fmt | ||
language: system | ||
types_or: [python, pyi] | ||
args: [] | ||
require_serial: true | ||
additional_dependencies: [] | ||
minimum_pre_commit_version: "2.9.2" | ||
- id: rye-test | ||
name: rye-test | ||
description: "Test Python via 'rye test'" | ||
entry: rye test | ||
language: system | ||
types_or: [python, pyi] | ||
args: [] | ||
pass_filenames: false | ||
require_serial: true | ||
additional_dependencies: [] | ||
minimum_pre_commit_version: "2.9.2" | ||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: 'v1.10.1' | ||
hooks: | ||
- id: mypy | ||
files: src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.12.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,30 @@ | ||
## Project title | ||
# Minimal Python Boilerplate | ||
|
||
This boilerplate project contains the following setup ready for you to go: | ||
This boilerplate project contains the following setup ready for you to go. | ||
|
||
* package/environment management | ||
* `poetry` | ||
* code validation | ||
* `black` | ||
* `ruff` | ||
* `pytest` | ||
* `rye` | ||
* linting & formatting | ||
* `ruff` (triggered by `rye`) | ||
* testing framework | ||
* `pytest` (triggered by `rye`) | ||
* see `tests` directory | ||
* type checking | ||
* `mypy` | ||
* pre-commit hooks | ||
* GitHub Actions workflow in `.github/workflows` | ||
|
||
# Setup | ||
This boilerplate prefers a [src layout](https://packaging.python.org/en/latest/discussions/src-layout-vs-flat-layout/) over a flat layout. | ||
|
||
## Setup | ||
|
||
1. Clone this repo | ||
2. Make sure to [install Poetry](https://python-poetry.org/docs/#installation) | ||
2. Make sure to [install Rye](https://rye.astral.sh/guide/installation/) | ||
3. In your project directory run | ||
1. `poetry shell` | ||
2. `poetry install` | ||
3. `pre-commit install` | ||
1. `rye sync` | ||
2. `pre-commit install` | ||
3. Optionally run `pre-commit run --all-files` (this will be triggered automatically on each commit) | ||
4. On each `git commit` the code validation packages will be run before the actual commit. | ||
5. Explore the setup in the folder structure of this package. | ||
6. Profit. | ||
5. GitHub Action workflows will be triggered on `push` and `pull_request` events. | ||
6. Explore the setup in the folder structure of this package. | ||
7. Profit. |
Oops, something went wrong.