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

Refactor Python package metadata #64

Merged
merged 1 commit into from
Apr 27, 2024
Merged
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
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ Checklist:
```bash
$ git log --oneline --decorate v<old version>..HEAD
```
1. [ ] Update the `tool.poetry.version` field in `pyproject.toml`
1. [ ] Add release notes to `docs/release-notes.md`
1. [ ] Create pull request: <paste pull request here>
1. [ ] Merge pull request
Expand Down
18 changes: 0 additions & 18 deletions .github/workflows/pre-commit.yml

This file was deleted.

72 changes: 63 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,68 @@ on:
- published

jobs:
release:
build:
runs-on: ubuntu-22.04
steps:
- name: Clone full tree, and checkout tag
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python and PDM
uses: pdm-project/setup-pdm@v4
with:
python-version: "3.12"
version: "2.15.1"
- name: Build source dist and wheels
run: pdm build --verbose
- name: Upload source dist and wheels to artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
retention-days: 5
if-no-files-found: error

publish-pypi:
needs: build
runs-on: ubuntu-22.04
environment: pypi
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
- name: Build and publish to PyPI
uses: JRubics/[email protected]
with:
python_version: "3.11"
poetry_version: "==1.8.1"
ignore_dev_requirements: "yes"
pypi_token: ${{ secrets.PYPI_TOKEN }}
- name: Clone full tree, and checkout tag
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download source dist and wheels from artifacts
uses: actions/download-artifact@v4
with:
name: dist
- name: Setup Python and PDM
uses: pdm-project/setup-pdm@v4
with:
python-version: "3.12"
version: "2.15.1"
- name: Publish source dist and wheels to PyPI
run: pdm publish --no-build --verbose

publish-github-release:
needs: build
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: Clone and checkout tag
uses: actions/checkout@v4
- name: Download source dist and wheels from artifacts
uses: actions/download-artifact@v4
with:
name: dist
- name: Publish source dist and wheels to GitHub Release
uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: dist/*
release_id: ${{ github.event.release.id }}
overwrite: true
44 changes: 44 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: test

on:
pull_request:
push:
branches:
- main

jobs:
pre-commit:
runs-on: ubuntu-22.04
steps:
- name: Clone and checkout branch
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- name: Run pre-commit hooks
uses: pre-commit/[email protected]

build:
needs: pre-commit
runs-on: ubuntu-22.04
steps:
- name: Clone full tree, and checkout branch
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python and PDM
uses: pdm-project/setup-pdm@v4
with:
python-version: "3.12"
version: "2.15.1"
- name: Build source dist and wheels
run: pdm build --verbose
- name: Upload source dist and wheels to artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
retention-days: 5
if-no-files-found: error
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ venv/
ENV/
env.bak/
venv.bak/
.pdm-python

# Spyder project settings
.spyderproject
Expand Down
30 changes: 9 additions & 21 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,19 @@ repos:
- id: detect-private-key
- id: check-added-large-files
- id: check-merge-conflict
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.1.5"
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.4.2"
hooks:
- id: ruff
args:
- --exit-non-zero-on-fix
- repo: https://github.com/psf/black
rev: "23.11.0"
hooks:
- id: black
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.7.0"
rev: "v1.10.0"
hooks:
- id: mypy
args: []
additional_dependencies:
- buildarr==0.7.0
- types-requests==2.31.0.10
- repo: https://github.com/python-poetry/poetry
rev: "1.8.1"
- buildarr==0.7.1
- types-requests==2.31.0.20240406
- repo: https://github.com/pdm-project/pdm
rev: "2.15.1"
hooks:
- id: poetry-check
- id: poetry-lock
args: ["--no-update", "--no-cache"]
- id: poetry-export
additional_dependencies:
- poetry-plugin-export==1.6.0
args: ["-f", "requirements.txt", "-o", "requirements.txt"]
- id: pdm-lock-check
1 change: 0 additions & 1 deletion buildarr_sonarr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
Sonarr plugin for Buildarr root module.
"""


from __future__ import annotations

from importlib_metadata import PackageNotFoundError, version as package_version
Expand Down
1 change: 0 additions & 1 deletion buildarr_sonarr/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
Sonarr plugin API functions.
"""


from __future__ import annotations

import re
Expand Down
1 change: 0 additions & 1 deletion buildarr_sonarr/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
Sonarr plugin CLI commands.
"""


from __future__ import annotations

import functools
Expand Down
7 changes: 2 additions & 5 deletions buildarr_sonarr/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
Sonarr plugin configuration.
"""


from __future__ import annotations

from typing import TYPE_CHECKING, Any, Dict, Optional
Expand All @@ -43,13 +42,11 @@
if TYPE_CHECKING:
from ..secrets import SonarrSecrets

class _SonarrInstanceConfig(ConfigPlugin[SonarrSecrets]):
...
class _SonarrInstanceConfig(ConfigPlugin[SonarrSecrets]): ...

else:

class _SonarrInstanceConfig(ConfigPlugin):
...
class _SonarrInstanceConfig(ConfigPlugin): ...


class SonarrSettingsConfig(SonarrConfigBase):
Expand Down
1 change: 0 additions & 1 deletion buildarr_sonarr/config/connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
Sonarr plugin connect settings configuration.
"""


from __future__ import annotations

from datetime import datetime
Expand Down
1 change: 0 additions & 1 deletion buildarr_sonarr/config/download_clients/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
Sonarr plugin download client settings.
"""


from __future__ import annotations

from logging import getLogger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
Sonarr plugin download client definition.
"""


from __future__ import annotations

from logging import getLogger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
Sonarr plugin download client remote path mappings.
"""


from __future__ import annotations

from logging import getLogger
Expand Down
1 change: 0 additions & 1 deletion buildarr_sonarr/config/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
Sonarr plugin general settings configuration.
"""


from __future__ import annotations

from ipaddress import IPv4Address
Expand Down
1 change: 0 additions & 1 deletion buildarr_sonarr/config/import_lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
Sonarr plugin import list settings configuration.
"""


from __future__ import annotations

import re
Expand Down
1 change: 0 additions & 1 deletion buildarr_sonarr/config/indexers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
Sonarr plugin indexers settings configuration.
"""


from __future__ import annotations

from logging import getLogger
Expand Down
1 change: 0 additions & 1 deletion buildarr_sonarr/config/media_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
Sonarr plugin media management settings configuration.
"""


from __future__ import annotations

from logging import getLogger
Expand Down
1 change: 0 additions & 1 deletion buildarr_sonarr/config/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
Sonarr plugin metadata settings configuration.
"""


from __future__ import annotations

from typing import Any, Dict, List, Mapping, Optional, Tuple, Type
Expand Down
1 change: 0 additions & 1 deletion buildarr_sonarr/config/profiles/delay.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
Sonarr plugin delay profile configuration.
"""


from __future__ import annotations

from logging import getLogger
Expand Down
1 change: 0 additions & 1 deletion buildarr_sonarr/config/profiles/language.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
Sonarr plugin language profile configuration.
"""


from __future__ import annotations

from logging import getLogger
Expand Down
1 change: 0 additions & 1 deletion buildarr_sonarr/config/profiles/quality.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
Sonarr plugin quality profile configuration.
"""


from __future__ import annotations

from logging import getLogger
Expand Down
1 change: 0 additions & 1 deletion buildarr_sonarr/config/profiles/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
Sonarr plugin release profile configuration.
"""


from __future__ import annotations

import json
Expand Down
1 change: 0 additions & 1 deletion buildarr_sonarr/config/quality.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
Sonarr plugin quality settings configuration object.
"""


from __future__ import annotations

import json
Expand Down
1 change: 0 additions & 1 deletion buildarr_sonarr/config/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
Sonarr plugin tags settings configuration.
"""


from __future__ import annotations

from logging import getLogger
Expand Down
7 changes: 2 additions & 5 deletions buildarr_sonarr/config/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
Sonarr plugin configuration utility classes and functions.
"""


from __future__ import annotations

from typing import TYPE_CHECKING
Expand All @@ -27,13 +26,11 @@
if TYPE_CHECKING:
from ..secrets import SonarrSecrets

class SonarrConfigBase(ConfigBase[SonarrSecrets]):
...
class SonarrConfigBase(ConfigBase[SonarrSecrets]): ...

else:

class SonarrConfigBase(ConfigBase):
...
class SonarrConfigBase(ConfigBase): ...


class TraktAuthUser(ConstrainedStr):
Expand Down
1 change: 0 additions & 1 deletion buildarr_sonarr/config/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
Sonarr plugin UI settings configuration object.
"""


from __future__ import annotations

from typing import List
Expand Down
Loading