From 1d523ed6b2ef427d4e3c0095b41b0a76f00ac711 Mon Sep 17 00:00:00 2001 From: Thomas M Kehrenberg Date: Fri, 23 Feb 2024 16:39:13 +0100 Subject: [PATCH 1/5] Switch to rye --- .github/workflows/ci.yml | 50 +++++--------- make_release.sh | 10 +-- pyproject.toml | 11 +++ requirements-dev.lock | 18 +++++ requirements.lock | 17 +++++ type-enum-plugin/poetry.lock | 99 --------------------------- type-enum-plugin/pyproject.toml | 39 +++++++---- type-enum/poetry.lock | 116 -------------------------------- type-enum/pyproject.toml | 46 ++++++++----- 9 files changed, 124 insertions(+), 282 deletions(-) create mode 100644 pyproject.toml create mode 100644 requirements-dev.lock create mode 100644 requirements.lock delete mode 100644 type-enum-plugin/poetry.lock delete mode 100644 type-enum/poetry.lock diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 22e7651..0c8c6ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,7 @@ on: branches: - main merge_group: + jobs: lint_with_ruff: @@ -19,22 +20,15 @@ jobs: working-directory: ${{ matrix.directory }} steps: - - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.11' - - name: Install ruff - run: | - python -m pip install --upgrade pip - pip install ruff - - name: Lint with ruff - run: | - ruff check --output-format=github type_enum* - - name: Format with ruff - run: | - ruff format --check type_enum* - + - uses: actions/checkout@v3 + - name: Install rye + uses: eifinger/setup-rye@v1 + - name: Lint with ruff + run: | + rye lint -- --output-format=github + - name: Format with ruff + run: | + rye fmt -- --diff type_enum* run_tests: runs-on: ubuntu-latest @@ -45,19 +39,15 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Install poetry - run: pipx install poetry - - uses: actions/setup-python@v4 - with: - python-version: '3.11' + - name: Install rye + uses: eifinger/setup-rye@v1 - name: Install dependencies run: | - poetry env use 3.11 - poetry install --no-interaction --no-root + rye sync --no-lock - name: Run tests run: | - poetry run python -m unittest -v + rye run test -v type_check: runs-on: ubuntu-latest @@ -68,16 +58,12 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Install poetry - run: pipx install poetry - - uses: actions/setup-python@v4 - with: - python-version: '3.11' + - name: Install rye + uses: eifinger/setup-rye@v1 - name: Install dependencies run: | - poetry env use 3.11 - poetry install --no-interaction --no-root + rye sync --no-lock - name: Run type check run: | - poetry run mypy tests + rye run mypy diff --git a/make_release.sh b/make_release.sh index 96f2534..e18218c 100755 --- a/make_release.sh +++ b/make_release.sh @@ -7,7 +7,7 @@ set -e version_bump=$1 case $version_bump in - "patch" | "minor" | "major" | "prepatch" | "preminor" | "premajor" | "prerelease") + "patch" | "minor" | "major") echo "valid version bump: $version_bump" ;; *) @@ -47,7 +47,7 @@ bump_build_publish() { echo "#######################################" echo "# bump version #" echo "#######################################" - poetry version $version_bump + rye version -b $version_bump echo "#######################################" echo "# stage pyroject.toml #" @@ -57,7 +57,7 @@ bump_build_publish() { echo "#######################################" echo "# do new build #" echo "#######################################" - poetry build + rye build echo "" echo "#######################################" @@ -65,7 +65,7 @@ bump_build_publish() { echo "#######################################" # to use this, set up an API token with # `poetry config pypi-token.pypi ` - poetry publish + rye publish echo "#######################################" echo "# leaving '$1' #" @@ -80,7 +80,7 @@ bump_build_publish "type-enum-plugin" # get the version from 'type_enum' pushd type-enum -new_version=$(poetry version -s) +new_version=$(rye version) popd echo "#######################################" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..cf63b93 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,11 @@ +[project] +name = "type-enum-workspace" +version = "0.0.0" +requires-python = ">= 3.11" + +[tool.rye] +managed = true +virtual = true + +[tool.rye.workspace] +members = ["type-enum*"] diff --git a/requirements-dev.lock b/requirements-dev.lock new file mode 100644 index 0000000..08f346a --- /dev/null +++ b/requirements-dev.lock @@ -0,0 +1,18 @@ +# generated by rye +# use `rye lock` or `rye sync` to update this lockfile +# +# last locked with the following flags: +# pre: false +# features: [] +# all-features: false +# with-sources: false + +-e file:type-enum +-e file:type-enum-plugin +mypy==1.8.0 + # via type-enum-plugin +mypy-extensions==1.0.0 + # via mypy +ruff==0.2.2 +typing-extensions==4.9.0 + # via mypy diff --git a/requirements.lock b/requirements.lock new file mode 100644 index 0000000..9d5d250 --- /dev/null +++ b/requirements.lock @@ -0,0 +1,17 @@ +# generated by rye +# use `rye lock` or `rye sync` to update this lockfile +# +# last locked with the following flags: +# pre: false +# features: [] +# all-features: false +# with-sources: false + +-e file:type-enum +-e file:type-enum-plugin +mypy==1.8.0 + # via type-enum-plugin +mypy-extensions==1.0.0 + # via mypy +typing-extensions==4.9.0 + # via mypy diff --git a/type-enum-plugin/poetry.lock b/type-enum-plugin/poetry.lock deleted file mode 100644 index 25cfff5..0000000 --- a/type-enum-plugin/poetry.lock +++ /dev/null @@ -1,99 +0,0 @@ -# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand. - -[[package]] -name = "mypy" -version = "1.5.1" -description = "Optional static typing for Python" -optional = false -python-versions = ">=3.8" -files = [ - {file = "mypy-1.5.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:f33592ddf9655a4894aef22d134de7393e95fcbdc2d15c1ab65828eee5c66c70"}, - {file = "mypy-1.5.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:258b22210a4a258ccd077426c7a181d789d1121aca6db73a83f79372f5569ae0"}, - {file = "mypy-1.5.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a9ec1f695f0c25986e6f7f8778e5ce61659063268836a38c951200c57479cc12"}, - {file = "mypy-1.5.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:abed92d9c8f08643c7d831300b739562b0a6c9fcb028d211134fc9ab20ccad5d"}, - {file = "mypy-1.5.1-cp310-cp310-win_amd64.whl", hash = "sha256:a156e6390944c265eb56afa67c74c0636f10283429171018446b732f1a05af25"}, - {file = "mypy-1.5.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:6ac9c21bfe7bc9f7f1b6fae441746e6a106e48fc9de530dea29e8cd37a2c0cc4"}, - {file = "mypy-1.5.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:51cb1323064b1099e177098cb939eab2da42fea5d818d40113957ec954fc85f4"}, - {file = "mypy-1.5.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:596fae69f2bfcb7305808c75c00f81fe2829b6236eadda536f00610ac5ec2243"}, - {file = "mypy-1.5.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:32cb59609b0534f0bd67faebb6e022fe534bdb0e2ecab4290d683d248be1b275"}, - {file = "mypy-1.5.1-cp311-cp311-win_amd64.whl", hash = "sha256:159aa9acb16086b79bbb0016145034a1a05360626046a929f84579ce1666b315"}, - {file = "mypy-1.5.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:f6b0e77db9ff4fda74de7df13f30016a0a663928d669c9f2c057048ba44f09bb"}, - {file = "mypy-1.5.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:26f71b535dfc158a71264e6dc805a9f8d2e60b67215ca0bfa26e2e1aa4d4d373"}, - {file = "mypy-1.5.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2fc3a600f749b1008cc75e02b6fb3d4db8dbcca2d733030fe7a3b3502902f161"}, - {file = "mypy-1.5.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:26fb32e4d4afa205b24bf645eddfbb36a1e17e995c5c99d6d00edb24b693406a"}, - {file = "mypy-1.5.1-cp312-cp312-win_amd64.whl", hash = "sha256:82cb6193de9bbb3844bab4c7cf80e6227d5225cc7625b068a06d005d861ad5f1"}, - {file = "mypy-1.5.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:4a465ea2ca12804d5b34bb056be3a29dc47aea5973b892d0417c6a10a40b2d65"}, - {file = "mypy-1.5.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:9fece120dbb041771a63eb95e4896791386fe287fefb2837258925b8326d6160"}, - {file = "mypy-1.5.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d28ddc3e3dfeab553e743e532fb95b4e6afad51d4706dd22f28e1e5e664828d2"}, - {file = "mypy-1.5.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:57b10c56016adce71fba6bc6e9fd45d8083f74361f629390c556738565af8eeb"}, - {file = "mypy-1.5.1-cp38-cp38-win_amd64.whl", hash = "sha256:ff0cedc84184115202475bbb46dd99f8dcb87fe24d5d0ddfc0fe6b8575c88d2f"}, - {file = "mypy-1.5.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:8f772942d372c8cbac575be99f9cc9d9fb3bd95c8bc2de6c01411e2c84ebca8a"}, - {file = "mypy-1.5.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:5d627124700b92b6bbaa99f27cbe615c8ea7b3402960f6372ea7d65faf376c14"}, - {file = "mypy-1.5.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:361da43c4f5a96173220eb53340ace68cda81845cd88218f8862dfb0adc8cddb"}, - {file = "mypy-1.5.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:330857f9507c24de5c5724235e66858f8364a0693894342485e543f5b07c8693"}, - {file = "mypy-1.5.1-cp39-cp39-win_amd64.whl", hash = "sha256:c543214ffdd422623e9fedd0869166c2f16affe4ba37463975043ef7d2ea8770"}, - {file = "mypy-1.5.1-py3-none-any.whl", hash = "sha256:f757063a83970d67c444f6e01d9550a7402322af3557ce7630d3c957386fa8f5"}, - {file = "mypy-1.5.1.tar.gz", hash = "sha256:b031b9601f1060bf1281feab89697324726ba0c0bae9d7cd7ab4b690940f0b92"}, -] - -[package.dependencies] -mypy-extensions = ">=1.0.0" -typing-extensions = ">=4.1.0" - -[package.extras] -dmypy = ["psutil (>=4.0)"] -install-types = ["pip"] -reports = ["lxml"] - -[[package]] -name = "mypy-extensions" -version = "1.0.0" -description = "Type system extensions for programs checked with the mypy type checker." -optional = false -python-versions = ">=3.5" -files = [ - {file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"}, - {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, -] - -[[package]] -name = "ruff" -version = "0.0.292" -description = "An extremely fast Python linter, written in Rust." -optional = false -python-versions = ">=3.7" -files = [ - {file = "ruff-0.0.292-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:02f29db018c9d474270c704e6c6b13b18ed0ecac82761e4fcf0faa3728430c96"}, - {file = "ruff-0.0.292-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:69654e564342f507edfa09ee6897883ca76e331d4bbc3676d8a8403838e9fade"}, - {file = "ruff-0.0.292-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6c3c91859a9b845c33778f11902e7b26440d64b9d5110edd4e4fa1726c41e0a4"}, - {file = "ruff-0.0.292-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:f4476f1243af2d8c29da5f235c13dca52177117935e1f9393f9d90f9833f69e4"}, - {file = "ruff-0.0.292-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:be8eb50eaf8648070b8e58ece8e69c9322d34afe367eec4210fdee9a555e4ca7"}, - {file = "ruff-0.0.292-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:9889bac18a0c07018aac75ef6c1e6511d8411724d67cb879103b01758e110a81"}, - {file = "ruff-0.0.292-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:6bdfabd4334684a4418b99b3118793f2c13bb67bf1540a769d7816410402a205"}, - {file = "ruff-0.0.292-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:aa7c77c53bfcd75dbcd4d1f42d6cabf2485d2e1ee0678da850f08e1ab13081a8"}, - {file = "ruff-0.0.292-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8e087b24d0d849c5c81516ec740bf4fd48bf363cfb104545464e0fca749b6af9"}, - {file = "ruff-0.0.292-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:f160b5ec26be32362d0774964e218f3fcf0a7da299f7e220ef45ae9e3e67101a"}, - {file = "ruff-0.0.292-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:ac153eee6dd4444501c4bb92bff866491d4bfb01ce26dd2fff7ca472c8df9ad0"}, - {file = "ruff-0.0.292-py3-none-musllinux_1_2_i686.whl", hash = "sha256:87616771e72820800b8faea82edd858324b29bb99a920d6aa3d3949dd3f88fb0"}, - {file = "ruff-0.0.292-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:b76deb3bdbea2ef97db286cf953488745dd6424c122d275f05836c53f62d4016"}, - {file = "ruff-0.0.292-py3-none-win32.whl", hash = "sha256:e854b05408f7a8033a027e4b1c7f9889563dd2aca545d13d06711e5c39c3d003"}, - {file = "ruff-0.0.292-py3-none-win_amd64.whl", hash = "sha256:f27282bedfd04d4c3492e5c3398360c9d86a295be00eccc63914438b4ac8a83c"}, - {file = "ruff-0.0.292-py3-none-win_arm64.whl", hash = "sha256:7f67a69c8f12fbc8daf6ae6d36705037bde315abf8b82b6e1f4c9e74eb750f68"}, - {file = "ruff-0.0.292.tar.gz", hash = "sha256:1093449e37dd1e9b813798f6ad70932b57cf614e5c2b5c51005bf67d55db33ac"}, -] - -[[package]] -name = "typing-extensions" -version = "4.5.0" -description = "Backported and Experimental Type Hints for Python 3.7+" -optional = false -python-versions = ">=3.7" -files = [ - {file = "typing_extensions-4.5.0-py3-none-any.whl", hash = "sha256:fb33085c39dd998ac16d1431ebc293a8b3eedd00fd4a32de0ff79002c19511b4"}, - {file = "typing_extensions-4.5.0.tar.gz", hash = "sha256:5cb5f4a79139d699607b3ef622a1dedafa84e115ab0024e0d9c044a9479ca7cb"}, -] - -[metadata] -lock-version = "2.0" -python-versions = "^3.11" -content-hash = "e958ee12c1f8dec3637379d5440535a3244eb503f08f5e0996c3390b4c82abe1" diff --git a/type-enum-plugin/pyproject.toml b/type-enum-plugin/pyproject.toml index ecbf78e..620d065 100644 --- a/type-enum-plugin/pyproject.toml +++ b/type-enum-plugin/pyproject.toml @@ -1,34 +1,45 @@ -[tool.poetry] +[project] name = "type-enum-plugin" version = "0.3.1a0" description = "Mypy plugin for type-enum." -authors = ["Thomas MK "] -license = "Apache License 2.0" +authors = [ + { name = "Thomas MK", email = "tmke8@posteo.net" }, +] +license = { text = "Apache-2.0" } readme = "README.md" -packages = [{ include = "type_enum_plugin" }] +# packages = [{ include = "type_enum_plugin" }] classifiers = [ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", ] -repository = "https://github.com/tmke8/type_enum" +requires-python = ">=3.11" +dependencies = [ + "mypy", +] -[tool.poetry.dependencies] -python = "^3.11" -mypy = "*" +[project.urls] +Documentation = "https://github.com/tmke8/type-enum#readme" +Issues = "https://github.com/tmke8/type-enum/issues" +Source = "https://github.com/tmke8/type-enum" -[tool.poetry.group.dev.dependencies] -mypy = "^1.5" -ruff = ">=0.0.292" +[tool.rye] +managed = true +dev-dependencies = ["mypy >= 1.5", "ruff >= 0.0.292"] + +[tool.rye.scripts] +mypyc = "mypy tests" [tool.ruff] line-length = 88 + +[tool.ruff.lint] select = [ "I", # isort ] -[tool.ruff.isort] +[tool.ruff.lint.isort] known-third-party = ["mypy", "pytest"] extra-standard-library = ["typing_extensions"] no-lines-before = ["future", "standard-library"] @@ -37,5 +48,5 @@ split-on-trailing-comma = false classes = ["MDEF"] [build-system] -requires = ["poetry-core"] -build-backend = "poetry.core.masonry.api" +requires = ["hatchling"] +build-backend = "hatchling.build" diff --git a/type-enum/poetry.lock b/type-enum/poetry.lock deleted file mode 100644 index 35ff902..0000000 --- a/type-enum/poetry.lock +++ /dev/null @@ -1,116 +0,0 @@ -# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. - -[[package]] -name = "mypy" -version = "1.7.1" -description = "Optional static typing for Python" -optional = false -python-versions = ">=3.8" -files = [ - {file = "mypy-1.7.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:12cce78e329838d70a204293e7b29af9faa3ab14899aec397798a4b41be7f340"}, - {file = "mypy-1.7.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:1484b8fa2c10adf4474f016e09d7a159602f3239075c7bf9f1627f5acf40ad49"}, - {file = "mypy-1.7.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:31902408f4bf54108bbfb2e35369877c01c95adc6192958684473658c322c8a5"}, - {file = "mypy-1.7.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:f2c2521a8e4d6d769e3234350ba7b65ff5d527137cdcde13ff4d99114b0c8e7d"}, - {file = "mypy-1.7.1-cp310-cp310-win_amd64.whl", hash = "sha256:fcd2572dd4519e8a6642b733cd3a8cfc1ef94bafd0c1ceed9c94fe736cb65b6a"}, - {file = "mypy-1.7.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:4b901927f16224d0d143b925ce9a4e6b3a758010673eeded9b748f250cf4e8f7"}, - {file = "mypy-1.7.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:2f7f6985d05a4e3ce8255396df363046c28bea790e40617654e91ed580ca7c51"}, - {file = "mypy-1.7.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:944bdc21ebd620eafefc090cdf83158393ec2b1391578359776c00de00e8907a"}, - {file = "mypy-1.7.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:9c7ac372232c928fff0645d85f273a726970c014749b924ce5710d7d89763a28"}, - {file = "mypy-1.7.1-cp311-cp311-win_amd64.whl", hash = "sha256:f6efc9bd72258f89a3816e3a98c09d36f079c223aa345c659622f056b760ab42"}, - {file = "mypy-1.7.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:6dbdec441c60699288adf051f51a5d512b0d818526d1dcfff5a41f8cd8b4aaf1"}, - {file = "mypy-1.7.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:4fc3d14ee80cd22367caaaf6e014494415bf440980a3045bf5045b525680ac33"}, - {file = "mypy-1.7.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2c6e4464ed5f01dc44dc9821caf67b60a4e5c3b04278286a85c067010653a0eb"}, - {file = "mypy-1.7.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:d9b338c19fa2412f76e17525c1b4f2c687a55b156320acb588df79f2e6fa9fea"}, - {file = "mypy-1.7.1-cp312-cp312-win_amd64.whl", hash = "sha256:204e0d6de5fd2317394a4eff62065614c4892d5a4d1a7ee55b765d7a3d9e3f82"}, - {file = "mypy-1.7.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:84860e06ba363d9c0eeabd45ac0fde4b903ad7aa4f93cd8b648385a888e23200"}, - {file = "mypy-1.7.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:8c5091ebd294f7628eb25ea554852a52058ac81472c921150e3a61cdd68f75a7"}, - {file = "mypy-1.7.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:40716d1f821b89838589e5b3106ebbc23636ffdef5abc31f7cd0266db936067e"}, - {file = "mypy-1.7.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:5cf3f0c5ac72139797953bd50bc6c95ac13075e62dbfcc923571180bebb662e9"}, - {file = "mypy-1.7.1-cp38-cp38-win_amd64.whl", hash = "sha256:78e25b2fd6cbb55ddfb8058417df193f0129cad5f4ee75d1502248e588d9e0d7"}, - {file = "mypy-1.7.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:75c4d2a6effd015786c87774e04331b6da863fc3fc4e8adfc3b40aa55ab516fe"}, - {file = "mypy-1.7.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:2643d145af5292ee956aa0a83c2ce1038a3bdb26e033dadeb2f7066fb0c9abce"}, - {file = "mypy-1.7.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:75aa828610b67462ffe3057d4d8a4112105ed211596b750b53cbfe182f44777a"}, - {file = "mypy-1.7.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:ee5d62d28b854eb61889cde4e1dbc10fbaa5560cb39780c3995f6737f7e82120"}, - {file = "mypy-1.7.1-cp39-cp39-win_amd64.whl", hash = "sha256:72cf32ce7dd3562373f78bd751f73c96cfb441de147cc2448a92c1a308bd0ca6"}, - {file = "mypy-1.7.1-py3-none-any.whl", hash = "sha256:f7c5d642db47376a0cc130f0de6d055056e010debdaf0707cd2b0fc7e7ef30ea"}, - {file = "mypy-1.7.1.tar.gz", hash = "sha256:fcb6d9afb1b6208b4c712af0dafdc650f518836065df0d4fb1d800f5d6773db2"}, -] - -[package.dependencies] -mypy-extensions = ">=1.0.0" -typing-extensions = ">=4.1.0" - -[package.extras] -dmypy = ["psutil (>=4.0)"] -install-types = ["pip"] -mypyc = ["setuptools (>=50)"] -reports = ["lxml"] - -[[package]] -name = "mypy-extensions" -version = "1.0.0" -description = "Type system extensions for programs checked with the mypy type checker." -optional = false -python-versions = ">=3.5" -files = [ - {file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"}, - {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, -] - -[[package]] -name = "ruff" -version = "0.0.254" -description = "An extremely fast Python linter, written in Rust." -optional = false -python-versions = ">=3.7" -files = [ - {file = "ruff-0.0.254-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:dd58c500d039fb381af8d861ef456c3e94fd6855c3d267d6c6718c9a9fe07be0"}, - {file = "ruff-0.0.254-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:688379050ae05394a6f9f9c8471587fd5dcf22149bd4304a4ede233cc4ef89a1"}, - {file = "ruff-0.0.254-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ac1429be6d8bd3db0bf5becac3a38bd56f8421447790c50599cd90fd53417ec4"}, - {file = "ruff-0.0.254-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:059a380c08e849b6f312479b18cc63bba2808cff749ad71555f61dd930e3c9a2"}, - {file = "ruff-0.0.254-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b3f15d5d033fd3dcb85d982d6828ddab94134686fac2c02c13a8822aa03e1321"}, - {file = "ruff-0.0.254-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:8deba44fd563361c488dedec90dc330763ee0c01ba54e17df54ef5820079e7e0"}, - {file = "ruff-0.0.254-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ef20bf798ffe634090ad3dc2e8aa6a055f08c448810a2f800ab716cc18b80107"}, - {file = "ruff-0.0.254-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0deb1d7226ea9da9b18881736d2d96accfa7f328c67b7410478cc064ad1fa6aa"}, - {file = "ruff-0.0.254-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:27d39d697fdd7df1f2a32c1063756ee269ad8d5345c471ee3ca450636d56e8c6"}, - {file = "ruff-0.0.254-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:2fc21d060a3197ac463596a97d9b5db2d429395938b270ded61dd60f0e57eb21"}, - {file = "ruff-0.0.254-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:f70dc93bc9db15cccf2ed2a831938919e3e630993eeea6aba5c84bc274237885"}, - {file = "ruff-0.0.254-py3-none-musllinux_1_2_i686.whl", hash = "sha256:09c764bc2bd80c974f7ce1f73a46092c286085355a5711126af351b9ae4bea0c"}, - {file = "ruff-0.0.254-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:d4385cdd30153b7aa1d8f75dfd1ae30d49c918ead7de07e69b7eadf0d5538a1f"}, - {file = "ruff-0.0.254-py3-none-win32.whl", hash = "sha256:c38291bda4c7b40b659e8952167f386e86ec29053ad2f733968ff1d78b4c7e15"}, - {file = "ruff-0.0.254-py3-none-win_amd64.whl", hash = "sha256:e15742df0f9a3615fbdc1ee9a243467e97e75bf88f86d363eee1ed42cedab1ec"}, - {file = "ruff-0.0.254-py3-none-win_arm64.whl", hash = "sha256:b435afc4d65591399eaf4b2af86e441a71563a2091c386cadf33eaa11064dc09"}, - {file = "ruff-0.0.254.tar.gz", hash = "sha256:0eb66c9520151d3bd950ea43b3a088618a8e4e10a5014a72687881e6f3606312"}, -] - -[[package]] -name = "type-enum-plugin" -version = "0.3.1a0" -description = "Mypy plugin for type-enum." -optional = false -python-versions = "^3.11" -files = [] -develop = true - -[package.dependencies] -mypy = "*" - -[package.source] -type = "directory" -url = "../type-enum-plugin" - -[[package]] -name = "typing-extensions" -version = "4.5.0" -description = "Backported and Experimental Type Hints for Python 3.7+" -optional = false -python-versions = ">=3.7" -files = [ - {file = "typing_extensions-4.5.0-py3-none-any.whl", hash = "sha256:fb33085c39dd998ac16d1431ebc293a8b3eedd00fd4a32de0ff79002c19511b4"}, - {file = "typing_extensions-4.5.0.tar.gz", hash = "sha256:5cb5f4a79139d699607b3ef622a1dedafa84e115ab0024e0d9c044a9479ca7cb"}, -] - -[metadata] -lock-version = "2.0" -python-versions = "^3.11" -content-hash = "de58e1cf4fe4b04127a6eb9bc4f963d5deb3c42cfad923aa948a258bb541e418" diff --git a/type-enum/pyproject.toml b/type-enum/pyproject.toml index f1efc26..5b57d61 100644 --- a/type-enum/pyproject.toml +++ b/type-enum/pyproject.toml @@ -1,28 +1,40 @@ -[tool.poetry] +[project] name = "type-enum" version = "0.3.1a0" description = "Concise sum types in Python." -authors = ["Thomas MK "] -license = "Apache License 2.0" +authors = [ + { name = "Thomas MK", email = "tmke8@posteo.net" }, +] +license = { text = "Apache-2.0" } +# readme = "../README.md" readme = "README.md" -packages = [{ include = "type_enum" }] -include = ["type_enum/py.typed"] +# packages = [{ include = "type_enum" }] +# include = ["type_enum/py.typed"] classifiers = [ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", ] -repository = "https://github.com/tmke8/type_enum" +dependencies = [] +requires-python = ">=3.11" + +[project.urls] +Documentation = "https://github.com/tmke8/type-enum#readme" +Issues = "https://github.com/tmke8/type-enum/issues" +Source = "https://github.com/tmke8/type-enum" -[tool.poetry.dependencies] -python = "^3.11" +[tool.rye] +managed = true +dev-dependencies = [ + "ruff >= 0.0.254", + "mypy >= 1.7.1", + "type-enum-plugin @ file:///../type-enum-plugin", + "typing-extensions >= 4.5.0", +] -[tool.poetry.group.dev.dependencies] -ruff = "^0.0.254" -mypy = "^1.7.1" -type-enum-plugin = { path = "../type-enum-plugin", develop = true } -typing-extensions = "^4.5.0" +[tool.rye.scripts] +test = { call = "unittest" } [tool.mypy] plugins = "type_enum_plugin" @@ -36,11 +48,13 @@ ignore_errors = true [tool.ruff] line-length = 88 + +[tool.ruff.lint] select = [ "I", # isort ] -[tool.ruff.isort] +[tool.ruff.lint.isort] known-third-party = ["mypy", "pytest"] extra-standard-library = ["typing_extensions"] no-lines-before = ["future", "standard-library"] @@ -49,5 +63,5 @@ split-on-trailing-comma = false #classes = [] [build-system] -requires = ["poetry-core"] -build-backend = "poetry.core.masonry.api" +requires = ["hatchling"] +build-backend = "hatchling.build" From 826639144195e2f0f9bf9e3922062b15ec9db6f1 Mon Sep 17 00:00:00 2001 From: Thomas M Kehrenberg Date: Fri, 23 Feb 2024 16:44:23 +0100 Subject: [PATCH 2/5] Address ruff's lints --- type-enum/example.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/type-enum/example.py b/type-enum/example.py index 6071387..d4ad224 100644 --- a/type-enum/example.py +++ b/type-enum/example.py @@ -1,12 +1,16 @@ from typing import Final + from type_enum import TypeEnum + class BgColor(TypeEnum): transparent = () a = 32 name = (str,) rgb = {"red": int, "green": int, "blue": int} # named args hsv = {"hue": int, "saturation": int, "value": int} + + reveal_type(BgColor.rgb) background_color = BgColor.rgb(red=39, green=127, blue=168) reveal_type(background_color.red) @@ -26,4 +30,5 @@ def f(color: BgColor) -> None: case BgColor.hsv(hue=h, saturation=s, value=v): print(f"HSV: {h}, {s}, {v}") + f(background_color) From 86237bad653f0c71abb40e2330cada149e794178 Mon Sep 17 00:00:00 2001 From: Thomas M Kehrenberg Date: Fri, 23 Feb 2024 16:57:37 +0100 Subject: [PATCH 3/5] Add empty placeholder for README --- .gitignore | 3 --- type-enum/README.md | 0 2 files changed, 3 deletions(-) create mode 100644 type-enum/README.md diff --git a/.gitignore b/.gitignore index 8c958ce..b6e4761 100644 --- a/.gitignore +++ b/.gitignore @@ -127,6 +127,3 @@ dmypy.json # Pyre type checker .pyre/ - -# project-specific -/type-enum/README.md diff --git a/type-enum/README.md b/type-enum/README.md new file mode 100644 index 0000000..e69de29 From 79d6e974577af150b1841f96bc9504afac5c61b9 Mon Sep 17 00:00:00 2001 From: Thomas M Kehrenberg Date: Fri, 23 Feb 2024 17:04:28 +0100 Subject: [PATCH 4/5] Fix command invoking mypy --- .github/workflows/ci.yml | 2 +- type-enum-plugin/pyproject.toml | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c8c6ef..acb927c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,4 +66,4 @@ jobs: rye sync --no-lock - name: Run type check run: | - rye run mypy + rye run mypy tests diff --git a/type-enum-plugin/pyproject.toml b/type-enum-plugin/pyproject.toml index 620d065..56e2c2a 100644 --- a/type-enum-plugin/pyproject.toml +++ b/type-enum-plugin/pyproject.toml @@ -28,9 +28,6 @@ Source = "https://github.com/tmke8/type-enum" managed = true dev-dependencies = ["mypy >= 1.5", "ruff >= 0.0.292"] -[tool.rye.scripts] -mypyc = "mypy tests" - [tool.ruff] line-length = 88 From 0f63434c5c15f990b8629684aa5bd7570a9a409e Mon Sep 17 00:00:00 2001 From: Thomas M Kehrenberg Date: Fri, 23 Feb 2024 18:09:22 +0100 Subject: [PATCH 5/5] Downgrade mypy --- requirements-dev.lock | 2 +- type-enum/pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements-dev.lock b/requirements-dev.lock index 08f346a..cca756a 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -9,7 +9,7 @@ -e file:type-enum -e file:type-enum-plugin -mypy==1.8.0 +mypy==1.7.1 # via type-enum-plugin mypy-extensions==1.0.0 # via mypy diff --git a/type-enum/pyproject.toml b/type-enum/pyproject.toml index 5b57d61..7da3c25 100644 --- a/type-enum/pyproject.toml +++ b/type-enum/pyproject.toml @@ -28,7 +28,7 @@ Source = "https://github.com/tmke8/type-enum" managed = true dev-dependencies = [ "ruff >= 0.0.254", - "mypy >= 1.7.1", + "mypy >= 1.7.1,<1.8.0", "type-enum-plugin @ file:///../type-enum-plugin", "typing-extensions >= 4.5.0", ]