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

Bump piped from 05de4b9 to 4d7f998 #66

Merged
merged 10 commits into from
Dec 1, 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
19 changes: 19 additions & 0 deletions .github/actions/setup-py/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "Install Python"
description: "Install a specific Python version"
inputs:
python-version:
description: "Python version to install"
required: false
default: "3.11"
runs:
using: composite
steps:
- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b
id: install-py
with:
python-version: ${{ inputs.python-version }}

- name: Install Nox
run: pipx install uv nox[uv] --python "${{ steps.install-py.outputs.python-path }}"
shell: bash
2 changes: 1 addition & 1 deletion .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

Expand Down
17 changes: 5 additions & 12 deletions .github/workflows/freeze-for-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
pull_request:
branches:
- master
paths: ["piped", "pyproject.toml", "requirements.in", "dev-requirements/*.in", "!dev-requirements/constraints.in"]
paths: ["piped", "pyproject.toml"]

jobs:
freeze-pr-dep-changes:
Expand All @@ -19,23 +19,16 @@ jobs:
with:
submodules: "true"

- name: Set up Python 3.11
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b
with:
python-version: "3.11"

- name: install prerequisites
run: |
python -m pip install --upgrade pip wheel
python -m pip install -r ./piped/python/base-requirements/nox.txt
- name: Install Python
uses: ./.github/actions/setup-py

- name: Upgrade dependency locks
run: python -m nox -s freeze-locks bot-package-diff
run: nox -s freeze-locks bot-package-diff

- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
with:
name: gogo.patch
path: gogo.patch

- name: Check diff file
run: python -m nox -s is-diff-file-empty
run: nox -s is-diff-file-empty
17 changes: 5 additions & 12 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,11 @@ jobs:
with:
submodules: "true"

- name: Set up Python 3.11
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b
with:
python-version: "3.11"

- name: install prerequisites
run: |
python -m pip install --upgrade pip wheel
python -m pip install -r ./piped/python/base-requirements/nox.txt
- name: Install Python
uses: ./.github/actions/setup-py

- name: Check spelling
run: python -m nox -s spell-check
run: nox -s spell-check

- name: Lint with flake8
run: python -m nox -s flake8
- name: Lint with Ruff
run: nox -s lint
15 changes: 4 additions & 11 deletions .github/workflows/reformat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,16 @@ jobs:
with:
submodules: "true"

- name: Set up Python 3.11
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b
with:
python-version: "3.11"

- name: install prerequisites
run: |
python -m pip install --upgrade pip wheel
python -m pip install -r ./piped/python/base-requirements/nox.txt
- name: Install Python
uses: ./.github/actions/setup-py

- name: Reformat
run: python -m nox -s reformat bot-package-diff
run: nox -s reformat bot-package-diff

- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
with:
name: gogo.patch
path: gogo.patch

- name: Check diff file
run: python -m nox -s is-diff-file-empty
run: nox -s is-diff-file-empty
15 changes: 4 additions & 11 deletions .github/workflows/resync-piped.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,16 @@ jobs:
with:
submodules: "true"

- name: Set up Python 3.11
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b
with:
python-version: "3.11"

- name: install prerequisites
run: |
python -m pip install --upgrade pip wheel
python -m pip install -r ./piped/python/base-requirements/nox.txt
- name: Install Python
uses: ./.github/actions/setup-py

- name: Resync Piped
run: python -m nox -s copy-piped bot-package-diff
run: nox -s copy-piped bot-package-diff

- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
with:
name: gogo.patch
path: gogo.patch

- name: Check diff file
run: python -m nox -s is-diff-file-empty
run: nox -s is-diff-file-empty
13 changes: 3 additions & 10 deletions .github/workflows/type-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,8 @@ jobs:
with:
submodules: "true"

- name: Set up Python 3.11
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b
with:
python-version: "3.11"

- name: install prerequisites
run: |
python -m pip install --upgrade pip wheel
python -m pip install -r ./piped/python/base-requirements/nox.txt
- name: Install Python
uses: ./.github/actions/setup-py

- name: Run type checker
run: python -m nox -s type-check
run: nox -s type-check
13 changes: 3 additions & 10 deletions .github/workflows/upgrade-locks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,11 @@ jobs:
with:
submodules: "true"

- name: Set up Python 3.11
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b
with:
python-version: "3.11"

- name: install prerequisites
run: |
python -m pip install --upgrade pip wheel
python -m pip install -r ./piped/python/base-requirements/nox.txt
- name: Install Python
uses: ./.github/actions/setup-py

- name: Upgrade dependency locks
run: python -m nox -s freeze-locks
run: nox -s freeze-locks

- name: Create Pull Request
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f
Expand Down
36 changes: 0 additions & 36 deletions .github/workflows/verify-locks.yml

This file was deleted.

16 changes: 11 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
FROM python:3.13-alpine
FROM registry.access.redhat.com/ubi9/python-312@sha256:d1244378f7ab72506d8d91cadebbf94c893c2828300f9d44aee4678efec62db9 AS install

WORKDIR /code

COPY ./runner.py ./runner.py
COPY ./dev-requirements/constraints.txt ./requirements.txt
COPY ./pyproject.toml ./
COPY ./uv.lock ./

RUN pip install uv && \
uv sync --frozen --only-group main

RUN pip install -Ur requirements.txt
FROM registry.access.redhat.com/ubi9/python-312@sha256:d1244378f7ab72506d8d91cadebbf94c893c2828300f9d44aee4678efec62db9

COPY --from=install /code/.venv ./venv
COPY ./runner.py ./runner.py

STOPSIGNAL SIGINT
ENTRYPOINT ["python", "runner.py"]
ENTRYPOINT ["./venv/bin/python", "runner.py"]
3 changes: 2 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
"""Development tasks implemented by Piped."""

from __future__ import annotations

import pathlib
Expand Down
2 changes: 1 addition & 1 deletion piped
Submodule piped updated 69 files
+19 −0 .github/actions/setup-py/action.yml
+1 −1 .github/workflows/docker-publish.yml
+5 −12 .github/workflows/freeze-for-pr.yml
+6 −13 .github/workflows/lint.yml
+4 −11 .github/workflows/reformat.yml
+5 −12 .github/workflows/resync-piped.yml
+3 −10 .github/workflows/type-check.yml
+3 −10 .github/workflows/update-licence.yml
+3 −10 .github/workflows/upgrade-locks.yml
+0 −36 .github/workflows/verify-locks.yml
+16 −7 Dockerfile
+78 −34 bot/main.py
+0 −1 bot/requirements-extra.txt
+0 −8 bot/requirements.in
+0 −301 bot/requirements.txt
+0 −35 dev-requirements/flake8.in
+0 −243 dev-requirements/flake8.txt
+0 −1 dev-requirements/type-checking-extra.txt
+0 −4 dev-requirements/type-checking.in
+0 −432 dev-requirements/type-checking.txt
+0 −47 github/actions/lint.yml
+19 −0 github/actions/setup-py/action.yml
+0 −36 github/actions/verify-locks.yml
+0 −0 github/workflows/clippy.yml
+1 −1 github/workflows/docker-publish.yml
+4 −11 github/workflows/freeze-for-pr.yml
+40 −0 github/workflows/lint.yml
+3 −12 github/workflows/pr-docs.yml
+3 −8 github/workflows/publish.yml
+7 −21 github/workflows/py-test.yml
+4 −11 github/workflows/reformat.yml
+3 −10 github/workflows/release-docs.yml
+4 −11 github/workflows/resync-piped.yml
+4 −11 github/workflows/rustfmt.yml
+3 −10 github/workflows/type-check.yml
+3 −10 github/workflows/update-licence.yml
+3 −10 github/workflows/upgrade-locks.yml
+3 −10 github/workflows/verify-types.yml
+1 −1 noxfile.py
+83 −39 pyproject.toml
+0 −5 python/base-requirements/docs.in
+0 −453 python/base-requirements/docs.txt
+0 −2 python/base-requirements/flake8.in
+0 −20 python/base-requirements/flake8.txt
+0 −1 python/base-requirements/freeze-locks.in
+0 −608 python/base-requirements/freeze-locks.txt
+0 −44 python/base-requirements/library-flake8.in
+0 −409 python/base-requirements/library-flake8.txt
+0 −3 python/base-requirements/lint.in
+0 −66 python/base-requirements/lint.txt
+0 −1 python/base-requirements/nox.in
+0 −33 python/base-requirements/nox.txt
+0 −1 python/base-requirements/publish.in
+0 −139 python/base-requirements/publish.txt
+0 −5 python/base-requirements/reformat.in
+0 −217 python/base-requirements/reformat.txt
+0 −1 python/base-requirements/templating.in
+0 −71 python/base-requirements/templating.txt
+0 −4 python/base-requirements/tests.in
+0 −96 python/base-requirements/tests.txt
+0 −2 python/base-requirements/type-checking.in
+0 −51 python/base-requirements/type-checking.txt
+66 −36 python/copy_actions.py
+87 −217 python/noxfile.py
+1 −1 python/noxfile.template.py
+0 −1 python/piped_shared/__init__.py
+48 −26 python/piped_shared/config.py
+0 −7 python/pyproject.toml
+1,208 −0 uv.lock
106 changes: 71 additions & 35 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,40 +1,44 @@
[project]
name = "dapi-docs-webhook-watcher"
description = "Discord API webhook poller for Discord"
requires-python = ">=3.11,<3.13"
version = "0.1"

[dependency-groups]
main = [
"click",
"requests",
"python-dateutil",
"python-dotenv",
]
freeze-locks = ["uv"]
lint = [
"codespell>=2.2.2",
"pre-commit-hooks>=4.4",
"slotscheck>=0.16.1",
"ruff",
]
reformat = [
"black>=22.10.0",
"isort>=5.11.3",
"pre-commit-hooks>=4.4",
"pycln>=2.1.2",
"sort-all>=1.2",
]
templating = ["Jinja2>=3.1.2"]
type-checking = [
"mypy>=0.991",
"nox",
"pyright>=1.1.285",
{include-group = "main"},
]

[tool.black]
include = ".*pyi?$"
line-length = 120
skip-magic-trailing-comma = true
target-version = ["py311"]

[tool.flake8]
accept-encodings = "utf-8"
count = true
docstring-convention = "numpy"
eradicate-aggressive = true
extend-select = ["TC100", "TC101"]
force-future-annotations = true
ignore-decorators = "overload"
max-complexity = 20
max-function-length = 100
# Technically this is 120, but black has a policy of "1 or 2 over is fine if it is tidier", so we have to raise this.
max-line-length = 130
min_python_version = "3.9"
pep585-activation = "always"
show_source = false
statistics = false
ignore = [
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D103", # Missing docstring in public function
"EXE001", # Shebang is present but the file is not executable.
"E902", # TokenError: unterminated string literal (is broken)
"INP001", # File is part of an implicit namespace package. Add an __init__.py
"S113", # Requests call without timeout
]
per-file-ignores = [
# This code cannot be used in ignore due to a bug.
"*.py: DALL000", # Module lacks __all__.
"noxfile.py: E402, F401, F403",
]

[tool.isort]
profile = "black"
force_single_line = true
Expand All @@ -49,16 +53,15 @@ reportMissingModuleSource = "error" # Is only "warning" on strict mode.
# Error code which are disabled even when general strict.
reportShadowedImports = "error"
reportCallInDefaultInitializer = "none" # Ended up just complaining about cases where this was fine (e.g. timedeltas).
reportImplicitStringConcatenation = "none" # Conflicts with flake8 config.
reportImplicitStringConcatenation = "none" # Conflicts with Ruff config.
reportPropertyTypeMismatch = "error"
reportUninitializedInstanceVariable = "error"
reportUnnecessaryTypeIgnoreComment = "error"

[tool.piped]
default_sessions = ["reformat", "flake8", "spell-check", "type-check"]
default_sessions = ["reformat", "lint", "spell-check", "type-check"]
hide = ["build", "generate_docs", "publish", "slot-check", "test", "test_coverage", "test_publish", "verify-markup", "verify_types"]
top_level_targets = ["./noxfile.py", "./runner.py"]
version_constraint = "3.11,<3.13"

[tool.piped.github_actions."*"]
default_py_ver = "3.11"
Expand All @@ -70,4 +73,37 @@ default_py_ver = "3.11"
[tool.piped.github_actions.resync_piped]
[tool.piped.github_actions.type_check]
[tool.piped.github_actions.upgrade_locks]
[tool.piped.github_actions.verify_locks]

[tool.ruff.lint]
select = ["ALL"]
ignore = [
"COM812", # Trailing comma missing (incompatible with black)
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"D105", # Missing docstring in magic method
"INP001", # File `` is part of an implicit namespace package. Add an `__init__.py`.
"S113", # Probable use of `requests` call without timeout
]

[tool.ruff.lint.per-file-ignores]
"noxfile.py" = [
"F403", # `from noxfile import *` used; unable to detect undefined name
]

[tool.ruff.lint.mccabe]
max-complexity = 20

[tool.ruff.lint.pycodestyle]
# Technically this is 120, but black has a policy of "1 or 2 over is fine if it is tidier", so we have to raise this.
max-line-length = 130

[tool.ruff.lint.pydocstyle]
convention = "numpy"

[tool.ruff.lint.pylint]
max-args = 20
max-branches = 20
max-returns = 15
max-statements = 100
4 changes: 0 additions & 4 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
click
requests
python-dateutil
python-dotenv
Loading
Loading