diff --git a/pdm.lock b/pdm.lock index 037d6981a..572aa871d 100644 --- a/pdm.lock +++ b/pdm.lock @@ -5,7 +5,7 @@ groups = ["default", "dev"] strategy = ["cross_platform", "inherit_metadata"] lock_version = "4.4.1" -content_hash = "sha256:1ee9d0c943b7b1b688bd1eab4b826b9606f7017c2b652414e6bfc9bbabf2a1c7" +content_hash = "sha256:b54e5de2309b06990a20aa2e65d0214fed4936658f0fd43e9750dcd19b253878" [[package]] name = "astroid" @@ -44,21 +44,6 @@ files = [ {file = "dill-0.3.7.tar.gz", hash = "sha256:cc1c8b182eb3013e24bd475ff2e9295af86c1a38eb1aff128dac8962a9ce3c03"}, ] -[[package]] -name = "importlib-metadata" -version = "7.1.0" -requires_python = ">=3.8" -summary = "Read metadata from Python packages" -groups = ["dev"] -marker = "python_version < \"3.10\"" -dependencies = [ - "zipp>=0.5", -] -files = [ - {file = "importlib_metadata-7.1.0-py3-none-any.whl", hash = "sha256:30962b96c0c223483ed6cc7280e7f0199feb01a0e40cfae4d4450fc6fab1f570"}, - {file = "importlib_metadata-7.1.0.tar.gz", hash = "sha256:b78938b926ee8d5f020fc4772d487045805a55ddbad2ecf21c6d60938dc7fcd2"}, -] - [[package]] name = "isort" version = "5.13.2" @@ -97,20 +82,6 @@ files = [ {file = "nodejs_bin-18.4.0a4-py3-none-win_amd64.whl", hash = "sha256:cbd509218b4b17f75ee7841f9c21d5cacc1626d3b823a652a6627dbad18228ec"}, ] -[[package]] -name = "pdm-backend" -version = "2.1.8" -requires_python = ">=3.7" -summary = "The build backend used by PDM that supports latest packaging standards" -groups = ["dev"] -dependencies = [ - "importlib-metadata>=3.6; python_version < \"3.10\"", -] -files = [ - {file = "pdm_backend-2.1.8-py3-none-any.whl", hash = "sha256:fc69799e40817daf9bb9ce8f93ff650d59e093bf86fa3a5264b26a9ef579563d"}, - {file = "pdm_backend-2.1.8.tar.gz", hash = "sha256:2487dfbd13f69d80fb4e6a08006a3ee68272833970813047dc5fcfacdfdc0151"}, -] - [[package]] name = "platformdirs" version = "4.1.0" @@ -148,28 +119,28 @@ files = [ [[package]] name = "ruff" -version = "0.3.2" +version = "0.3.4" requires_python = ">=3.7" summary = "An extremely fast Python linter and code formatter, written in Rust." groups = ["dev"] files = [ - {file = "ruff-0.3.2-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:77f2612752e25f730da7421ca5e3147b213dca4f9a0f7e0b534e9562c5441f01"}, - {file = "ruff-0.3.2-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:9966b964b2dd1107797be9ca7195002b874424d1d5472097701ae8f43eadef5d"}, - {file = "ruff-0.3.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b83d17ff166aa0659d1e1deaf9f2f14cbe387293a906de09bc4860717eb2e2da"}, - {file = "ruff-0.3.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:bb875c6cc87b3703aeda85f01c9aebdce3d217aeaca3c2e52e38077383f7268a"}, - {file = "ruff-0.3.2-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:be75e468a6a86426430373d81c041b7605137a28f7014a72d2fc749e47f572aa"}, - {file = "ruff-0.3.2-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:967978ac2d4506255e2f52afe70dda023fc602b283e97685c8447d036863a302"}, - {file = "ruff-0.3.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1231eacd4510f73222940727ac927bc5d07667a86b0cbe822024dd00343e77e9"}, - {file = "ruff-0.3.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2c6d613b19e9a8021be2ee1d0e27710208d1603b56f47203d0abbde906929a9b"}, - {file = "ruff-0.3.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c8439338a6303585d27b66b4626cbde89bb3e50fa3cae86ce52c1db7449330a7"}, - {file = "ruff-0.3.2-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:de8b480d8379620cbb5ea466a9e53bb467d2fb07c7eca54a4aa8576483c35d36"}, - {file = "ruff-0.3.2-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:b74c3de9103bd35df2bb05d8b2899bf2dbe4efda6474ea9681280648ec4d237d"}, - {file = "ruff-0.3.2-py3-none-musllinux_1_2_i686.whl", hash = "sha256:f380be9fc15a99765c9cf316b40b9da1f6ad2ab9639e551703e581a5e6da6745"}, - {file = "ruff-0.3.2-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:0ac06a3759c3ab9ef86bbeca665d31ad3aa9a4b1c17684aadb7e61c10baa0df4"}, - {file = "ruff-0.3.2-py3-none-win32.whl", hash = "sha256:9bd640a8f7dd07a0b6901fcebccedadeb1a705a50350fb86b4003b805c81385a"}, - {file = "ruff-0.3.2-py3-none-win_amd64.whl", hash = "sha256:0c1bdd9920cab5707c26c8b3bf33a064a4ca7842d91a99ec0634fec68f9f4037"}, - {file = "ruff-0.3.2-py3-none-win_arm64.whl", hash = "sha256:5f65103b1d76e0d600cabd577b04179ff592064eaa451a70a81085930e907d0b"}, - {file = "ruff-0.3.2.tar.gz", hash = "sha256:fa78ec9418eb1ca3db392811df3376b46471ae93792a81af2d1cbb0e5dcb5142"}, + {file = "ruff-0.3.4-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:60c870a7d46efcbc8385d27ec07fe534ac32f3b251e4fc44b3cbfd9e09609ef4"}, + {file = "ruff-0.3.4-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:6fc14fa742e1d8f24910e1fff0bd5e26d395b0e0e04cc1b15c7c5e5fe5b4af91"}, + {file = "ruff-0.3.4-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d3ee7880f653cc03749a3bfea720cf2a192e4f884925b0cf7eecce82f0ce5854"}, + {file = "ruff-0.3.4-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:cf133dd744f2470b347f602452a88e70dadfbe0fcfb5fd46e093d55da65f82f7"}, + {file = "ruff-0.3.4-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3f3860057590e810c7ffea75669bdc6927bfd91e29b4baa9258fd48b540a4365"}, + {file = "ruff-0.3.4-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:986f2377f7cf12efac1f515fc1a5b753c000ed1e0a6de96747cdf2da20a1b369"}, + {file = "ruff-0.3.4-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c4fd98e85869603e65f554fdc5cddf0712e352fe6e61d29d5a6fe087ec82b76c"}, + {file = "ruff-0.3.4-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:64abeed785dad51801b423fa51840b1764b35d6c461ea8caef9cf9e5e5ab34d9"}, + {file = "ruff-0.3.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:df52972138318bc7546d92348a1ee58449bc3f9eaf0db278906eb511889c4b50"}, + {file = "ruff-0.3.4-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:98e98300056445ba2cc27d0b325fd044dc17fcc38e4e4d2c7711585bd0a958ed"}, + {file = "ruff-0.3.4-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:519cf6a0ebed244dce1dc8aecd3dc99add7a2ee15bb68cf19588bb5bf58e0488"}, + {file = "ruff-0.3.4-py3-none-musllinux_1_2_i686.whl", hash = "sha256:bb0acfb921030d00070539c038cd24bb1df73a2981e9f55942514af8b17be94e"}, + {file = "ruff-0.3.4-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:cf187a7e7098233d0d0c71175375c5162f880126c4c716fa28a8ac418dcf3378"}, + {file = "ruff-0.3.4-py3-none-win32.whl", hash = "sha256:af27ac187c0a331e8ef91d84bf1c3c6a5dea97e912a7560ac0cef25c526a4102"}, + {file = "ruff-0.3.4-py3-none-win_amd64.whl", hash = "sha256:de0d5069b165e5a32b3c6ffbb81c350b1e3d3483347196ffdf86dc0ef9e37dd6"}, + {file = "ruff-0.3.4-py3-none-win_arm64.whl", hash = "sha256:6810563cc08ad0096b57c717bd78aeac888a1bfd38654d9113cb3dc4d3f74232"}, + {file = "ruff-0.3.4.tar.gz", hash = "sha256:f0f4484c6541a99862b693e13a151435a279b271cff20e37101116a21e2a1ad1"}, ] [[package]] @@ -206,15 +177,3 @@ files = [ {file = "typing_extensions-4.9.0-py3-none-any.whl", hash = "sha256:af72aea155e91adfc61c3ae9e0e342dbc0cba726d6cba4b6c72c1f34e47291cd"}, {file = "typing_extensions-4.9.0.tar.gz", hash = "sha256:23478f88c37f27d76ac8aee6c905017a143b0b1b886c3c9f66bc2fd94f9f5783"}, ] - -[[package]] -name = "zipp" -version = "3.18.1" -requires_python = ">=3.8" -summary = "Backport of pathlib-compatible object wrapper for zip files" -groups = ["dev"] -marker = "python_version < \"3.10\"" -files = [ - {file = "zipp-3.18.1-py3-none-any.whl", hash = "sha256:206f5a15f2af3dbaee80769fb7dc6f249695e940acca08dfb2a4769fe61e538b"}, - {file = "zipp-3.18.1.tar.gz", hash = "sha256:2884ed22e7d8961de1c9a05142eb69a247f120291bc0206a00a7642f09b5b715"}, -] diff --git a/pdm_build.py b/pdm_build.py index 8cdde5819..029ac9bda 100644 --- a/pdm_build.py +++ b/pdm_build.py @@ -1,43 +1,37 @@ from __future__ import annotations -import os from json import loads from pathlib import Path from shutil import copyfile, copytree from typing import TYPE_CHECKING, TypedDict, cast -from nodejs import node - +# https://github.com/samwillis/nodejs-pypi/pull/23 if TYPE_CHECKING: - # https://github.com/samwillis/nodejs-pypi/pull/23 + # https://github.com/astral-sh/ruff/issues/9528 from subprocess import run # noqa: S404 - - from pdm.backend.hooks import Context else: from nodejs.npm import run +import os - -# these are hook functions where all args are required regardless of whether or not they are used -# ruff: noqa: ARG001 +from nodejs import node class PackageJson(TypedDict): bin: dict[str, str] -def pdm_build_update_files(context: Context, files: dict[str, Path]): - # ah yes, the classic "wrong path" moment! - os.environ["PATH"] = os.pathsep.join([str(Path(node.__file__).parent), os.environ["PATH"]]) +# ah yes, the classic "wrong path" moment! +os.environ["PATH"] = os.pathsep.join([str(Path(node.__file__).parent), os.environ["PATH"]]) - if not Path("node_modules").exists(): - _ = run(["ci"], check=True) - _ = run(["run", "build:cli:dev"], check=True) +if not Path("node_modules").exists(): + _ = run(["ci"], check=True) +_ = run(["run", "build:cli:dev"], check=True) - npm_package_dir = Path("packages/pyright") - pypi_package_dir = Path("basedpyright") +npm_package_dir = Path("packages/pyright") +pypi_package_dir = Path("basedpyright") - copytree(npm_package_dir / "dist", pypi_package_dir / "dist", dirs_exist_ok=True) - for script_path in cast(PackageJson, loads((npm_package_dir / "package.json").read_text()))[ - "bin" - ].values(): - _ = copyfile(npm_package_dir / script_path, pypi_package_dir / script_path) +copytree(npm_package_dir / "dist", pypi_package_dir / "dist", dirs_exist_ok=True) +for script_path in cast(PackageJson, loads((npm_package_dir / "package.json").read_text()))[ + "bin" +].values(): + _ = copyfile(npm_package_dir / script_path, pypi_package_dir / script_path) diff --git a/pyproject.toml b/pyproject.toml index 9e279c7e9..156d87541 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,6 @@ distribution = true dev = [ "pylint>=3.0.0a7", "ruff>=0.2.2", - "pdm-backend>=2.1.8", # only used here for types in pdm_build.py ] [tool.pdm.version]