Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stuff #906

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Stuff #906

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 35 additions & 81 deletions .basedpyright/baseline.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
{
"files": {
"./build/generateUnicodeTables.py": [
{
"code": "reportGeneralTypeIssues",
"range": {
"startColumn": 61,
"endColumn": 62,
"lineCount": 1
}
},
"./build/py3_13/generateUnicodeTables.py": [
{
"code": "reportUnannotatedClassAttribute",
"range": {
Expand Down Expand Up @@ -65,54 +57,6 @@
"lineCount": 1
}
},
{
"code": "reportIndexIssue",
"range": {
"startColumn": 32,
"endColumn": 36,
"lineCount": 1
}
},
{
"code": "reportIndexIssue",
"range": {
"startColumn": 30,
"endColumn": 34,
"lineCount": 1
}
},
{
"code": "reportIndexIssue",
"range": {
"startColumn": 50,
"endColumn": 54,
"lineCount": 1
}
},
{
"code": "reportGeneralTypeIssues",
"range": {
"startColumn": 41,
"endColumn": 42,
"lineCount": 1
}
},
{
"code": "reportGeneralTypeIssues",
"range": {
"startColumn": 28,
"endColumn": 29,
"lineCount": 1
}
},
{
"code": "reportIndexIssue",
"range": {
"startColumn": 65,
"endColumn": 69,
"lineCount": 1
}
},
{
"code": "reportUnusedCallResult",
"range": {
Expand All @@ -129,14 +73,6 @@
"lineCount": 1
}
},
{
"code": "reportGeneralTypeIssues",
"range": {
"startColumn": 41,
"endColumn": 42,
"lineCount": 1
}
},
{
"code": "reportUnusedCallResult",
"range": {
Expand All @@ -161,14 +97,6 @@
"lineCount": 1
}
},
{
"code": "reportIndexIssue",
"range": {
"startColumn": 59,
"endColumn": 63,
"lineCount": 1
}
},
{
"code": "reportUnusedCallResult",
"range": {
Expand All @@ -185,14 +113,6 @@
"lineCount": 3
}
},
{
"code": "reportGeneralTypeIssues",
"range": {
"startColumn": 38,
"endColumn": 39,
"lineCount": 1
}
},
{
"code": "reportUnusedCallResult",
"range": {
Expand Down Expand Up @@ -249,6 +169,40 @@
"lineCount": 18
}
}
],
"./build/py3_13/localization_helper.py": [
{
"code": "reportDeprecated",
"range": {
"startColumn": 44,
"endColumn": 48,
"lineCount": 1
}
},
{
"code": "reportDeprecated",
"range": {
"startColumn": 61,
"endColumn": 66,
"lineCount": 1
}
},
{
"code": "reportDeprecated",
"range": {
"startColumn": 14,
"endColumn": 18,
"lineCount": 1
}
},
{
"code": "reportDeprecated",
"range": {
"startColumn": 24,
"endColumn": 29,
"lineCount": 1
}
}
]
}
}
2 changes: 1 addition & 1 deletion .github/workflows/build_and_release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: 'build and release'

env:
PYTHON_VERSION: '3.12'
PYTHON_VERSION: '3.13'
ARTIFACT_NAME_VSIX: vsix
VSIX_NAME: vscode-pyright.vsix
VSIX_DIR: packages/vscode-pyright
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validation.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: 'Validation'

env:
PYTHON_VERSION: 3.11
PYTHON_VERSION: 3.13

on:
pull_request:
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.13
2 changes: 1 addition & 1 deletion build/generateAllDocstubs.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
for pythonVersion in 3.13 3.12 3.11 3.10 3.9 3.8; do
./pw uv venv --python $pythonVersion
./pw uv sync --only-group=docstubs --no-install-project
./pw uv run --no-sync build/generate_docstubs.py
./pw uv run --no-sync build/py3_8/generate_docstubs.py
done
4 changes: 4 additions & 0 deletions build/py3_13/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"""
scripts that are only run during development so they only need to be compatible with the version of
python pinned in `.python-version`
"""
4 changes: 3 additions & 1 deletion build/docs_macros.py → build/py3_13/docs_macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import json
from functools import partial
from subprocess import run as stupid_run
from typing import TYPE_CHECKING, Iterable
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from collections.abc import Iterable

from mkdocs_macros.plugin import MacrosPlugin

run = partial(stupid_run, check=True, capture_output=True)
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions build/py3_13/ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
extend = "../../pyproject.toml"
target-version = "py313"
1 change: 1 addition & 0 deletions build/py3_8/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""scripts that may be run on older versions of python so need to be compatible with 3.8"""
File renamed without changes.
4 changes: 1 addition & 3 deletions build/get_version.py → build/py3_8/get_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ def get_version() -> str:
return cast(
str,
loads(
(
Path(__file__).parent.parent / "packages/pyright-internal/src/version.json"
).read_text()
(Path(__file__).parents[2] / "packages/pyright-internal/src/version.json").read_text()
),
)
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ plugins:
# https://github.com/wilhelmer/mkdocs-unused-files/issues/12
# - unused_files
- macros:
module_name: build/docs_macros
module_name: build/py3_13/docs_macros
on_undefined: strict
nav:
- index.md
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"ruff-fix": "uv run --no-sync ruff check --fix && pw uv run --no-sync ruff format --fix",
"pylint": "uv run --no-sync pylint basedpyright build pdm_build.py",
"test-python": "uv run --no-sync pytest tests",
"generate-docstubs": "uv run --no-sync build/generate_docstubs.py",
"localization-helper": "uv run --no-sync build/localization_helper.py",
"generate-docstubs": "uv run --no-sync build/py3_8/generate_docstubs.py",
"localization-helper": "uv run --no-sync build/py3_8/localization_helper.py",
"docs": "uv run --no-sync mkdocs serve"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion pdm_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from pdm.backend.hooks.base import BuildHookInterface
from typing_extensions import override

from build.generate_docstubs import main as generate_docstubs
from build.py3_8.generate_docstubs import main as generate_docstubs

if TYPE_CHECKING:
from pdm.backend.hooks import Context
Expand Down
12 changes: 10 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ default-groups = ["dev", "docstubs", "lochelper"]

[tool.pdm.version]
source = "call"
getter = "build.get_version:get_version"
getter = "build.py3_8.get_version:get_version"

[tool.pdm.build]
excludes = ["tests/", "pdm_build.py"]
Expand Down Expand Up @@ -197,6 +197,11 @@ ignore = ["pw", "basedpyright/dist", "packages", "docstubs"]
exclude = ["pw", "basedpyright/dist", "packages", "docstubs"]
reportImplicitStringConcatenation = false # conflicts with ruff formatter

executionEnvironments = [
{ root = 'build/py3_13', pythonVersion = '3.13' },
{ root = 'tests', pythonVersion = '3.13' },
]

# currently commented out due to https://github.com/DetachHead/basedpyright/issues/570
# only seem to be needed when using pycharm, which i dont really care about anyway because pycharm sucks
# venvPath = "."
Expand All @@ -214,7 +219,7 @@ extend-exclude = [
"packages/pyright-internal/typeshed-fallback",
"docstubs",
"packages/pyright-internal/src/tests/samples",
"build/generateUnicodeTables.py", # comes from upstream
"build/py3_13/generateUnicodeTables.py", # comes from upstream
]

[tool.ruff.lint]
Expand All @@ -229,6 +234,9 @@ ignore = [
"ISC001", # single-line-implicit-string-concatenation (conflicts with formatter)
"COM812", # missing-trailing-comma (conflicts with formatter)
"PLC0414", # Import alias does not rename original package (used by basedpyright for explicit re-export)
"UP035", # deprecated-import (covered by basedpyright deprecateTypingAliases)
"UP006", # non-pep585-annotation (covered by basedpyright deprecateTypingAliases)
"UP007", # non-pep604-annotation (covered by basedpyright deprecateTypingAliases)

# rules i disabled because i don't like them:
"EM", # flake8-errmsg
Expand Down
2 changes: 2 additions & 0 deletions tests/ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
extend = "../pyproject.toml"
target-version = "py313"
9 changes: 3 additions & 6 deletions tests/test_generate_docstubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@
from functools import wraps
from locale import getpreferredencoding
from pathlib import Path
from typing import TYPE_CHECKING, Callable
from typing import Callable

from pytest import mark

if TYPE_CHECKING:
from basedtyping import P, T


def needs_all_docstubs(
def needs_all_docstubs[T, **P](
condition_to_run_locally: bool, # noqa: FBT001
) -> Callable[[Callable[P, T]], Callable[P, T]]:
def decorator(fn: Callable[P, T]) -> Callable[P, T]:
Expand All @@ -45,7 +42,7 @@ def read_module_text(name: str):
def test_builtin_docstring():
assert '''
class float:
"""Convert a string or number to a floating point number, if possible."""
"""Convert a string or number to a floating-point number, if possible."""
''' in read_module_text("builtins.pyi")


Expand Down
Loading