Skip to content

Commit

Permalink
asdf
Browse files Browse the repository at this point in the history
  • Loading branch information
DetachHead committed Jan 15, 2024
1 parent 3bb6360 commit c8583b6
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 74 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,7 @@ Thumbs.db
.pdm-python
.pyprojectx
**/__pycache__
/.venv/
/.venv/

# js files copied into the basedpyright pypi package
basedpyright/*.js
6 changes: 0 additions & 6 deletions __version__.py

This file was deleted.

2 changes: 1 addition & 1 deletion basedpyright/langserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@


def main():
run("pyright-langserver")
run("langserver.index")
2 changes: 1 addition & 1 deletion basedpyright/pyright.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@


def main():
run("pyright")
run("index")
2 changes: 1 addition & 1 deletion basedpyright/run_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@


def run(script_name: str):
node.run([Path(__file__).parent / f"dist/{script_name}.js", *sys.argv[1:]])
node.run([Path(__file__).parent / f"{script_name}.js", *sys.argv[1:]])
14 changes: 14 additions & 0 deletions dynamic_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from __future__ import annotations

from json import loads
from pathlib import Path

root_dir = Path(__file__).parent


def get_version() -> str:
return loads((root_dir / "lerna.json").read_text())["version"]


def get_description() -> str:
return loads((root_dir / "package.json").read_text())["description"]
59 changes: 2 additions & 57 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions pdm_build.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
from __future__ import annotations

from json import loads
from pathlib import Path
from shutil import copytree
from shutil import copyfile, copytree

from nodejs import npm

if not Path("node_modules").exists():
_ = npm.run(["ci"], check=True)
_ = npm.run(["run", "build:cli:dev"], check=True)

copytree("packages/pyright/dist", "basedpyright/dist", dirs_exist_ok=True)
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 loads((npm_package_dir / "package.json").read_text())[
"bin"
].values():
copyfile(npm_package_dir / script_path, pypi_package_dir / script_path)
15 changes: 10 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ package-type = "library"
dev = ["black>=23", "pylint>=3.0.0a7", "ruff>=0.0.290"]

[tool.pdm.version]
source = "file"
path = "__init__.py"
source = "call"
getter = "dynamic_info:get_version"

[tool.pdm.description]
source = "call"
getter = "dynamic_info:get_description"

[project]
name = "basedpyright"
dynamic = ["version"]
description = "Default template for PDM package"
dynamic = ["version", "description"]
authors = [
{ name = "detachhead", email = "[email protected]" },
]
Expand Down Expand Up @@ -245,6 +248,8 @@ max-line-length = 200
[tool.pyright]
pythonVersion = "3.8"
pythonPlatform = "All"
include = ["basedpyright", "dynamic_info.py", "pdm_build.py"]
exclude = ['basedpyright/dist']
reportMissingTypeStubs = false
strictListInference = true
strictDictionaryInference = true
Expand Down Expand Up @@ -291,7 +296,7 @@ reportUnnecessaryComparison = true
reportUnnecessaryContains = true
reportAssertAlwaysTrue = true
reportSelfClsParameterName = true
reportImplicitStringConcatenation = false # conflicts with black
reportImplicitStringConcatenation = false # conflicts with black
reportInvalidStubStatement = true
reportIncompleteStub = true
reportUnsupportedDunderAll = true
Expand Down

0 comments on commit c8583b6

Please sign in to comment.