diff --git a/.github/workflows/check_build_publish.yaml b/.github/workflows/check_build_publish.yaml index e70613a..3dc374e 100644 --- a/.github/workflows/check_build_publish.yaml +++ b/.github/workflows/check_build_publish.yaml @@ -46,13 +46,12 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install mypy From Locked Dependencies - run: uv sync --python ${{ matrix.python-version }} --no-python-downloads - --only-group type-check --frozen + run: uv sync --python ${{ matrix.python-version }} --no-python-downloads --only-group + type-check --frozen - name: Save Hashed Python Version - run: echo "HASHED_PYTHON_VERSION=$(uv run --no-sync --no-python-downloads - --python ${{ matrix.python-version }} python -VV | sha256sum - | cut -d' ' -f1)" >> $GITHUB_ENV + run: echo "HASHED_PYTHON_VERSION=$(uv run --no-sync --no-python-downloads --python + ${{ matrix.python-version }} python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV - uses: actions/cache@v4 with: @@ -60,8 +59,8 @@ jobs: key: mypy|${{ env.HASHED_PYTHON_VERSION }} - name: Run mypy - run: uv run --python ${{ matrix.python-version }} --no-sync --no-python-downloads - mypy . + run: uv run --python ${{ matrix.python-version }} --no-sync --no-python-downloads mypy + . pre-commit: needs: uv-check @@ -85,9 +84,8 @@ jobs: run: uv sync --no-python-downloads --only-group pre-commit --frozen - name: Save Hashed Python Version - run: echo "HASHED_PYTHON_VERSION=$(uv run --no-sync --no-python-downloads - --python ${{ matrix.python-version }} python -VV | sha256sum - | cut -d' ' -f1)" >> $GITHUB_ENV + run: echo "HASHED_PYTHON_VERSION=$(uv run --no-sync --no-python-downloads --python + ${{ matrix.python-version }} python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV - uses: actions/cache@v4 with: @@ -102,8 +100,8 @@ jobs: >> $GITHUB_ENV - name: Run pre-commit - run: uv run --no-sync --no-python-downloads pre-commit run --all-files - --hook-stage manual + run: uv run --no-sync --no-python-downloads pre-commit run --all-files --hook-stage + manual pytest: needs: uv-check @@ -128,13 +126,12 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install pytest From Locked Dependencies - run: uv sync --python ${{ matrix.python-version }} --no-python-downloads - --only-group test --frozen + run: uv sync --python ${{ matrix.python-version }} --no-python-downloads --only-group + test --frozen - name: Save Hashed Python Version - run: echo "HASHED_PYTHON_VERSION=$(uv run --no-sync --no-python-downloads - --python ${{ matrix.python-version }} python -VV | sha256sum - | cut -d' ' -f1)" >> $GITHUB_ENV + run: echo "HASHED_PYTHON_VERSION=$(uv run --no-sync --no-python-downloads --python + ${{ matrix.python-version }} python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV - uses: actions/cache@v4 with: @@ -142,8 +139,7 @@ jobs: key: pytest|${{ env.HASHED_PYTHON_VERSION }} - name: Run pytest - run: uv run --python ${{ matrix.python-version }} --no-sync --no-python-downloads - pytest + run: uv run --python ${{ matrix.python-version }} --no-sync --no-python-downloads pytest ruff: needs: uv-check @@ -168,13 +164,12 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install ruff From Locked Dependencies - run: uv sync --python ${{ matrix.python-version }} --no-python-downloads - --only-group lint --frozen + run: uv sync --python ${{ matrix.python-version }} --no-python-downloads --only-group + lint --frozen - name: Save Hashed Python Version - run: echo "HASHED_PYTHON_VERSION=$(uv run --no-sync --no-python-downloads - --python ${{ matrix.python-version }} python -VV | sha256sum - | cut -d' ' -f1)" >> $GITHUB_ENV + run: echo "HASHED_PYTHON_VERSION=$(uv run --no-sync --no-python-downloads --python + ${{ matrix.python-version }} python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV - uses: actions/cache@v4 with: @@ -182,8 +177,8 @@ jobs: key: ruff|${{ env.HASHED_PYTHON_VERSION }} - name: Run Ruff - run: uv run --python ${{ matrix.python-version }} --no-sync --no-python-downloads - ruff check --output-format=github + run: uv run --python ${{ matrix.python-version }} --no-sync --no-python-downloads ruff + check --output-format=github taplo-format: runs-on: ubuntu-latest @@ -197,9 +192,11 @@ jobs: enable-cache: true cache-dependency-glob: uv.lock + - name: Install Taplo From Locked Dependencies + run: uv sync --no-python-downloads --only-group lint-format --frozen + - name: Run Taplo Formatter - run: uvx taplo format . --check --option reorder_arrays=true --option - reorder_keys=true --option "indent_string= " + run: uv run taplo format . --check taplo-lint: runs-on: ubuntu-latest @@ -213,8 +210,11 @@ jobs: enable-cache: true cache-dependency-glob: uv.lock + - name: Install Taplo From Locked Dependencies + run: uv sync --no-python-downloads --only-group lint-format --frozen + - name: Run Taplo Linter - run: uvx taplo lint . --default-schema-catalogs + run: uv run taplo lint . --default-schema-catalogs yamlfmt: runs-on: ubuntu-latest @@ -231,10 +231,7 @@ jobs: run: go install github.com/google/yamlfmt/cmd/yamlfmt@latest - name: Run yamlfmt - run: yamlfmt . -lint -formatter indent=4 -formatter line_ending=lf - -formatter disallow_anchors=true -formatter max_line_length=75 - -formatter trim_trailing_whitespace=true -formatter eof_newline=true - -formatter retain_line_breaks_single=true -formatter pad_line_comments=2 + run: yamlfmt . -lint build: needs: [mypy, pre-commit, pytest, ruff, taplo-format, taplo-lint, yamlfmt] @@ -338,11 +335,11 @@ jobs: - name: Create GitHub Release env: GITHUB_TOKEN: ${{ github.token }} - run: gh release create '${{ github.ref_name }}' --repo '${{ github.repository - }}' --notes "" + run: gh release create '${{ github.ref_name }}' --repo '${{ github.repository }}' --notes + "" - name: Add Signed Build Artifacts To GitHub Release env: GITHUB_TOKEN: ${{ github.token }} - run: gh release upload '${{ github.ref_name }}' dist/** --repo - '${{ github.repository }}' + run: gh release upload '${{ github.ref_name }}' dist/** --repo '${{ github.repository + }}' diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8984465..8454cbe 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -56,8 +56,6 @@ repos: rev: v0.9.3 hooks: - id: taplo-format - args: [--option, 'indent_string= ', --option, reorder_arrays=true, - --option, reorder_keys=true] - id: taplo-lint args: [--default-schema-catalogs] @@ -80,7 +78,3 @@ repos: rev: v0.14.0 hooks: - id: yamlfmt - args: [-formatter, indent=4, -formatter, line_ending=lf, -formatter, - disallow_anchors=true, -formatter, max_line_length=75, -formatter, - trim_trailing_whitespace=true, -formatter, eof_newline=true, -formatter, - retain_line_breaks_single=true, -formatter, pad_line_comments=2] diff --git a/.taplo.toml b/.taplo.toml new file mode 100644 index 0000000..c380200 --- /dev/null +++ b/.taplo.toml @@ -0,0 +1,6 @@ +[formatting] +column_width = 95 +indent_string = " " +reorder_arrays = true +reorder_inline_tables = true +reorder_keys = true diff --git a/.yamlfmt.yaml b/.yamlfmt.yaml new file mode 100644 index 0000000..c00dbf7 --- /dev/null +++ b/.yamlfmt.yaml @@ -0,0 +1,10 @@ +line_ending: lf +gitignore_excludes: true +formatter: + indent: 4 + retain_line_breaks_single: true + disallow_anchors: true + max_line_length: 95 + trim_trailing_whitespace: true + eof_newline: true + pad_line_comments: 2 diff --git a/pyproject.toml b/pyproject.toml index 0acd542..6f3a701 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,12 +4,12 @@ requires = ["hatch-docstring-description", "hatch-vcs", "hatchling"] [dependency-groups] dev = [ - { include-group = "lint" }, + { include-group = "lint-format" }, { include-group = "pre-commit" }, { include-group = "test" }, { include-group = "type-check" }, ] -lint = ["ruff>=0.4"] +lint-format = ["ruff>=0.4", "taplo"] pre-commit = ["pre-commit"] test = ["pytest"] type-check = ["mypy>=1.10"] @@ -33,8 +33,7 @@ classifiers = [ "Topic :: Software Development", "Typing :: Typed", ] -description = "Typed decorators for classproperty and cached_classproperty." -dynamic = ["version"] +dynamic = ["description", "version"] keywords = ["classmethod", "decorator", "property"] maintainers = [{ name = "Matt Norton", email = "matt@carrotmanmatt.com" }] name = "typed_classproperties" @@ -48,6 +47,8 @@ Repository = "https://github.com/CarrotManMatt/typed_classproperties" [tool.hatch.build] only-packages = true +[tool.hatch.metadata.hooks.docstring-description] + [tool.hatch.version] raw-options = { local_scheme = "no-local-version", version_scheme = "python-simplified-semver" } source = "vcs" @@ -73,11 +74,14 @@ warn_unused_ignores = true python_files = "tests.py" [tool.ruff] +indent-width = 4 line-length = 95 [tool.ruff.format] docstring-code-format = true +indent-style = "space" line-ending = "lf" +quote-style = "double" skip-magic-trailing-comma = true [tool.ruff.lint] @@ -87,14 +91,17 @@ ignore = [ "C90", "COM812", "COM819", + "CPY", "D206", - "D207", - "D208", "D212", - "D300", - "E111", - "E114", - "E117", + "DJ", + "FA", + "FAST", + "INP001", + "ISC001", + "ISC002", + "N806", + "PD", "PIE808", "Q000", "Q001", @@ -106,76 +113,8 @@ ignore = [ "TD003", "W191", ] -select = [ - "A", - "ANN", - "ARG", - "ASYNC", - "B", - "BLE", - "C", - "COM", - "D", - "D204", - "D213", - "D400", - "D401", - "D404", - "DOC", - "DTZ", - "E", - "EM", - "ERA", - "EXE", - "F", - "FBT", - "FIX", - "FLY", - "FURB", - "G", - "I", - "ICN", - "INP", - "INT", - "ISC", - "LOG", - "N", - "PERF", - "PGH", - "PIE", - "PL", - "PT", - "PTH", - "PYI", - "Q", - "RET", - "RSE", - "RUF", - "S", - "SIM", - "SLF", - "SLOT", - "T", - "TCH", - "TD", - "TID", - "TRY", - "UP", - "W", - "YTT", -] -task-tags = [ - "BUG", - "DONE", - "FIXME", - "HACK", - "IDEA", - "ISSUE", - "NOBUG", - "NOTE", - "REQ", - "TODO", -] +select = ["ALL", "D204", "D213", "D401"] +task-tags = ["BUG", "DONE", "FIXME", "HACK", "IDEA", "ISSUE", "NOBUG", "NOTE", "REQ", "TODO"] [tool.ruff.lint.flake8-pytest-style] fixture-parentheses = true @@ -191,8 +130,6 @@ strict = true [tool.ruff.lint.pep8-naming] classmethod-decorators = [ - "classproperties.cached_classproperty", - "classproperties.classproperty", "typed_classproperties.cached_classproperty", "typed_classproperties.classproperty", ] @@ -215,8 +152,6 @@ max-doc-length = 95 [tool.ruff.lint.pydocstyle] convention = "google" property-decorators = [ - "classproperties.cached_classproperty", - "classproperties.classproperty", "typed_classproperties.cached_classproperty", "typed_classproperties.classproperty", ] diff --git a/uv.lock b/uv.lock index 7d27335..e9ba848 100644 --- a/uv.lock +++ b/uv.lock @@ -259,6 +259,20 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/7f/7b/c920673ac01c19814dd15fc617c02301c522f3d6812ca2024f4588ed4549/ruff-0.7.2-py3-none-win_arm64.whl", hash = "sha256:bb8368cd45bba3f57bb29cbb8d64b4a33f8415d0149d2655c5c8539452ce7760", size = 8735845 }, ] +[[package]] +name = "taplo" +version = "0.9.3" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/71/79/513513960377e1212a28446acb323cf77dfce162e825a822f035b02a422d/taplo-0.9.3.tar.gz", hash = "sha256:6b73b45b9adbd20189d8981ac9055d5465227c58bbe1b0646a7588a1a5c07a1a", size = 102556 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/61/42/a93c18ebb7cf3ee2a7a30dd2fda654aca458956c3b64bdfb9d82b2c42679/taplo-0.9.3-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:1c3db689406d538420c64aa779ac8694cf44c13a46e158d6df406de65980b9c7", size = 4248497 }, + { url = "https://files.pythonhosted.org/packages/82/d2/f5b6e4a4f474f9fe613b5b91012520c3f62e46748a6ce9fd61fc2fb52fa2/taplo-0.9.3-py3-none-macosx_11_0_arm64.whl", hash = "sha256:1e7782f33f97e7aa658d18788748bce5cf3ce440eeb419cf5861cf542740e610", size = 4044421 }, + { url = "https://files.pythonhosted.org/packages/7d/32/4ac46ff15bb9d060f50ad31fb3a80aa8ee1e6ca500104ca8569f6fbdee3d/taplo-0.9.3-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:29d4d7abfcc10bd536e5a43fe6ec2c1931507c1433e79df03ea22e1030611cb6", size = 4334420 }, + { url = "https://files.pythonhosted.org/packages/ef/cc/656aed22a59cf4c50dcaaa66aaa570d4a1412acdd8ea429120a6bb00f336/taplo-0.9.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:33f12648f273478d7330cb3529c82f48f388501e1122e0bea78bce5ff5972b8b", size = 4468935 }, + { url = "https://files.pythonhosted.org/packages/21/15/d8db1db6382b444122fa1a66fe5fe0dd5b04bfbe68c74bdb5345aec11eb2/taplo-0.9.3-py3-none-win32.whl", hash = "sha256:9ab7df76a3facc6d0dd2fe2dae3e8eb52fa458d31d27878d5eac14f5cbc0abac", size = 3482612 }, + { url = "https://files.pythonhosted.org/packages/42/3c/df6641d7e2e84a6dd4de3b3a4426db7f6a7270c05bbdeadd523645c9c45f/taplo-0.9.3-py3-none-win_amd64.whl", hash = "sha256:7d80b630b93fb43cee99d1e1ee07b616236dc5615efaf7cd51074b4cffc33bab", size = 3985843 }, +] + [[package]] name = "tomli" version = "2.0.2" @@ -270,7 +284,7 @@ wheels = [ [[package]] name = "typed-classproperties" -version = "0.2.2.dev4" +version = "1.0.3.dev0" source = { editable = "." } [package.dev-dependencies] @@ -279,9 +293,11 @@ dev = [ { name = "pre-commit" }, { name = "pytest" }, { name = "ruff" }, + { name = "taplo" }, ] -lint = [ +lint-format = [ { name = "ruff" }, + { name = "taplo" }, ] pre-commit = [ { name = "pre-commit" }, @@ -301,8 +317,12 @@ dev = [ { name = "pre-commit" }, { name = "pytest" }, { name = "ruff", specifier = ">=0.4" }, + { name = "taplo" }, +] +lint-format = [ + { name = "ruff", specifier = ">=0.4" }, + { name = "taplo" }, ] -lint = [{ name = "ruff", specifier = ">=0.4" }] pre-commit = [{ name = "pre-commit" }] test = [{ name = "pytest" }] type-check = [{ name = "mypy", specifier = ">=1.10" }]