Skip to content

Commit

Permalink
Merge pull request #26 from baszalmstra/py38
Browse files Browse the repository at this point in the history
update to allow py38
  • Loading branch information
tdejager authored Jul 19, 2024
2 parents 2028b9c + 01aa986 commit ecb8cde
Show file tree
Hide file tree
Showing 7 changed files with 7,105 additions and 1,934 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
- py312
- py311
- py310
- py39
- py38
steps:
- uses: actions/checkout@v4
- uses: prefix-dev/setup-pixi@v0.5.1
Expand Down
8,957 changes: 7,060 additions & 1,897 deletions pixi.lock

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ platforms = ["win-64", "linux-64", "osx-64", "osx-arm64"]
build_sdist = "pixi run python -m build --sdist"

[dependencies]
python = ">=3.10"
python = ">=3.8"
build = ">=0.7.0,<0.8"
rattler-build = ">=0.18.1,<1"
conda-build = ">=24.3.0,<25.0"
Expand Down Expand Up @@ -53,8 +53,16 @@ python = "3.11.*"
[feature.py310.dependencies]
python = "3.10.*"

[feature.py39.dependencies]
python = "3.9.*"

[feature.py38.dependencies]
python = "3.8.*"

[environments]
py312 = { features = ["py312", "tests"] }
py311 = ["py311", "tests"]
py310 = ["py310", "tests"]
py39 = ["py39", "tests"]
py38 = ["py38", "tests"]
lint = { features = ["lint"], no-default-feature = true }
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ license = { file = "LICENSE.txt" }
dependencies = [
"typing-extensions>=4.12,<5"
]
requires-python = ">=3.10"
requires-python = ">=3.8"

[tool.ruff]
target-version = "py310"
target-version = "py38"
line-length = 100

[tool.ruff.format]
Expand Down Expand Up @@ -48,5 +48,5 @@ venvPath = ".pixi/envs"
venv = "default"

[tool.mypy]
python_version = "3.10"
python_version = "3.8"
allow_redefinition = true
4 changes: 2 additions & 2 deletions src/rattler_build_conda_compat/conditional_list.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from typing import TYPE_CHECKING, Any, Generic, TypeVar, Union, cast
from typing import TYPE_CHECKING, Any, Generic, List, TypeVar, Union, cast

if TYPE_CHECKING:
from collections.abc import Callable, Generator
Expand All @@ -15,7 +15,7 @@ class IfStatement(Generic[T]):
else_: T | list[T] | None


ConditionalList = Union[T, IfStatement[T], list[T | IfStatement[T]]] # noqa: UP007
ConditionalList = Union[T, IfStatement[T], List[Union[T, IfStatement[T]]]]


def visit_conditional_list( # noqa: C901
Expand Down
4 changes: 2 additions & 2 deletions src/rattler_build_conda_compat/recipe_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import sys
import typing
from typing import Any, TypedDict
from typing import Any, List, TypedDict, Union

from .conditional_list import ConditionalList, visit_conditional_list

Expand All @@ -14,7 +14,7 @@
if typing.TYPE_CHECKING:
from collections.abc import Iterator, Mapping

OptionalUrlList = str | list[str] | None
OptionalUrlList = Union[str, List[str], None]


class Source(TypedDict):
Expand Down
56 changes: 27 additions & 29 deletions src/rattler_build_conda_compat/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,35 +68,33 @@ def render_recipes(self, variants) -> List[Dict]:
platform_and_arch = f"{self.config.platform}-{self.config.arch}"

try:
with (
tempfile.NamedTemporaryFile(mode="w+") as outfile,
tempfile.NamedTemporaryFile(mode="w") as variants_file,
):
# dump variants in our variants that will be used to generate recipe
if variants:
yaml.dump(variants, variants_file, default_flow_style=False)

variants_path = variants_file.name

run_args = [
"rattler-build",
"build",
"--render-only",
"--recipe",
self.path,
"--target-platform",
platform_and_arch,
"--build-platform",
platform_and_arch,
]

if variants:
run_args.extend(["-m", variants_path])
subprocess.run(run_args, check=True, stdout=outfile, env=os.environ)

outfile.seek(0)
content = outfile.read()
metadata = json.loads(content)
with tempfile.NamedTemporaryFile(mode="w+") as outfile:
with tempfile.NamedTemporaryFile(mode="w") as variants_file:
# dump variants in our variants that will be used to generate recipe
if variants:
yaml.dump(variants, variants_file, default_flow_style=False)

variants_path = variants_file.name

run_args = [
"rattler-build",
"build",
"--render-only",
"--recipe",
self.path,
"--target-platform",
platform_and_arch,
"--build-platform",
platform_and_arch,
]

if variants:
run_args.extend(["-m", variants_path])
subprocess.run(run_args, check=True, stdout=outfile, env=os.environ)

outfile.seek(0)
content = outfile.read()
metadata = json.loads(content)
return metadata if isinstance(metadata, list) else [metadata]

except Exception as e:
Expand Down

0 comments on commit ecb8cde

Please sign in to comment.