Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Actions] Auto-Update cookiecutter template #88

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/woltapp/wolt-python-package-cookiecutter",
"commit": "4eecc9c4d27e3c9321438bc1fdaf717bec5eadf6",
"commit": "7cf131315aae15890e44411c9fcecdbb584dca48",
"checkout": null,
"context": {
"cookiecutter": {
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/python-poetry-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ inputs:
python-version:
required: false
description: 'Python version'
default: '3.10'
default: '3.12'
outputs: {}
runs:
using: 'composite'
steps:
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{inputs.python-version}}
- name: Install poetry
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/cookiecutter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ jobs:
auto-update-project:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: "3.12"

- name: Install dependencies
run: python -m pip install cruft poetry jello tabulate
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
auto-update-dependencies:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: ./.github/actions/python-poetry-env

- name: Install tabulate
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/draft_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
draft-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: ./.github/actions/python-poetry-env
- name: Update version
id: updated_version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: ./.github/actions/python-poetry-env
- name: Publish to pypi
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
actionlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Download actionlint
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) 1.6.21
shell: bash
Expand All @@ -22,14 +22,14 @@ jobs:
name: Check if automatic project update was successful
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Fail if .rej files exist as structure update was not successful
run: test -z "$(find . -iname '*.rej')"

pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: ./.github/actions/python-poetry-env
- run: poetry run pre-commit run --all-files

Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/test.yml.rej
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
diff a/.github/workflows/test.yml b/.github/workflows/test.yml (rejected hunks)
@@ -38,10 +38,17 @@ jobs:
strategy:
fail-fast: false
matrix:
- python-version: ["3.7", "3.8", "3.9", "3.10"]
+ python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v4
- uses: ./.github/actions/python-poetry-env
with:
python-version: ${{ matrix.python-version }}
- run: poetry run pytest
+
+ docs:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: ./.github/actions/python-poetry-env
+ - run: poetry run mkdocs build
50 changes: 50 additions & 0 deletions .pre-commit-config.yaml.rej
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
diff a/.pre-commit-config.yaml b/.pre-commit-config.yaml (rejected hunks)
@@ -15,26 +15,19 @@ repos:
- id: mixed-line-ending
- repo: local
hooks:
- - id: autoflake
- name: autoflake
- entry: poetry run autoflake -r -i --remove-all-unused-imports --remove-unused-variables
+ - id: ruff-format
+ name: ruff-format
+ entry: poetry run ruff format
+ require_serial: true
language: system
types: [ python ]
- - id: isort
- name: isort
- entry: poetry run isort
- language: system
- types: [python]
- - id: black
- name: black
- entry: poetry run black
- language: system
- types: [python]
- - id: pyupgrade
- name: pyupgrade
- entry: poetry run pyupgrade --py37-plus
+ - id: ruff
+ name: ruff
+ # Add --fix, in case you want it to autofix when this hook runs
+ entry: poetry run ruff check --force-exclude
+ require_serial: true
language: system
- types: [python]
+ types: [ python ]
- id: mypy
name: mypy
entry: poetry run mypy .
@@ -42,11 +35,6 @@ repos:
language: system
types: [python]
pass_filenames: false
- - id: flake8
- name: flake8
- entry: poetry run flake8
- language: system
- types: [python]
- id: kacl-verify
name: kacl-verify
entry: poetry run kacl-cli verify
9 changes: 9 additions & 0 deletions LICENCE.rej
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
diff a/LICENCE b/LICENCE (rejected hunks)
@@ -1,6 +1,6 @@
The MIT License (MIT)

-Copyright (c) 2021 Jerry Pussinen <[email protected]>
+Copyright (c) 2024 Jerry Pussinen <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ The `least_duration` algorithm walks the list of tests and assigns each test to
* Clone this repository
* Requirements:
* [Poetry](https://python-poetry.org/)
* Python 3.7+
* Python 3.8+
* Create a virtual environment and install the dependencies

```sh
Expand All @@ -117,9 +117,8 @@ pytest

### Documentation

The documentation is automatically generated from the content of the [docs directory](./docs) and from the docstrings
of the public signatures of the source code. The documentation is updated and published as a [Github project page
](https://pages.github.com/) automatically as part each release.
The documentation is automatically generated from the content of the [docs directory](https://github.com/jerry-git/pytest-split/tree/master/docs) and from the docstrings
of the public signatures of the source code. The documentation is updated and published as a [Github Pages page](https://pages.github.com/) automatically as part each release.

### Releasing

Expand Down
10 changes: 10 additions & 0 deletions README.md.rej
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
diff a/README.md b/README.md (rejected hunks)
@@ -66,7 +65,7 @@ Find the draft release from the

### Pre-commit

-Pre-commit hooks run all the auto-formatters (e.g. `black`, `isort`), linters (e.g. `mypy`, `flake8`), and other quality
+Pre-commit hooks run all the auto-formatting (`ruff format`), linters (e.g. `ruff` and `mypy`), and other quality
checks to make sure the changeset is in good shape before a commit/push happens.

You can install the hooks with (runs for each commit):
4 changes: 1 addition & 3 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ plugins:
default_handler: python
handlers:
python:
rendering:
options:
show_signature_annotations: true
show_source: true
show_submodules: true
watch:
- src/pytest_split
13 changes: 12 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 124 additions & 0 deletions pyproject.toml.rej
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
diff a/pyproject.toml b/pyproject.toml (rejected hunks)
@@ -18,9 +18,11 @@ classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
- "Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
+ "Programming Language :: Python :: 3.10",
+ "Programming Language :: Python :: 3.11",
+ "Programming Language :: Python :: 3.12",
"Topic :: Software Development :: Libraries :: Python Modules",
"Typing :: Typed",
]
@@ -30,43 +32,54 @@ packages = [
]

[tool.poetry.dependencies]
-python = ">=3.7.1, <4.0"
-
-[tool.poetry.dev-dependencies]
-autoflake = "*"
-black = "*"
-flake8 = "*"
-flake8-bugbear = "*"
-flake8-builtins = "*"
-flake8-comprehensions = "*"
-flake8-debugger = "*"
-flake8-eradicate = "*"
-flake8-logging-format = "*"
-isort = "*"
-mkdocstrings = {version = ">=0.18", extras = ["python"]}
+python = ">=3.8.1, <4.0"
+
+[tool.poetry.group.dev.dependencies]
+mkdocstrings = {version = ">=0.23", extras = ["python"]}
mkdocs-material = "*"
mypy = "*"
-pep8-naming = "*"
pre-commit = "*"
pymdown-extensions = "*"
pytest = "*"
pytest-github-actions-annotate-failures = "*"
pytest-cov = "*"
python-kacl = "*"
-pyupgrade = "*"
-tryceratops = "*"
+ruff = ">=0.2.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

-[tool.isort]
-profile = "black"
-src_paths = ["src", "tests"]
+[tool.ruff]
+target-version = "py38" # The lowest supported version
+
+[tool.ruff.lint]
+# By default, enable all the lint rules.
+# Add to the ignore list below if you don't want some rules.
+# If you need some ignores for certain modules, see tool.ruff.lint.per-file-ignores below.
+# For individual ignore cases, prefer inline `# noqa`s within the code.
+select = ["ALL"]
+ignore = [
+ "ANN", # Type hints related, let mypy handle these.
+ "D", # Docstrings related, way too strict to our taste
+ ]
+
+[tool.ruff.lint.per-file-ignores]
+"tests/**" = [
+ "S101", # "Use of `assert` detected"
+ "ARG", # "Unused function argument". Fixtures are often unused.
+ "S105", # "Possible hardcoded password".
+]
+
+[tool.ruff.lint.mccabe]
+max-complexity = 10

-[tool.black]
-target-version = ["py37", "py38", "py39"]
-include = '\.pyi?$'
+[tool.ruff.lint.pep8-naming]
+classmethod-decorators = [
+ "classmethod",
+ "pydantic.validator",
+ "pydantic.root_validator",
+]

[tool.pytest.ini_options]
addopts = """\
@@ -84,12 +97,23 @@ exclude_lines = [
]

[tool.mypy]
+# This is the global mypy configuration.
+# Avoid changing this!
+strict = true # See all the enabled flags `mypy --help | grep -A 10 'Strict mode'`
disallow_any_unimported = true
-disallow_untyped_defs = true
-no_implicit_optional = true
-strict_equality = true
-warn_unused_ignores = true
-warn_redundant_casts = true
-warn_return_any = true
-check_untyped_defs = true
-show_error_codes = true
+
+# If you need to ignore something for some specific module,
+# add overrides for them. Avoid changing the global config!
+# For example:
+# [[tool.mypy.overrides]]
+# module = [
+# "my_unpyted_dependency1.*",
+# "my_unpyted_dependency2.*"
+# ]
+# ignore_missing_imports = true
+
+# [[tool.mypy.overrides]]
+# module = [
+# "tests/my_thing/test_my_thing",
+# ]
+# disallow_untyped_defs = false
Loading