diff --git a/.bandit.yaml b/.bandit.yaml deleted file mode 100644 index 0cb74af71d..0000000000 --- a/.bandit.yaml +++ /dev/null @@ -1,2 +0,0 @@ -skips: - - B101 # Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. diff --git a/.github/renovate.json5 b/.github/renovate.json5 index fa99e3f7e9..ecb22e42fa 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -17,7 +17,7 @@ automerge: true, }, 'pre-commit': { enabled: true }, - regexManagers: [ + customManagers: [ /** Do update on the schema present in the ci/config.yaml */ { fileMatch: ['^ci/config\\.yaml$'], @@ -25,11 +25,13 @@ '.*https://raw\\.githubusercontent\\.com/(?[^\\s]+)/(?[0-9\\.]+)/.*', ], datasourceTemplate: 'github-tags', + customType: 'regex', }, /** Do updates on pre-commit additional dependencies */ { fileMatch: ['^\\.pre\\-commit\\-config\\.yaml$'], matchStrings: [" +- '?(?[^' @=]+)(@|==)(?[^' @=]+)'? # (?.+)"], + customType: 'regex', }, /** Python version in actions/setup-python action */ { @@ -37,6 +39,7 @@ matchStrings: [' python-version: [\'"](?[0-9\\.]+)[\'"]'], datasourceTemplate: 'python-version', depNameTemplate: 'python', + customType: 'regex', }, ], packageRules: [ @@ -64,10 +67,10 @@ }, /** Group Poetry packages */ { - matchPackagePrefixes: ['poetry-'], groupName: 'Poetry', automerge: true, matchDepNames: ['poetry', 'pip'], + matchPackageNames: ['/^poetry\\-.*/'], }, /** Support the 4 parts of shellcheck-py version with a v prefix */ { diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index a4630e80ed..62e00bd47d 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -47,7 +47,7 @@ jobs: key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} restore-keys: "pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}\npre-commit-" - run: pre-commit run --all-files - - run: git diff --exit-code --patch > /tmp/pre-commit.patch || true + - run: git diff --exit-code --patch > /tmp/pre-commit.patch || true && git reset --hard if: failure() - run: git diff --patch > /tmp/pre-commit.patch || true if: failure() @@ -78,9 +78,11 @@ jobs: if: always() - name: Publish - run: c2cciutils-publish + run: tag-publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} if: env.HAS_SECRETS == 'HAS_SECRETS' - - run: git diff --exit-code --patch > /tmp/dpkg-versions.patch || true + - run: git diff --exit-code --patch > /tmp/dpkg-versions.patch || true && git reset --hard if: failure() - uses: actions/upload-artifact@v4 with: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3c77b7fc68..5b3e83294f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -100,6 +100,7 @@ repos: additional_dependencies: - prospector-profile-duplicated==1.6.0 # pypi - prospector-profile-utils==1.11.1 # pypi + - ruff==0.7.3 # pypi - repo: https://github.com/camptocamp/jsonschema-gentypes rev: 2.8.1 hooks: @@ -201,3 +202,11 @@ repos: rev: 38.142.2 hooks: - id: renovate-config-validator + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.7.2 + hooks: + - id: ruff-format + - repo: https://github.com/sbrunner/python-versions-hook + rev: 0.7.0 + hooks: + - id: python-versions diff --git a/.prospector.yaml b/.prospector.yaml index 3663026ad8..6f9e2b8a5f 100644 --- a/.prospector.yaml +++ b/.prospector.yaml @@ -3,13 +3,17 @@ inherits: - utils:base - utils:fix - utils:no-design-checks - -doc-warnings: true + - utils:unsafe + - utils:c2cwsgiutils ignore-paths: - github_app_geo_project/project_configuration.py - github_app_geo_project/application_configuration.py -bandit: +mypy: + options: + python-version: '3.10' + +ruff: options: - config: .bandit.yaml + target-version: py310 diff --git a/docker-compose.override.sample.yaml b/docker-compose.override.sample.yaml index ee28a2d419..63751780a0 100644 --- a/docker-compose.override.sample.yaml +++ b/docker-compose.override.sample.yaml @@ -1,7 +1,5 @@ -version: '2.2' - services: - application: &app + application: command: - pserve - --reload diff --git a/docker-compose.yaml b/docker-compose.yaml index a7a31d374c..24b7d27317 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,5 +1,3 @@ -version: '2.2' - services: db: image: camptocamp/postgres:17-postgis-3 diff --git a/jsonschema-gentypes.yaml b/jsonschema-gentypes.yaml index 69c90b398b..b4a293b44b 100644 --- a/jsonschema-gentypes.yaml +++ b/jsonschema-gentypes.yaml @@ -1,3 +1,5 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/sbrunner/jsonschema-gentypes/1.8.1/jsonschema_gentypes/schema.json + headers: | """ Automatically generated file from a JSON schema. diff --git a/pyproject.toml b/pyproject.toml index b3598fbcfe..2b1ec6b29d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,19 +1,3 @@ -[tool.black] -line-length = 110 -target-version = ["py310"] - -[tool.isort] -profile = "black" -line_length = 110 -known_first_party = "github_app_geo_project" - -[tool.mypy] -python_version = "3.11" -warn_redundant_casts = true -warn_unused_ignores = true -ignore_missing_imports = true -strict = true - [tool.poetry] name = "github-app-geo-project" version = "0.0.0" @@ -26,13 +10,17 @@ keywords = ["github", "application", "pyramid"] packages = [{ include = "github_app_geo_project" }] include = ["github_app_geo_project/py.typed"] classifiers = [ - "Development Status :: 4 - Beta", - "Environment :: Web Environment", - "Operating System :: OS Independent", - "Programming Language :: Python", - "Intended Audience :: Developers", - "License :: OSI Approved :: BSD License", - "Typing :: Typed", + 'Development Status :: 4 - Beta', + 'Environment :: Web Environment', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: BSD License', + 'Operating System :: OS Independent', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', + 'Typing :: Typed', ] [tool.poetry.scripts] @@ -96,6 +84,13 @@ types-markdown = "3.7.0.20240822" types-requests = "2.32.0.20241016" types-toml = "0.10.8.20240310" +[tool.ruff] +target-version = "py310" +line-length = 110 + +[tool.ruff.lint.pydocstyle] +convention = "numpy" + [build-system] requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning", "poetry-plugin-tweak-dependencies-version", "poetry-plugin-drop-python-upper-constraint", "poetry-plugin-export"] build-backend = "poetry.core.masonry.api"