From aa59aa41b044b02b30dbee5ca60a090d7170a48e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 21 Nov 2023 15:07:34 +0000 Subject: [PATCH] Chore: pre-commit autoupdate --- .github/workflows/ci.yml | 6 ++-- .github/workflows/release.yaml | 40 +++++++++++++-------------- .github/workflows/release.yml | 8 +++--- .github/workflows/test-build-push.yml | 22 +++++++-------- .pre-commit-config.yaml | 18 ++++++------ .thoth.yaml | 4 +-- CONTRIBUTING.md | 37 +++++++++++++++---------- docker-compose.yml | 4 +-- 8 files changed, 73 insertions(+), 66 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 36f4bad..ae8b3e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,12 +15,12 @@ jobs: steps: - uses: actions/checkout@v2 - - name: 'Set up Python' + - name: "Set up Python" uses: actions/setup-python@v2 with: - python-version: '3.9' + python-version: "3.9" - - name: 'Install dependencies' + - name: "Install dependencies" run: | python -m pip install --upgrade pip pip install tox diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index af4478f..2578ad5 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,5 +1,5 @@ --- -name: '🐍📦 Production build and release' +name: "🐍📦 Production build and release" # GitHub/PyPI trusted publisher documentation: # https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ @@ -13,13 +13,13 @@ on: - v*.*.* env: - python-version: '3.10' + python-version: "3.10" ### BUILD ### jobs: build: - name: '🐍 Build packages' + name: "🐍 Build packages" runs-on: ubuntu-latest permissions: # IMPORTANT: mandatory for Sigstore @@ -27,31 +27,31 @@ jobs: steps: ### BUILDING ### - - name: 'Checkout repository' + - name: "Checkout repository" uses: actions/checkout@v4 - - name: 'Setup PDM for build commands' + - name: "Setup PDM for build commands" uses: pdm-project/setup-pdm@v3 with: version: 2.10.0 - - name: 'Setup Python 3.10' + - name: "Setup Python 3.10" uses: actions/setup-python@v4.7.0 with: python-version: ${{ env.python-version }} - - name: 'Update version from tags for production release' + - name: "Update version from tags for production release" run: | echo "Github versioning: ${{ github.ref_name }}" scripts/release-versioning.sh - - name: 'Build with PDM backend' + - name: "Build with PDM backend" run: | pdm build ### SIGNING ### - - name: 'Sign packages with Sigstore' + - name: "Sign packages with Sigstore" uses: sigstore/gh-action-sigstore-python@v1.2.3 with: inputs: >- @@ -67,7 +67,7 @@ jobs: ### PUBLISH GITHUB ### github: - name: '📦 Publish to GitHub' + name: "📦 Publish to GitHub" # Only publish on tag pushes if: startsWith(github.ref, 'refs/tags/') needs: @@ -77,13 +77,13 @@ jobs: # IMPORTANT: mandatory to publish artefacts contents: write steps: - - name: '⬇ Download build artefacts' + - name: "⬇ Download build artefacts" uses: actions/download-artifact@v3 with: name: ${{ github.ref_name }} path: dist/ - - name: '📦 Publish release to GitHub' + - name: "📦 Publish release to GitHub" uses: ModeSevenIndustrialSolutions/action-automatic-releases@latest with: # Valid inputs are: @@ -99,7 +99,7 @@ jobs: ### PUBLISH PYPI TEST ### testpypi: - name: '📦 Publish to PyPi Test' + name: "📦 Publish to PyPi Test" # Only publish on tag pushes if: startsWith(github.ref, 'refs/tags/') needs: @@ -111,13 +111,13 @@ jobs: # IMPORTANT: mandatory for trusted publishing id-token: write steps: - - name: '⬇ Download build artefacts' + - name: "⬇ Download build artefacts" uses: actions/download-artifact@v3 with: name: ${{ github.ref_name }} path: dist/ - - name: 'Remove files unsupported by PyPi' + - name: "Remove files unsupported by PyPi" run: | if [ -f dist/buildvars.txt ]; then rm dist/buildvars.txt @@ -133,7 +133,7 @@ jobs: ### PUBLISH PYPI ### pypi: - name: '📦 Publish to PyPi' + name: "📦 Publish to PyPi" # Only publish on tag pushes if: startsWith(github.ref, 'refs/tags/') needs: @@ -145,23 +145,23 @@ jobs: # IMPORTANT: mandatory for trusted publishing id-token: write steps: - - name: '⬇ Download build artefacts' + - name: "⬇ Download build artefacts" uses: actions/download-artifact@v3 with: name: ${{ github.ref_name }} path: dist/ - - name: 'Remove files unsupported by PyPi' + - name: "Remove files unsupported by PyPi" run: | if [ -f dist/buildvars.txt ]; then rm dist/buildvars.txt fi rm dist/*.crt dist/*.sig* - - name: 'Setup PDM for build commands' + - name: "Setup PDM for build commands" uses: pdm-project/setup-pdm@v3 - - name: 'Publish release to PyPI' + - name: "Publish release to PyPI" uses: pypa/gh-action-pypi-publish@release/v1 with: verbose: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 383257f..c8236d5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,7 @@ # This workflow will upload a Python package # using Twine when a tagged commit is merged. -name: 'Publish on PyPI' +name: "Publish on PyPI" # yamllint disable-line rule:truthy on: @@ -20,14 +20,14 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: '3.x' + python-version: "3.x" - - name: 'Install dependencies' + - name: "Install dependencies" run: | python -m pip install --upgrade pip pip install setuptools wheel twine - - name: 'Build and publish' + - name: "Build and publish" env: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.OSC_PHYSRISK_API_PYPI_TOKEN }} diff --git a/.github/workflows/test-build-push.yml b/.github/workflows/test-build-push.yml index 870de58..109edbf 100644 --- a/.github/workflows/test-build-push.yml +++ b/.github/workflows/test-build-push.yml @@ -2,12 +2,12 @@ # Workflow to build Docker image # Based on openshift.yml (excluding OpenShift deployment) -name: 'Run tests, build and push image' +name: "Run tests, build and push image" env: - APP_NAME: 'physrisk-api' - IMAGE_REGISTRY: 'quay.io/os-climate' - IMAGE_TAGS: '' + APP_NAME: "physrisk-api" + IMAGE_REGISTRY: "quay.io/os-climate" + IMAGE_TAGS: "" # yamllint disable-line rule:truthy on: @@ -18,11 +18,11 @@ on: jobs: build: - name: 'Build and push to Quay' + name: "Build and push to Quay" runs-on: ubuntu-latest steps: - - name: 'Check for required secrets' + - name: "Check for required secrets" uses: actions/github-script@v4 with: script: | @@ -51,21 +51,21 @@ jobs: core.info(`✅ All the required secrets are set`); } - - name: 'Check out repository' + - name: "Check out repository" uses: actions/checkout@v2 - - name: 'Determine app name' + - name: "Determine app name" if: env.APP_NAME == '' run: | echo "APP_NAME=$(basename $PWD)" | tee -a $GITHUB_ENV - - name: 'Determine image tags' + - name: "Determine image tags" if: env.IMAGE_TAGS == '' run: | echo "IMAGE_TAGS=latest ${GITHUB_SHA::12}" | tee -a $GITHUB_ENV # https://github.com/redhat-actions/buildah-build#readme - - name: 'Build from Dockerfile' + - name: "Build from Dockerfile" id: build-image uses: redhat-actions/buildah-build@v2 with: @@ -79,7 +79,7 @@ jobs: ./Dockerfile # https://github.com/redhat-actions/push-to-registry#readme - - name: 'Push to registry' + - name: "Push to registry" id: push-image uses: redhat-actions/push-to-registry@v2 with: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 185981b..9ac7b1c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ --- ci: - autofix_commit_msg: 'Chore: pre-commit autoupdate' + autofix_commit_msg: "Chore: pre-commit autoupdate" skip: # pre-commit.ci cannot install WGET, so tomlint must be disabled - tomllint @@ -19,7 +19,7 @@ repos: - repo: local hooks: - id: tomllint - name: 'Script: scripts/tomllint.sh' + name: "Script: scripts/tomllint.sh" language: script # pass_filenames: false files: \^*.toml @@ -47,7 +47,7 @@ repos: - id: detect-private-key - id: end-of-file-fixer - id: mixed-line-ending - args: ['--fix=lf'] + args: ["--fix=lf"] - id: name-tests-test # Do not allow direct push to main/master branches - id: no-commit-to-branch @@ -61,14 +61,14 @@ repos: hooks: - id: prettier args: - ['--ignore-unknown', '--no-error-on-unmatched-pattern', '!chart/**'] + ["--ignore-unknown", "--no-error-on-unmatched-pattern", "!chart/**"] # Lint: Markdown - repo: https://github.com/igorshubovych/markdownlint-cli rev: v0.37.0 hooks: - id: markdownlint - args: ['--fix'] + args: ["--fix"] # - repo: https://github.com/asottile/pyupgrade # rev: v3.15.0 @@ -95,7 +95,7 @@ repos: rev: 2.1.1 hooks: - id: bashate - args: ['--ignore=E006'] + args: ["--ignore=E006"] - repo: https://github.com/koalaman/shellcheck-precommit rev: v0.9.0 @@ -139,7 +139,7 @@ repos: # additional_dependencies: [black] - repo: https://github.com/pycqa/flake8 - rev: '6.1.0' + rev: "6.1.0" hooks: - id: flake8 @@ -150,14 +150,14 @@ repos: # - id: codespell - repo: https://github.com/pre-commit/mirrors-mypy - rev: 'v1.6.1' + rev: "v1.6.1" hooks: - id: mypy - repo: local hooks: - id: pip-audit - name: 'Script: scripts/pipaudit.sh' + name: "Script: scripts/pipaudit.sh" language: script # pass_filenames: false entry: scripts/pipaudit.sh diff --git a/.thoth.yaml b/.thoth.yaml index f09e549..06c2d3d 100644 --- a/.thoth.yaml +++ b/.thoth.yaml @@ -7,8 +7,8 @@ runtime_environments: - name: default operating_system: name: ubi - version: '8' - python_version: '3.8' + version: "8" + python_version: "3.8" recommendation_type: latest managers: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8a56437..1546a28 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,9 +12,9 @@ cd physrisk-api We recommend using [pipenv](https://pipenv.pypa.io/en/latest/) for a consistent working environment. - pip install pipenv - pipenv install - pipenv shell + pip install pipenv + pipenv install + pipenv shell When adding a package for use in new or improved functionality, `pipenv install `. Or, when adding something helpful for @@ -33,33 +33,40 @@ checks. and enabling automatic formatting via [pre-commit](https://pre-commit.com/) is recommended: - pre-commit install + pre-commit install To ensure compliance with static check tools, developers may wish to run black and isort against modified files. E.g., - # auto-sort imports - isort . - # auto-format code - black . + # auto-sort imports + isort . + # auto-format code + black . Code can then be tested using tox. # run static checks and unit tests - tox + + tox + # run only tests - tox -e py3 + + tox -e py3 + # run only static checks - tox -e static + + tox -e static + # run unit tests and produce an HTML code coverage report (/htmlcov) - tox -e cov + + tox -e cov To run the application locally, run either of the following commands; - docker-compose up - # or - podman-compose up + docker-compose up + # or + podman-compose up One may then make requests of . diff --git a/docker-compose.yml b/docker-compose.yml index 42ffe7c..2429dd2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,5 @@ --- -version: '2' +version: "2" services: web: @@ -13,6 +13,6 @@ services: build: ./nginx container_name: nginx ports: - - '8443:8443' + - "8443:8443" depends_on: - web