Skip to content

fix: make ruff check and format pass - #151

Merged
AlexanderWillner merged 6 commits into
thingsapi:mainfrom
AlexanderWillner:ruff-fix-36c7acf
Oct 26, 2026
Merged

AlexanderWillner merged 6 commits into
thingsapi:mainfrom
AlexanderWillner:ruff-fix-36c7acf

Conversation

@AlexanderWillner

Copy link
Copy Markdown
Contributor

Follow-up to 36c7acf: ruff check . reported 44 findings (mostly pre-existing) and ruff format --check flagged two files.

  • Add ruff.toml with target-version py38 (matches python_requires>=3.7 and CI 3.8-3.14), so no syntax rewrites that break old Pythons.
  • Ignore FA100 (keep runtime annotations) and TRY004 (ValueError is API contract: api.get() catches it, tests expect it).
  • Mark C901 as external so the intentional flake8 noqa in api.py stays.
  • Remove unused blanket noqa directives, sort imports, normalize quotes via ruff format.
  • Drop stray shebang in tests/test_things.py and executable bit on things/database.py.

Verified: ruff check and ruff format --check pass, 37/37 unittests green.

Add ruff.toml with target-version py38 (matches python_requires
and CI), remove unused noqa directives, sort imports, normalize
quotes via ruff format, drop stray shebang and executable bit.
3.8-3.10 are EOL, and 3.8 is no longer provided on ubuntu-26.04,
which broke CI at setup-python. Drop them from the test matrix,
bump python_requires and Pipfile, retarget Ruff to py311 and
modernize annotations (PEP 585/604).
pipenv treats python_version as an exact requirement, not a
minimum, so "3.11" broke deps-install on 3.12+. The minimum
version lives in setup.py (python_requires >= 3.11).
@mikez

mikez commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

LGTM.
You might consider merging several of the config files, including ruff.toml and requirements.txt, into a single pyproject.toml.

Move ruff config (ruff.toml), project metadata (setup.py/setup.cfg)
cast() the single-task lookup in the test (tasks() returns a dict for a uuid),

add a targeted pyright ignore for the py2app options stub limitation,

and run pyright via pipenv so it resolves project imports.
@sonarqubecloud

Copy link
Copy Markdown

@AlexanderWillner
AlexanderWillner merged commit b166c40 into thingsapi:main Oct 26, 2026
5 checks passed
@mikez

mikez commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

@AlexanderWillner Two things:

  1. Some German comments made its way into the commit;
  2. Also you can move isort, pylint, pydocstyle into pyproject.toml as well... and the others can likely be handled by ruff... so the cfg file might go completely.

@mikez

mikez commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

@AlexanderWillner Also, now that we use pyproject.toml, we might be able to drop setup.py as well... by slightly rewriting some makefiles and workflows... I don't think we use py2app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants