Skip to content

Commit 8bd7bdb

Browse files
🔧 Add configs for asyncer-slim (#152)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent c4411de commit 8bd7bdb

File tree

5 files changed

+51
-1
lines changed

5 files changed

+51
-1
lines changed

.github/workflows/publish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
matrix:
1919
package:
2020
- asyncer
21+
- asyncer-slim
2122
permissions:
2223
id-token: write
2324
steps:

.github/workflows/test-redistribute.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
matrix:
1717
package:
1818
- asyncer
19+
- asyncer-slim
1920
steps:
2021
- name: Dump GitHub context
2122
env:

asyncer/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.0.6"
1+
__version__ = "0.0.7.dev1"
22

33
from ._main import PendingValueException as PendingValueException
44
from ._main import SoonValue as SoonValue

pdm_build.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import os
2+
from typing import Any, Dict, List
3+
4+
from pdm.backend.hooks import Context
5+
6+
TIANGOLO_BUILD_PACKAGE = os.getenv("TIANGOLO_BUILD_PACKAGE", "asyncer")
7+
8+
9+
def pdm_build_initialize(context: Context) -> None:
10+
metadata = context.config.metadata
11+
# Get custom config for the current package, from the env var
12+
config: Dict[str, Any] = context.config.data["tool"]["tiangolo"][
13+
"_internal-slim-build"
14+
]["packages"][TIANGOLO_BUILD_PACKAGE]
15+
project_config: Dict[str, Any] = config["project"]
16+
# Get main optional dependencies, extras
17+
optional_dependencies: Dict[str, List[str]] = metadata.get(
18+
"optional-dependencies", {}
19+
)
20+
# Get custom optional dependencies name to always include in this (non-slim) package
21+
include_optional_dependencies: List[str] = config.get(
22+
"include-optional-dependencies", []
23+
)
24+
# Override main [project] configs with custom configs for this package
25+
for key, value in project_config.items():
26+
metadata[key] = value
27+
# Get custom build config for the current package
28+
build_config: Dict[str, Any] = (
29+
config.get("tool", {}).get("pdm", {}).get("build", {})
30+
)
31+
# Override PDM build config with custom build config for this package
32+
for key, value in build_config.items():
33+
context.config.build_config[key] = value
34+
# Get main dependencies
35+
dependencies: List[str] = metadata.get("dependencies", [])
36+
# Add optional dependencies to the default dependencies for this (non-slim) package
37+
for include_optional in include_optional_dependencies:
38+
optional_dependencies_group = optional_dependencies.get(include_optional, [])
39+
dependencies.extend(optional_dependencies_group)

pyproject.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ source-includes = [
5252
"scripts/",
5353
]
5454

55+
[tool.tiangolo._internal-slim-build.packages.asyncer-slim.project]
56+
name = "asyncer-slim"
57+
58+
[tool.tiangolo._internal-slim-build.packages.asyncer]
59+
# include-optional-dependencies = ["standard"]
60+
61+
[tool.tiangolo._internal-slim-build.packages.asyncer.project]
62+
optional-dependencies = {}
63+
5564
[tool.coverage.run]
5665
parallel = true
5766
source = [

0 commit comments

Comments
 (0)