[+] fix pr34 build: exclude archlinux from ruff/pyrefly, import overload from typing
1. exclude archlinux namespace from pr34 ruff and pyrefly configs; 2. import overload from typing (available since py3.5) instead of typing_extensions; 3. add --no-annotate --no-header to uv pip compile; 4. read version from pyproject.toml in archlinux meson.build; 5. exclude archlinux from pr34 meson.build find;
This commit is contained in:
parent
46d951afab
commit
2c013d6be4
@ -21,20 +21,15 @@ from typing import (
|
||||
Type,
|
||||
TypeVar,
|
||||
Callable,
|
||||
overload,
|
||||
)
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
from typing_extensions import (
|
||||
Self,
|
||||
BinaryIO,
|
||||
overload,
|
||||
)
|
||||
else:
|
||||
try:
|
||||
from typing_extensions import overload
|
||||
except ModuleNotFoundError:
|
||||
def overload(f: Any) -> Any:
|
||||
return f
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -383,15 +378,9 @@ class BootstrapSettings:
|
||||
'--no-index -U',
|
||||
).split(),
|
||||
)
|
||||
whl_cache_update: Optional[bool] = dataclasses.field(
|
||||
default_factory=lambda: os.environ.get('WHL_CACHE_UPDATE', json.dumps(False)) in [json.dumps(True)]
|
||||
)
|
||||
uv_compile_allow_index: bool = dataclasses.field(
|
||||
default_factory=lambda: os.environ.get('UV_COMPILE_ALLOW_INDEX', json.dumps(False)) in [json.dumps(True)]
|
||||
)
|
||||
venv_partial: bool = dataclasses.field(
|
||||
default_factory=lambda: os.environ.get('VENV_PARTIAL', json.dumps(False)) in [json.dumps(True)]
|
||||
)
|
||||
whl_cache_update: Optional[bool] = dataclasses.field(default_factory=lambda: os.environ.get('WHL_CACHE_UPDATE', json.dumps(False)) in [json.dumps(True)])
|
||||
uv_compile_allow_index: bool = dataclasses.field(default_factory=lambda: os.environ.get('UV_COMPILE_ALLOW_INDEX', json.dumps(False)) in [json.dumps(True)])
|
||||
venv_partial: bool = dataclasses.field(default_factory=lambda: os.environ.get('VENV_PARTIAL', json.dumps(False)) in [json.dumps(True)])
|
||||
|
||||
@classmethod
|
||||
def get(
|
||||
@ -537,10 +526,17 @@ def whl_cache_download(
|
||||
|
||||
try:
|
||||
cmd = [
|
||||
sys.executable, '-m', 'pip', 'download', '--only-binary=:all:',
|
||||
*uv_python_version, *pip_find_links_args,
|
||||
'-r', missing_req_path,
|
||||
'-d', str(whl_cache_path),
|
||||
sys.executable,
|
||||
'-m',
|
||||
'pip',
|
||||
'download',
|
||||
'--only-binary=:all:',
|
||||
*uv_python_version,
|
||||
*pip_find_links_args,
|
||||
'-r',
|
||||
missing_req_path,
|
||||
'-d',
|
||||
str(whl_cache_path),
|
||||
]
|
||||
logger.info(dict(cmd=cmd))
|
||||
subprocess.check_call(cmd)
|
||||
@ -664,17 +660,20 @@ def env_bootstrap(
|
||||
cache_find_links_args = ['-f', str(bootstrap_settings.whl_cache_path)]
|
||||
|
||||
if needs_compile:
|
||||
with tempfile.NamedTemporaryFile(
|
||||
mode='w',
|
||||
prefix='requirements',
|
||||
suffix='.in',
|
||||
) as f_in, tempfile.NamedTemporaryFile(
|
||||
mode='w',
|
||||
prefix='requirements',
|
||||
suffix='.txt',
|
||||
dir=requirements_path.parent,
|
||||
delete=False,
|
||||
) as f_out:
|
||||
with (
|
||||
tempfile.NamedTemporaryFile(
|
||||
mode='w',
|
||||
prefix='requirements',
|
||||
suffix='.in',
|
||||
) as f_in,
|
||||
tempfile.NamedTemporaryFile(
|
||||
mode='w',
|
||||
prefix='requirements',
|
||||
suffix='.txt',
|
||||
dir=requirements_path.parent,
|
||||
delete=False,
|
||||
) as f_out,
|
||||
):
|
||||
f_in.write('\n'.join(requirements_in))
|
||||
f_in.flush()
|
||||
|
||||
@ -687,15 +686,20 @@ def env_bootstrap(
|
||||
|
||||
cmd = [
|
||||
'uv',
|
||||
'--cache-dir', bootstrap_settings.uv_cache_dir,
|
||||
'pip', 'compile',
|
||||
'--cache-dir',
|
||||
bootstrap_settings.uv_cache_dir,
|
||||
'pip',
|
||||
'compile',
|
||||
*uv_python_version,
|
||||
'--generate-hashes',
|
||||
'--no-annotate',
|
||||
'--no-header',
|
||||
*pip_find_links_args,
|
||||
*cache_find_links_args,
|
||||
*constraint_args,
|
||||
*uv_compile_args,
|
||||
'-o', f_out.name,
|
||||
'-o',
|
||||
f_out.name,
|
||||
f_in.name,
|
||||
]
|
||||
logger.info(dict(cmd=cmd))
|
||||
@ -720,26 +724,33 @@ def env_bootstrap(
|
||||
if bootstrap_settings.venv_partial and bootstrap_settings.env_path.exists():
|
||||
logger.info('[bootstrap] VENV_PARTIAL: skipping venv creation (already exists)')
|
||||
else:
|
||||
subprocess.check_call([
|
||||
'uv',
|
||||
'--cache-dir', bootstrap_settings.uv_cache_dir,
|
||||
*[o for o in bootstrap_settings.uv_args if o not in ['-U', '--upgrade', '--no-index']],
|
||||
'venv',
|
||||
*venv_python_version,
|
||||
*cache_find_links_args,
|
||||
str(bootstrap_settings.env_path),
|
||||
])
|
||||
subprocess.check_call(
|
||||
[
|
||||
'uv',
|
||||
'--cache-dir',
|
||||
bootstrap_settings.uv_cache_dir,
|
||||
*[o for o in bootstrap_settings.uv_args if o not in ['-U', '--upgrade', '--no-index']],
|
||||
'venv',
|
||||
*venv_python_version,
|
||||
*cache_find_links_args,
|
||||
str(bootstrap_settings.env_path),
|
||||
]
|
||||
)
|
||||
|
||||
cmd = [
|
||||
'uv',
|
||||
'--cache-dir', bootstrap_settings.uv_cache_dir,
|
||||
'pip', 'install',
|
||||
'--cache-dir',
|
||||
bootstrap_settings.uv_cache_dir,
|
||||
'pip',
|
||||
'install',
|
||||
*uv_python_version,
|
||||
*cache_find_links_args,
|
||||
'-p', str(bootstrap_settings.python_path),
|
||||
'-p',
|
||||
str(bootstrap_settings.python_path),
|
||||
'--require-hashes',
|
||||
*bootstrap_settings.uv_args,
|
||||
'-r', str(requirements_path),
|
||||
'-r',
|
||||
str(requirements_path),
|
||||
]
|
||||
logger.info(dict(cmd=cmd))
|
||||
subprocess.check_call(cmd)
|
||||
|
||||
@ -3,7 +3,10 @@ project(
|
||||
'.venv/bin/toml', 'get', '--toml-path', 'pyproject.toml', 'project.name',
|
||||
check: true
|
||||
).stdout().strip('\n'),
|
||||
version: '0.1.5.17+27.23',
|
||||
version: run_command(
|
||||
'.venv/bin/toml', 'get', '--toml-path', 'pyproject.toml', 'project.version',
|
||||
check: true
|
||||
).stdout().strip('\n'),
|
||||
)
|
||||
|
||||
install_path = get_option('install_path')
|
||||
|
||||
@ -44,7 +44,9 @@ if mode == 'pyproject'
|
||||
module_root = install_root / namespace_path
|
||||
|
||||
python_sources = run_command(
|
||||
'find', namespace_path, '-iname', '*.py',
|
||||
'find', namespace_path,
|
||||
'-path', namespace_path / 'commands_typed' / 'archlinux', '-prune',
|
||||
'-o', '-iname', '*.py', '-print',
|
||||
check: true
|
||||
).stdout().strip().split('\n')
|
||||
|
||||
|
||||
@ -21,20 +21,15 @@ from typing import (
|
||||
Type,
|
||||
TypeVar,
|
||||
Callable,
|
||||
overload,
|
||||
)
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
from typing_extensions import (
|
||||
Self,
|
||||
BinaryIO,
|
||||
overload,
|
||||
)
|
||||
else:
|
||||
try:
|
||||
from typing_extensions import overload
|
||||
except ModuleNotFoundError:
|
||||
def overload(f: Any) -> Any:
|
||||
return f
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -383,15 +378,9 @@ class BootstrapSettings:
|
||||
'--no-index -U',
|
||||
).split(),
|
||||
)
|
||||
whl_cache_update: Optional[bool] = dataclasses.field(
|
||||
default_factory=lambda: os.environ.get('WHL_CACHE_UPDATE', json.dumps(False)) in [json.dumps(True)]
|
||||
)
|
||||
uv_compile_allow_index: bool = dataclasses.field(
|
||||
default_factory=lambda: os.environ.get('UV_COMPILE_ALLOW_INDEX', json.dumps(False)) in [json.dumps(True)]
|
||||
)
|
||||
venv_partial: bool = dataclasses.field(
|
||||
default_factory=lambda: os.environ.get('VENV_PARTIAL', json.dumps(False)) in [json.dumps(True)]
|
||||
)
|
||||
whl_cache_update: Optional[bool] = dataclasses.field(default_factory=lambda: os.environ.get('WHL_CACHE_UPDATE', json.dumps(False)) in [json.dumps(True)])
|
||||
uv_compile_allow_index: bool = dataclasses.field(default_factory=lambda: os.environ.get('UV_COMPILE_ALLOW_INDEX', json.dumps(False)) in [json.dumps(True)])
|
||||
venv_partial: bool = dataclasses.field(default_factory=lambda: os.environ.get('VENV_PARTIAL', json.dumps(False)) in [json.dumps(True)])
|
||||
|
||||
@classmethod
|
||||
def get(
|
||||
@ -537,10 +526,17 @@ def whl_cache_download(
|
||||
|
||||
try:
|
||||
cmd = [
|
||||
sys.executable, '-m', 'pip', 'download', '--only-binary=:all:',
|
||||
*uv_python_version, *pip_find_links_args,
|
||||
'-r', missing_req_path,
|
||||
'-d', str(whl_cache_path),
|
||||
sys.executable,
|
||||
'-m',
|
||||
'pip',
|
||||
'download',
|
||||
'--only-binary=:all:',
|
||||
*uv_python_version,
|
||||
*pip_find_links_args,
|
||||
'-r',
|
||||
missing_req_path,
|
||||
'-d',
|
||||
str(whl_cache_path),
|
||||
]
|
||||
logger.info(dict(cmd=cmd))
|
||||
subprocess.check_call(cmd)
|
||||
@ -664,17 +660,20 @@ def env_bootstrap(
|
||||
cache_find_links_args = ['-f', str(bootstrap_settings.whl_cache_path)]
|
||||
|
||||
if needs_compile:
|
||||
with tempfile.NamedTemporaryFile(
|
||||
mode='w',
|
||||
prefix='requirements',
|
||||
suffix='.in',
|
||||
) as f_in, tempfile.NamedTemporaryFile(
|
||||
mode='w',
|
||||
prefix='requirements',
|
||||
suffix='.txt',
|
||||
dir=requirements_path.parent,
|
||||
delete=False,
|
||||
) as f_out:
|
||||
with (
|
||||
tempfile.NamedTemporaryFile(
|
||||
mode='w',
|
||||
prefix='requirements',
|
||||
suffix='.in',
|
||||
) as f_in,
|
||||
tempfile.NamedTemporaryFile(
|
||||
mode='w',
|
||||
prefix='requirements',
|
||||
suffix='.txt',
|
||||
dir=requirements_path.parent,
|
||||
delete=False,
|
||||
) as f_out,
|
||||
):
|
||||
f_in.write('\n'.join(requirements_in))
|
||||
f_in.flush()
|
||||
|
||||
@ -687,15 +686,20 @@ def env_bootstrap(
|
||||
|
||||
cmd = [
|
||||
'uv',
|
||||
'--cache-dir', bootstrap_settings.uv_cache_dir,
|
||||
'pip', 'compile',
|
||||
'--cache-dir',
|
||||
bootstrap_settings.uv_cache_dir,
|
||||
'pip',
|
||||
'compile',
|
||||
*uv_python_version,
|
||||
'--generate-hashes',
|
||||
'--no-annotate',
|
||||
'--no-header',
|
||||
*pip_find_links_args,
|
||||
*cache_find_links_args,
|
||||
*constraint_args,
|
||||
*uv_compile_args,
|
||||
'-o', f_out.name,
|
||||
'-o',
|
||||
f_out.name,
|
||||
f_in.name,
|
||||
]
|
||||
logger.info(dict(cmd=cmd))
|
||||
@ -720,26 +724,33 @@ def env_bootstrap(
|
||||
if bootstrap_settings.venv_partial and bootstrap_settings.env_path.exists():
|
||||
logger.info('[bootstrap] VENV_PARTIAL: skipping venv creation (already exists)')
|
||||
else:
|
||||
subprocess.check_call([
|
||||
'uv',
|
||||
'--cache-dir', bootstrap_settings.uv_cache_dir,
|
||||
*[o for o in bootstrap_settings.uv_args if o not in ['-U', '--upgrade', '--no-index']],
|
||||
'venv',
|
||||
*venv_python_version,
|
||||
*cache_find_links_args,
|
||||
str(bootstrap_settings.env_path),
|
||||
])
|
||||
subprocess.check_call(
|
||||
[
|
||||
'uv',
|
||||
'--cache-dir',
|
||||
bootstrap_settings.uv_cache_dir,
|
||||
*[o for o in bootstrap_settings.uv_args if o not in ['-U', '--upgrade', '--no-index']],
|
||||
'venv',
|
||||
*venv_python_version,
|
||||
*cache_find_links_args,
|
||||
str(bootstrap_settings.env_path),
|
||||
]
|
||||
)
|
||||
|
||||
cmd = [
|
||||
'uv',
|
||||
'--cache-dir', bootstrap_settings.uv_cache_dir,
|
||||
'pip', 'install',
|
||||
'--cache-dir',
|
||||
bootstrap_settings.uv_cache_dir,
|
||||
'pip',
|
||||
'install',
|
||||
*uv_python_version,
|
||||
*cache_find_links_args,
|
||||
'-p', str(bootstrap_settings.python_path),
|
||||
'-p',
|
||||
str(bootstrap_settings.python_path),
|
||||
'--require-hashes',
|
||||
*bootstrap_settings.uv_args,
|
||||
'-r', str(requirements_path),
|
||||
'-r',
|
||||
str(requirements_path),
|
||||
]
|
||||
logger.info(dict(cmd=cmd))
|
||||
subprocess.check_call(cmd)
|
||||
|
||||
@ -82,6 +82,7 @@ include = [
|
||||
]
|
||||
exclude = [
|
||||
'.venv',
|
||||
'online/fxreader/pr34/commands_typed/archlinux',
|
||||
]
|
||||
|
||||
[tool.ruff.format]
|
||||
@ -252,7 +253,7 @@ project-includes = [
|
||||
]
|
||||
project-excludes = [
|
||||
'.venv',
|
||||
'online/fxreader/pr34/commands_typed/archlinux/tests/res',
|
||||
'online/fxreader/pr34/commands_typed/archlinux',
|
||||
]
|
||||
search-path = [
|
||||
'.',
|
||||
|
||||
@ -8,7 +8,7 @@ classifiers = [
|
||||
'Programming Language :: Python',
|
||||
]
|
||||
|
||||
name = 'online.fxreader.pr34'
|
||||
name = "online.fxreader.pr34"
|
||||
# version = '0.1.5.16+27.7'
|
||||
dynamic = [
|
||||
'version',
|
||||
@ -21,6 +21,7 @@ dependencies = [
|
||||
'pydantic',
|
||||
'pydantic-settings',
|
||||
'tomlkit',
|
||||
'pip==23.3.2',
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
@ -31,28 +32,41 @@ crypto = [
|
||||
early = [
|
||||
'numpy',
|
||||
'cryptography',
|
||||
'yq',
|
||||
'toml-cli',
|
||||
'ninja',
|
||||
'patchelf',
|
||||
# 'tomlkit',
|
||||
]
|
||||
|
||||
archlinux = [
|
||||
'solv==0.7.35',
|
||||
]
|
||||
|
||||
lint = [
|
||||
'tomli',
|
||||
# 'tomllib',
|
||||
'mypy',
|
||||
'pyright',
|
||||
'pyrefly',
|
||||
'ruff',
|
||||
# 'tomlkit',
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
online-fxreader-pr34-commands = 'online.fxreader.pr34.commands:commands_cli'
|
||||
|
||||
[tool.online-fxreader-pr34]
|
||||
early_features = ['default', 'early', 'lint',]
|
||||
early_features = ["default", "early", "lint"]
|
||||
|
||||
modules = [
|
||||
{ name = 'online.fxreader.pr34', tool = { 'online-fxreader-pr34' = { early_features = ['default', 'early', 'lint'] } } },
|
||||
]
|
||||
|
||||
[build-system]
|
||||
requires = ["meson-python", "pybind11"]
|
||||
build-backend = "mesonpy"
|
||||
|
||||
[project.scripts]
|
||||
online-fxreader-pr34-commands = 'online.fxreader.pr34.commands:commands_cli'
|
||||
|
||||
|
||||
[tool.ruff]
|
||||
line-length = 160
|
||||
@ -68,6 +82,7 @@ include = [
|
||||
]
|
||||
exclude = [
|
||||
'.venv',
|
||||
'online/fxreader/pr34/commands_typed/archlinux',
|
||||
]
|
||||
|
||||
[tool.ruff.format]
|
||||
@ -128,6 +143,7 @@ extraPaths = [
|
||||
'.',
|
||||
'../mypy-stubs',
|
||||
'../mypy-stubs/types-debugpy',
|
||||
'../mypy-stubs/types-solv',
|
||||
'../mypy-stubs/marisa-trie-types',
|
||||
# '../../../../../',
|
||||
]
|
||||
@ -230,3 +246,19 @@ reportShadowedImports = "none"
|
||||
reportUninitializedInstanceVariable = "none"
|
||||
reportUnnecessaryTypeIgnoreComment = "none"
|
||||
reportUnusedCallResult = "none"
|
||||
|
||||
[tool.pyrefly]
|
||||
project-includes = [
|
||||
'online/fxreader/pr34/commands_typed/**/*.py',
|
||||
]
|
||||
project-excludes = [
|
||||
'.venv',
|
||||
'online/fxreader/pr34/commands_typed/archlinux',
|
||||
]
|
||||
search-path = [
|
||||
'.',
|
||||
'../mypy-stubs/types-debugpy',
|
||||
'../mypy-stubs/types-solv',
|
||||
'../mypy-stubs/marisa-trie-types',
|
||||
]
|
||||
python-version = '3.13'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user