diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 3112be5..7eed1bb 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,10 +1,10 @@ version: 2 updates: -- package-ecosystem: pip - directory: / - schedule: - interval: daily -- package-ecosystem: github-actions - directory: / - schedule: - interval: daily + - package-ecosystem: pip + directory: / + schedule: + interval: daily + - package-ecosystem: github-actions + directory: / + schedule: + interval: daily diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 0a070df..e44f5ec 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -4,43 +4,42 @@ on: [push] jobs: build: - runs-on: ubuntu-latest strategy: matrix: python-version: [3.7, 3.8, 3.9, "3.10"] steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - uses: actions/cache@v3.2.3 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} - restore-keys: | - ${{ runner.os }}-pip- - - name: Install build tools - run: | - python -m pip install --upgrade pip - pip install -U black pylama wheel pip tox - pip install . - - name: Set build name - run: echo "::set-output name=${GITHUB_REPOSITORY}-$(python setup.py --version)" - - name: Lint - run: | - - name: Run Tox - # Run tox using the version of Python in `PATH` - run: tox -e py - - name: Build Package - if: matrix.python-version == 3.10 && github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - run: | - python setup.py bdist - - name: Publish package - if: matrix.python-version == 3.10 && github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@master - with: - user: __token__ - password: ${{ secrets.pypi_password }} + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - uses: actions/cache@v3.2.3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} + restore-keys: | + ${{ runner.os }}-pip- + - name: Install build tools + run: | + python -m pip install --upgrade pip + pip install -U black pylama wheel pip tox + pip install . + - name: Set build name + run: echo "::set-output name=${GITHUB_REPOSITORY}-$(python setup.py --version)" + - name: Lint + run: | + - name: Run Tox + # Run tox using the version of Python in `PATH` + run: tox -e py + - name: Build Package + if: matrix.python-version == 3.10 && github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + run: | + python setup.py bdist + - name: Publish package + if: matrix.python-version == 3.10 && github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.pypi_password }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9ac1b0f..9bf3b64 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ -exclude: '^$|venv|.obsidian' +exclude: "^$|venv|.obsidian" repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.6.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -11,29 +11,35 @@ repos: - id: check-yaml - id: debug-statements - repo: https://github.com/psf/black - rev: 22.12.0 + rev: 24.4.2 hooks: - id: black - language_version: python3.10 - - repo: https://github.com/humitos/mirrors-autoflake.git - rev: v1.1 + language_version: python3.12 + - repo: https://github.com/PyCQA/autoflake + rev: v2.3.1 hooks: - id: autoflake - args: ['--in-place', '--remove-unused-variable'] + args: [--remove-all-unused-imports, --in-place] - repo: https://github.com/PyCQA/isort - rev: 5.11.4 + rev: 5.13.2 hooks: - id: isort - args: ['--line-length=79'] - language_version: python3.10 + args: ["--profile", "black", "--filter-files", "--line-length=79"] + language_version: python3.12 + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v1.10.0 + hooks: + - id: mypy + additional_dependencies: [types-requests, types-PyYAML, types-Flask, types-Werkzeug, + types-Markdown] - repo: https://github.com/asottile/pyupgrade - rev: v3.3.1 + rev: v3.15.2 hooks: - id: pyupgrade args: - - --py37-plus + - --py38-plus - repo: https://github.com/andreoliwa/nitpick - rev: v0.32.0 + rev: v0.35.0 hooks: - id: nitpick - repo: https://github.com/pre-commit/pygrep-hooks @@ -44,3 +50,5 @@ repos: - id: python-no-eval - id: python-no-log-warn - id: rst-backticks +default_language_version: + python: python3.11 diff --git a/dependabot.yml b/dependabot.yml new file mode 100644 index 0000000..6114ed3 --- /dev/null +++ b/dependabot.yml @@ -0,0 +1,22 @@ +name: Dependabot auto-merge +on: pull_request + +permissions: + contents: write + pull-requests: write + +jobs: + dependabot: + runs-on: ubuntu-latest + if: github.actor == 'dependabot[bot]' + steps: + - name: Enable auto-merge for Dependabot PRs + run: gh pr merge --auto --merge "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GH_TOKEN: ${{secrets.GITHUB_TOKEN}} + - name: Approve a PR + run: gh pr review --approve "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GH_TOKEN: ${{secrets.GITHUB_TOKEN}}