Skip to content

Commit dd926f9

Browse files
Switching to ruff and mkdocs.
1 parent 1d44790 commit dd926f9

File tree

115 files changed

+4129
-4742
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+4129
-4742
lines changed

.coverage 2

-52 KB
Binary file not shown.

.devcontainer/devcontainer.json

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/python
3+
{
4+
"name": "opensourceleg",
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",
7+
"features": {
8+
"ghcr.io/devcontainers-contrib/features/poetry:2": {}
9+
},
10+
11+
// Use 'postCreateCommand' to run commands after the container is created.
12+
"postCreateCommand": "./.devcontainer/postCreateCommand.sh",
13+
14+
// Configure tool-specific properties.
15+
"customizations": {
16+
"vscode": {
17+
"extensions": ["ms-python.python", "editorconfig.editorconfig"],
18+
"settings": {
19+
"python.testing.pytestArgs": ["tests"],
20+
"python.testing.unittestEnabled": false,
21+
"python.testing.pytestEnabled": true,
22+
"python.defaultInterpreterPath": "/workspaces/opensourceleg/.venv/bin/python",
23+
"python.testing.pytestPath": "/workspaces/opensourceleg/.venv/bin/pytest"
24+
}
25+
}
26+
}
27+
}

.devcontainer/postCreateCommand.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#! /usr/bin/env bash
2+
3+
# Install Dependencies
4+
poetry install --with dev
5+
6+
# Install pre-commit hooks
7+
poetry run pre-commit install --install-hooks

.editorconfig

+4-21
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,5 @@
1-
# Check http://editorconfig.org for more information
2-
# This is the main config file for this project:
3-
root = true
1+
max_line_length = 120
42

5-
[*]
6-
charset = utf-8
7-
end_of_line = lf
8-
insert_final_newline = true
9-
indent_style = tab
10-
trim_trailing_whitespace = true
11-
12-
[*.{py, pyi}]
13-
indent_style = tab
14-
15-
[Makefile]
16-
indent_style = tab
17-
18-
[*.md]
19-
trim_trailing_whitespace = false
20-
21-
[*.{diff,patch}]
22-
trim_trailing_whitespace = false
3+
[*.json]
4+
indent_style = space
5+
indent_size = 4

.github/ISSUE_TEMPLATE/bug_report.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: 🐛 Bug report
33
about: If something isn't working 🔧
4-
title: ''
4+
title: ""
55
labels: bug
66
assignees:
77
---
@@ -22,8 +22,8 @@ Steps to reproduce the behavior:
2222

2323
### Environment
2424

25-
* OS: [e.g. Linux / Windows / macOS]
26-
* Python version, get it with:
25+
- OS: [e.g. Linux / Windows / macOS]
26+
- Python version, get it with:
2727

2828
```bash
2929
python --version

.github/ISSUE_TEMPLATE/feature_request.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: 🚀 Feature request
33
about: Suggest an idea for this project 🏖
4-
title: ''
4+
title: ""
55
labels: enhancement
66
assignees:
77
---

.github/ISSUE_TEMPLATE/question.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: ❓ Question
33
about: Ask a question about this project 🎓
4-
title: ''
4+
title: ""
55
labels: question
66
assignees:
77
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: "setup-poetry-env"
2+
description: "Composite action to setup the Python and poetry environment."
3+
4+
inputs:
5+
python-version:
6+
required: false
7+
description: "The python version to use"
8+
default: "3.11"
9+
10+
runs:
11+
using: "composite"
12+
steps:
13+
- name: Set up python
14+
uses: actions/setup-python@v5
15+
with:
16+
python-version: ${{ inputs.python-version }}
17+
18+
- name: Install Poetry
19+
env:
20+
POETRY_VERSION: "1.7.1"
21+
run: curl -sSL https://install.python-poetry.org | python - -y
22+
shell: bash
23+
24+
- name: Add Poetry to Path
25+
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
26+
shell: bash
27+
28+
- name: Configure Poetry virtual environment in project
29+
run: poetry config virtualenvs.in-project true
30+
shell: bash
31+
32+
- name: Load cached venv
33+
id: cached-poetry-dependencies
34+
uses: actions/cache@v4
35+
with:
36+
path: .venv
37+
key: venv-${{ runner.os }}-${{ inputs.python-version }}-${{ hashFiles('poetry.lock') }}
38+
39+
- name: Install dependencies
40+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
41+
run: poetry install --no-interaction
42+
shell: bash

.github/release-drafter.yml

-28
This file was deleted.

.github/workflows/build.yml

-46
This file was deleted.

.github/workflows/greetings.yml

-16
This file was deleted.

.github/workflows/main.yml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Main
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [opened, synchronize, reopened, ready_for_review]
9+
10+
jobs:
11+
quality:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check out
15+
uses: actions/checkout@v4
16+
17+
- uses: actions/cache@v4
18+
with:
19+
path: ~/.cache/pre-commit
20+
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
21+
22+
- name: Set up the environment
23+
uses: ./.github/actions/setup-poetry-env
24+
25+
- name: Run checks
26+
run: make check
27+
28+
tests-and-type-check:
29+
runs-on: ubuntu-latest
30+
strategy:
31+
matrix:
32+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
33+
fail-fast: false
34+
defaults:
35+
run:
36+
shell: bash
37+
steps:
38+
- name: Check out
39+
uses: actions/checkout@v4
40+
41+
- name: Set up the environment
42+
uses: ./.github/actions/setup-poetry-env
43+
with:
44+
python-version: ${{ matrix.python-version }}
45+
46+
- name: Run tests
47+
run: poetry run pytest tests --cov --cov-config=pyproject.toml --cov-report=xml
48+
49+
- name: Check typing
50+
run: poetry run mypy
51+
52+
- name: Upload coverage reports to Codecov with GitHub Action on Python 3.11
53+
uses: codecov/codecov-action@v4
54+
if: ${{ matrix.python-version == '3.11' }}
55+
56+
check-docs:
57+
runs-on: ubuntu-latest
58+
steps:
59+
- name: Check out
60+
uses: actions/checkout@v4
61+
62+
- name: Set up the environment
63+
uses: ./.github/actions/setup-poetry-env
64+
65+
- name: Check if documentation can be built
66+
run: poetry run mkdocs build -s

.github/workflows/on-release-main.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: release-main
2+
3+
on:
4+
release:
5+
types: [published]
6+
branches: [main]
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check out
13+
uses: actions/checkout@v4
14+
15+
- name: Set up the environment
16+
uses: ./.github/actions/setup-poetry-env
17+
18+
- name: Export tag
19+
id: vars
20+
run: echo tag=${GITHUB_REF#refs/*/} >> $GITHUB_OUTPUT
21+
22+
- name: Build and publish
23+
run: |
24+
source .venv/bin/activate
25+
poetry version $RELEASE_VERSION
26+
make build-and-publish
27+
env:
28+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
29+
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
30+
deploy-docs:
31+
needs: publish
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Check out
35+
uses: actions/checkout@v4
36+
37+
- name: Set up the environment
38+
uses: ./.github/actions/setup-poetry-env
39+
40+
- name: Deploy documentation
41+
run: poetry run mkdocs gh-deploy --force

.github/workflows/release-drafter.yml

-16
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: validate-codecov-config
2+
3+
on:
4+
pull_request:
5+
paths: [codecov.yaml]
6+
push:
7+
branches: [main]
8+
9+
jobs:
10+
validate-codecov-config:
11+
runs-on: ubuntu-22.04
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Validate codecov configuration
15+
run: curl -sSL --fail-with-body --data-binary @codecov.yaml https://codecov.io/validate

0 commit comments

Comments
 (0)