Skip to content

Commit

Permalink
Python 3.12/3.13 support (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbirddog authored Oct 9, 2024
1 parent d64ae29 commit daf3bc8
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 50 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on: [push]
# runs-on: ubuntu-latest
# strategy:
# matrix:
# python-version: ["3.10", "3.11"]
# python-version: ["3.11", "3.12", "3.13"]
# steps:
# - uses: actions/checkout@v3
# - name: Set up Python ${{ matrix.python-version }}
Expand All @@ -22,7 +22,7 @@ on: [push]
# key: poetry-1.6.1
# - uses: snok/install-poetry@v1
# with:
# version: 1.6.1
# version: 1.8.1
# virtualenvs-create: true
# virtualenvs-in-project: true
# installer-parallel: true
Expand Down Expand Up @@ -56,13 +56,13 @@ jobs:
restore-keys: ${{ runner.os }}-pip
- run: python -m pip install ruff
- run: |
ruff .
ruff --version && ruff check .
test:
needs: linting
strategy:
fail-fast: true
matrix:
python-version: [ "3.10", "3.11" ]
python-version: [ "3.11", "3.12", "3.13" ]
runs-on: ubuntu-latest
steps:
- name: Check out repository
Expand All @@ -75,7 +75,7 @@ jobs:
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.6.1
version: 1.8.1
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
Expand Down
11 changes: 11 additions & 0 deletions dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM python:3.12-slim AS base

WORKDIR /app

RUN pip install --upgrade pip
RUN pip install poetry==1.8.1 pytest-xdist==3.5.0

COPY . .
RUN poetry install --no-root

CMD ["poetry", "run", "pytest", "tests/"]
43 changes: 22 additions & 21 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spiffworkflow-connector-command = {git = "https://github.com/sartography/spiffwo
pytest = "^7.2.0"
connector-example = {path = "tests/mock_connectors/connector-example", develop = true}
mypy = "^1.6.0"
ruff = "^0.0.292"
ruff = "^0.6.9"

[build-system]
requires = ["poetry-core"]
Expand All @@ -30,7 +30,7 @@ pythonpath = [
]

[tool.ruff]
select = [
lint.select = [
"B", # flake8-bugbear
"C", # mccabe
"E", # pycodestyle error
Expand All @@ -44,10 +44,9 @@ select = [
"I001" # isort
]

ignore = [
lint.ignore = [
"C901", # "complexity" category
"PLR", # "refactoring" category has "too many lines in method" type stuff
"PLC1901",
"PLE1205" # saw this Too many arguments for `logging` format string give a false positive once
]

Expand All @@ -60,11 +59,11 @@ exclude = [
"migrations"
]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"migrations/versions/*.py" = ["E501"]
"tests/**/*.py" = ["PLR2004", "S101"] # PLR2004 is about magic vars, S101 allows assert

[tool.ruff.isort]
[tool.ruff.lint.isort]
force-single-line = true

[tool.mypy]
Expand Down
8 changes: 3 additions & 5 deletions src/spiffworkflow_proxy/plugin_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,9 @@ def modules_for_plugin_in_package(
) -> Generator[tuple[str, types.ModuleType], None, None]:
for finder, name, ispkg in pkgutil.iter_modules(plugin.__path__):
if ispkg and name == package_name:
found_module = finder.find_module(name) # type: ignore
if found_module is not None:
sub_pkg = found_module.load_module(name)
yield from PluginService.modules_for_plugin_in_package(sub_pkg, None)
elif package_name is None:
sub_pkg = importlib.import_module(f"{plugin.__name__}.{name}")
yield from PluginService.modules_for_plugin_in_package(sub_pkg, None)
elif not package_name:
spec = finder.find_spec(name) # type: ignore
if spec is not None and spec.loader is not None:
module = types.ModuleType(spec.name)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
"""Simple Example Command."""
from typing import Any

from spiffworkflow_connector_command.command_interface import CommandResultDictV2
from spiffworkflow_connector_command.command_interface import CommandResponseDict
from spiffworkflow_connector_command.command_interface import ConnectorCommand
from spiffworkflow_connector_command.command_interface import ConnectorProxyResponseDict


class CombineStrings(ConnectorCommand):
Expand All @@ -20,19 +19,18 @@ def __init__(
self.arg1 = arg1
self.arg2 = arg2

def execute(self, config: Any, task_data: Any) -> CommandResultDictV2:
def execute(self, config: Any, task_data: Any) -> CommandResponseDict:
"""Execute."""

return_response: ConnectorProxyResponseDict = {
"command_response": {"example_response": "whatever you want", "arg1": self.arg1, "arg2": self.arg2},
"spiff__logs": [],
"error": None,
}
result: CommandResultDictV2 = {
"response": return_response,
"status": 200,
return {
"body": {
"command_response": {
"example_response": "whatever you want",
"arg1": self.arg1,
"arg2": self.arg2
},
},
"http_status": 200,
"mimetype": "application/json",
}

return result

1 change: 1 addition & 0 deletions tests/spiffworkflow_proxy/integration/blueprint_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from flask import Flask
from flask.testing import FlaskClient

from spiffworkflow_proxy.blueprint import proxy_blueprint


Expand Down

0 comments on commit daf3bc8

Please sign in to comment.