diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b744c1d..838bc30 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,18 +13,13 @@ repos: args: [--autofix, --trailing-commas] - id: pretty-format-yaml args: [--autofix] -- repo: https://github.com/asottile/setup-cfg-fmt - rev: 9339507e9522e953c07479c9f6abeec0f2fe4e12 # frozen: v3.2.0 - hooks: - - id: setup-cfg-fmt - args: [--min-py-version, '3.12'] - repo: https://github.com/asottile/reorder-python-imports rev: 7885866bd38c852b5e042c4aeef0285d715ffeee # frozen: v3.16.0 hooks: - id: reorder-python-imports args: [--py312-plus, --add-import, from __future__ import annotations] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: 22f0422809455ec89ffdcf5a00170ba816e42ddb # frozen: v0.15.16 + rev: 3b3f7c3f57fe9925356faf5fe6230835138be230 # frozen: v0.15.17 hooks: - id: ruff-check args: [--fix] @@ -58,8 +53,24 @@ repos: - setuptools - tenacity language_version: python3.12 +- repo: https://github.com/mxr/mirrors-ty + rev: b0cc809b854427130bbdc84b922e0e38c6c6b8eb # frozen: v0.0.48 + hooks: + - id: ty + additional_dependencies: + - aiohttp>=3 + - aiopathlib + - aiosqlite + - asyncio-for-ynab~=1.84.0 + - coverage + - fasteners + - pytest + - pytest-asyncio + - rich>=10 + - setuptools + - tenacity - repo: https://github.com/mxr/sync-typing-deps - rev: 8e97e35c846b35976c59b973cd40690152b3c716 # frozen: v0.4.0 + rev: 34b664ec01850e0d9cb4fe97c1a03d8ed71f393c # frozen: v0.5.0 hooks: - id: sync-typing-deps - repo: https://github.com/zizmorcore/zizmor-pre-commit diff --git a/pyproject.toml b/pyproject.toml index 9a6de74..c94f0f5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,6 +2,49 @@ build-backend = "setuptools.build_meta" requires = ["setuptools"] +[dependency-groups] +dev = [ + "covdefaults>=2.1.0", + "coverage", + "pytest", + "pytest-asyncio", +] + +[project] +authors = [{name = "Max R", email = "mxr@users.noreply.github.com"}] +classifiers = [ + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", +] +dependencies = [ + "aiohttp>=3", + "aiopathlib", + "aiosqlite", + "asyncio-for-ynab~=1.84.0", + "fasteners", + "rich>=10", + "tenacity", +] +description = "SQLite Export for YNAB - Export YNAB Data to SQLite" +keywords = ["ynab", "sqlite", "sql", "budget", "plan", "cli"] +license = "MIT" +license-files = ["LICENSE"] +name = "sqlite_export_for_ynab" +readme = "README.md" +requires-python = ">=3.12" +version = "2.9.0" + +[project.scripts] +sqlite-export-for-ynab = "sqlite_export_for_ynab._main:main" + +[project.urls] +Homepage = "https://github.com/mxr/sqlite-export-for-ynab" + +[tool.coverage.run] +plugins = ["covdefaults"] + [tool.mypy] check_untyped_defs = true disallow_any_generics = true @@ -34,6 +77,13 @@ extend-select = [ "TC", # see flake8-type-checking ] +[tool.setuptools.package-data] +"*" = ["*.sql"] +sqlite_export_for_ynab = ["py.typed"] + +[tool.setuptools.packages] +find = {} + [tool.sqlfluff.layout.type.comma] line_position = "leading" spacing_before = "touch" @@ -65,3 +115,19 @@ require_final_semicolon = true [tool.sqlfluff.rules.references.quoting] prefer_quoted_keywords = true + +[tool.tox] +env_list = ["py", "pypy3", "pre-commit"] + +[tool.tox.env.pre-commit] +commands = [["pre-commit", "run", "--all-files", "--show-diff-on-failure"]] +deps = ["pre-commit-uv"] +skip_install = true + +[tool.tox.env_run_base] +commands = [ + ["coverage", "erase"], + ["coverage", "run", "-m", "pytest", "{posargs:tests}"], + ["coverage", "report"], +] +dependency_groups = ["dev"] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index b2155d8..0000000 --- a/setup.cfg +++ /dev/null @@ -1,66 +0,0 @@ -[metadata] -name = sqlite_export_for_ynab -version = 2.9.0 -description = SQLite Export for YNAB - Export YNAB Data to SQLite -long_description = file: README.md -long_description_content_type = text/markdown -url = https://github.com/mxr/sqlite-export-for-ynab -author = Max R -author_email = maxr@outlook.com -license = MIT -license_files = LICENSE -classifiers = - Programming Language :: Python :: 3 - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: Implementation :: CPython - Programming Language :: Python :: Implementation :: PyPy -keywords = ynab, sqlite, sql, budget, plan, cli - -[options] -packages = find: -install_requires = - aiohttp>=3 - aiopathlib - aiosqlite - asyncio-for-ynab~=1.84.0 - fasteners - rich>=10 - tenacity -python_requires = >=3.12 - -[options.entry_points] -console_scripts = - sqlite-export-for-ynab = sqlite_export_for_ynab._main:main - -[options.extras_require] -dev = - covdefaults>=2.1.0 - coverage - pytest - pytest-asyncio - -[options.package_data] -* = *.sql -sqlite_export_for_ynab = - py.typed - -[bdist_wheel] -universal = True - -[coverage:run] -plugins = covdefaults - -[tox:tox] -envlist = py,pypy3,pre-commit - -[testenv] -extras = dev -commands = - coverage erase - coverage run -m pytest {posargs:tests} - coverage report - -[testenv:pre-commit] -skip_install = true -deps = pre-commit-uv -commands = pre-commit run --all-files --show-diff-on-failure diff --git a/setup.py b/setup.py deleted file mode 100644 index a03590f..0000000 --- a/setup.py +++ /dev/null @@ -1,5 +0,0 @@ -from __future__ import annotations - -from setuptools import setup - -setup() diff --git a/tests/_main_test.py b/tests/_main_test.py index 7782a08..19b1f44 100644 --- a/tests/_main_test.py +++ b/tests/_main_test.py @@ -1,6 +1,6 @@ from __future__ import annotations -from configparser import ConfigParser +import tomllib from pathlib import Path from unittest.mock import AsyncMock from unittest.mock import Mock @@ -875,9 +875,9 @@ async def test_async_main_parses_full_refresh_and_quiet(sync, tmp_path, monkeypa def test_main_version(capsys): - cp = ConfigParser() - cp.read(Path(__file__).parent.parent / "setup.cfg") - expected_version = cp["metadata"]["version"] + with open(Path(__file__).parent.parent / "pyproject.toml", "rb") as f: + data = tomllib.load(f) + expected_version = data["project"]["version"] with pytest.raises(SystemExit) as excinfo: main(("--version",))