From 19d00f5f0e6ddc8653cac4122f7a55695cee6fb6 Mon Sep 17 00:00:00 2001 From: Jacob Pavlock Date: Sat, 6 Apr 2024 15:54:30 -0700 Subject: [PATCH] build: update dependencies --- .github/scripts/prep_release.py | 5 ++++- .github/workflows/ci.yml | 20 ++++++++++---------- .github/workflows/prep_release.yml | 4 ++-- .github/workflows/preview_docs.yml | 2 +- .github/workflows/release.yml | 22 ++++++++++++++-------- moe_musicbrainz/mb_core.py | 2 +- pyproject.toml | 25 ++++++++++++++----------- setup.cfg | 27 +++++++++++++++++++-------- 8 files changed, 65 insertions(+), 42 deletions(-) diff --git a/.github/scripts/prep_release.py b/.github/scripts/prep_release.py index cc2779e..34dbce9 100644 --- a/.github/scripts/prep_release.py +++ b/.github/scripts/prep_release.py @@ -140,6 +140,7 @@ def prepare_release_pr(token: str) -> None: ) repo = login(token) + assert repo repo.create_pull( f"Prepare release {new_version}", base="main", @@ -218,10 +219,12 @@ def generate_changelog(old_version: str, new_version: str) -> None: f.writelines(contents) -def login(token: str) -> Repository: +def login(token: str) -> Repository | None: """Logins to github and returns the working repository.""" github = github3.login(token=token) + assert github owner, repo = SLUG.split("/") + return github.repository(owner, repo) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c9ff12e..0c2c004 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,12 +13,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.x" @@ -36,14 +36,14 @@ jobs: runs-on: ${{ matrix.platform }} strategy: matrix: - python-version: ["3.9", "3.10", "3.11"] + python-version: ["3.9", "3.10", "3.11", "3.12"] platform: [ubuntu-latest, windows-latest, macos-latest] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} @@ -60,10 +60,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.x" @@ -80,10 +80,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.x" @@ -97,4 +97,4 @@ jobs: poetry run pytest -v --cov=moe --cov-report=xml - name: Upload test coverage report - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 diff --git a/.github/workflows/prep_release.yml b/.github/workflows/prep_release.yml index 6ed43c1..e8ab1b8 100644 --- a/.github/workflows/prep_release.yml +++ b/.github/workflows/prep_release.yml @@ -8,12 +8,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.x" diff --git a/.github/workflows/preview_docs.yml b/.github/workflows/preview_docs.yml index 34db8b3..5f40fb6 100644 --- a/.github/workflows/preview_docs.yml +++ b/.github/workflows/preview_docs.yml @@ -15,4 +15,4 @@ jobs: steps: - uses: readthedocs/actions/preview@v1 with: - project-slug: "mrmoe" + project-slug: "moe-musicbrainz" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 40a0d0a..4fb5293 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,10 +14,10 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.x" @@ -53,11 +53,17 @@ jobs: pypi_release: if: contains(github.event.head_commit.message, 'release:') runs-on: ubuntu-latest + + permissions: + # required for trusted publishing + id-token: write + contents: read + steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.x" @@ -67,9 +73,9 @@ jobs: - name: Build run: | poetry build + - name: Mint token + id: mint + uses: tschm/token-mint-action@v1.0.3 - name: Publish to PyPI - env: - PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }} - PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | - poetry publish --username $PYPI_USERNAME --password $PYPI_PASSWORD + poetry publish -u __token__ -p '${{ steps.mint.outputs.api-token }}' diff --git a/moe_musicbrainz/mb_core.py b/moe_musicbrainz/mb_core.py index cb600f8..629185f 100644 --- a/moe_musicbrainz/mb_core.py +++ b/moe_musicbrainz/mb_core.py @@ -10,7 +10,7 @@ from pathlib import Path from typing import Any, Callable, Optional, cast -import dynaconf +import dynaconf.base import mediafile import moe import musicbrainzngs diff --git a/pyproject.toml b/pyproject.toml index 043dd2a..151fb09 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,21 +8,21 @@ license = "MIT" readme = "README.rst" [tool.poetry.dependencies] -python = ">=3.9,<3.12" +python = ">=3.9,<3.13" moe = "^2.0.0" [tool.poetry.group.test.dependencies] debugpy = "^1.4.1" -pytest = "^6.0.1" -pytest-cov = "^2.10.0" +pytest = "^8.0.0" +pytest-cov = "^4.0.0" [tool.poetry.group.lint.dependencies] -black = "^22.6.0" -commitizen = "^2.17.12" +black = "^24.0.0" +commitizen = "^3.0.0" darglint = "^1.8.1" -flake8 = "^5.0.4" -flake8-alphabetize = "^0.0.17" -flake8-bugbear = "^22.7.1" +flake8 = "^7.0.0" +flake8-alphabetize = "^0.0.19" +flake8-bugbear = "^24.0.0" flake8-comprehensions = "^3.10.0" flake8-docstrings = "^1.5.0" flake8-pytest-style = "^1.6.0" @@ -30,13 +30,13 @@ flake8-use-fstring = "^1.1" "github3.py" = "^3.2.0" isort = "^5.10.1" mccabe = "^0.7.0" -pre-commit = "^2.6.0" +pre-commit = "^3.0.0" pyright = "^1.1.267" [tool.poetry.group.docs.dependencies] furo = "*" pypandoc = "^1.9" -Sphinx = "^5.2.3" +Sphinx = "^7.0.0" [tool.poetry.plugins."moe.plugins"] "musicbrainz" = "moe_musicbrainz" @@ -66,8 +66,11 @@ markers = [ ] [tool.pyright] +exclude = [ + "alembic", "tests" +] pythonPlatform = "All" [build-system] -requires = ["poetry-core"] +requires = ["poetry-core>=1.0"] build-backend = "poetry.core.masonry.api" diff --git a/setup.cfg b/setup.cfg index 83ac507..4298a81 100644 --- a/setup.cfg +++ b/setup.cfg @@ -21,18 +21,29 @@ select = PT, # pytest style W6, # pycodestyle deprecation warnings ignore = - PT001, # allow `@pytest.fixture` (no parens) - PT023, # allow `@pytest.mark.foo` (no parens) - B950, # bug-bear line length; just use flake8 line length limit - E203, # whitespace before ':' (black conflict) - E266, # too many leading '#' for block comment - E741, # ambiguous variable names I, O, etc. (use a better font) - DAR402, # Excess exceptions in "Raises" (I like to document sub-private-methods) + # allow `@pytest.fixture` (no parens) + PT001, + # allow `@pytest.mark.foo` (no parens) + PT023, + # bug-bear line length; just use flake8 line length limit + B950, + # whitespace before ':' (black conflict) + E203, + # Excess exceptions in "Raises" (I like to document sub-private-methods) + DAR402, + # too many leading '#' for block comment + E266, per-file-ignores = + # E800: config file has commented out code as examples + alembic/env.py:E800 + # D1: database migrations don't need docstrings + # I: isort errors tend to misinterpret alembic as a local package + alembic/versions/*.py:D1,I + # B907: manually specified quotes are usually intentional for testing purposes # C901: don't check complexity for tests # DAR101: pytest uses fixtures as arguments, documenting each use is unnecessary # DAR102: factory arguments with fixtures can be weird - tests/*:C901,DAR101,DAR102 + tests/*:B907,C901,DAR101,DAR102 # F401: import unused # F403: allow * imports (used for packaging in some cases) */__init__.py:F401,F403