depende 0.1.0__tar.gz → 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- depende-0.1.2/LICENSE +21 -0
- depende-0.1.2/PKG-INFO +99 -0
- depende-0.1.2/README.md +73 -0
- depende-0.1.2/pyproject.toml +133 -0
- depende-0.1.2/pyproject.toml.orig +132 -0
- depende-0.1.2/scripts/test.sh +9 -0
- depende-0.1.2/src/depende/__init__.py +2 -0
- depende-0.1.2/src/depende/main.py +19 -0
- depende-0.1.2/tests/test_depends.py +32 -0
- depende-0.1.0/PKG-INFO +0 -9
- depende-0.1.0/pyproject.toml +0 -17
- depende-0.1.0/src/depende/__init__.py +0 -2
- /depende-0.1.0/README.md → /depende-0.1.2/tests/__init__.py +0 -0
depende-0.1.2/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sebastián Ramírez
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
depende-0.1.2/PKG-INFO
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: depende
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: Dependency declarations for Python frameworks and tools
|
|
5
|
+
Author: Sebastián Ramírez
|
|
6
|
+
Author-email: Sebastián Ramírez <tiangolo@gmail.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
18
|
+
Classifier: Typing :: Typed
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Project-URL: Homepage, https://github.com/tiangolo/depende
|
|
21
|
+
Project-URL: Documentation, https://depende.tiangolo.com
|
|
22
|
+
Project-URL: Repository, https://github.com/tiangolo/depende
|
|
23
|
+
Project-URL: Issues, https://github.com/tiangolo/depende/issues
|
|
24
|
+
Project-URL: Changelog, https://depende.tiangolo.com/release-notes/
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
<p align="center">
|
|
28
|
+
<a href="https://depende.tiangolo.com"><img src="https://depende.tiangolo.com/img/logo-margin/logo-margin-vector.svg#only-light" alt="Depende"></a>
|
|
29
|
+
|
|
30
|
+
</p>
|
|
31
|
+
|
|
32
|
+
<p align="center">
|
|
33
|
+
<em>Dependency declarations for Python frameworks and tools.</em>
|
|
34
|
+
</p>
|
|
35
|
+
|
|
36
|
+
<p align="center">
|
|
37
|
+
<a href="https://github.com/tiangolo/depende/actions?query=workflow%3ATest+event%3Apush+branch%3Amain">
|
|
38
|
+
<img src="https://github.com/tiangolo/depende/actions/workflows/test.yml/badge.svg?event=push&branch=main" alt="Test">
|
|
39
|
+
</a>
|
|
40
|
+
<a href="https://pypi.org/project/depende">
|
|
41
|
+
<img src="https://img.shields.io/pypi/v/depende?color=%2334D058&label=pypi%20package" alt="Python package version">
|
|
42
|
+
</a>
|
|
43
|
+
</p>
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
**Documentation**: [https://depende.tiangolo.com](https://depende.tiangolo.com)
|
|
48
|
+
|
|
49
|
+
**Source Code**: [https://github.com/tiangolo/depende](https://github.com/tiangolo/depende)
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
`depende` provides small dependency declarations in the style of FastAPI for reuse by frameworks and tools.
|
|
54
|
+
|
|
55
|
+
## Install
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
uv add depende
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Or if using pip:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pip install depende
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Usage
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
from depende import Depends, DependsInfo
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
`Depends(...)` returns a frozen `DependsInfo` metadata object with:
|
|
74
|
+
|
|
75
|
+
- `dependency`: a callable dependency, or `None`
|
|
76
|
+
- `use_cache`: whether a framework may reuse the dependency result within its active solving context
|
|
77
|
+
- `scope`: an opaque framework-defined string, or `None`
|
|
78
|
+
|
|
79
|
+
The package only declares dependency metadata. It does not solve, execute, cache, inject request data, manage lifecycles, generate OpenAPI, or define framework-specific scopes.
|
|
80
|
+
|
|
81
|
+
## Example
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
from depende import Depends
|
|
85
|
+
from typing import Annotated
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def get_settings() -> dict[str, str]:
|
|
89
|
+
return {"mode": "prod"}
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
SettingsDep = Annotated[dict[str, str], Depends(get_settings, scope="command")]
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Frameworks decide what `scope` means and how dependency solving works.
|
|
96
|
+
|
|
97
|
+
## License
|
|
98
|
+
|
|
99
|
+
This project is licensed under the terms of the [MIT license](https://github.com/tiangolo/depende/blob/main/LICENSE).
|
depende-0.1.2/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://depende.tiangolo.com"><img src="https://depende.tiangolo.com/img/logo-margin/logo-margin-vector.svg#only-light" alt="Depende"></a>
|
|
3
|
+
|
|
4
|
+
</p>
|
|
5
|
+
|
|
6
|
+
<p align="center">
|
|
7
|
+
<em>Dependency declarations for Python frameworks and tools.</em>
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
<p align="center">
|
|
11
|
+
<a href="https://github.com/tiangolo/depende/actions?query=workflow%3ATest+event%3Apush+branch%3Amain">
|
|
12
|
+
<img src="https://github.com/tiangolo/depende/actions/workflows/test.yml/badge.svg?event=push&branch=main" alt="Test">
|
|
13
|
+
</a>
|
|
14
|
+
<a href="https://pypi.org/project/depende">
|
|
15
|
+
<img src="https://img.shields.io/pypi/v/depende?color=%2334D058&label=pypi%20package" alt="Python package version">
|
|
16
|
+
</a>
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
**Documentation**: [https://depende.tiangolo.com](https://depende.tiangolo.com)
|
|
22
|
+
|
|
23
|
+
**Source Code**: [https://github.com/tiangolo/depende](https://github.com/tiangolo/depende)
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
`depende` provides small dependency declarations in the style of FastAPI for reuse by frameworks and tools.
|
|
28
|
+
|
|
29
|
+
## Install
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
uv add depende
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Or if using pip:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pip install depende
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from depende import Depends, DependsInfo
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
`Depends(...)` returns a frozen `DependsInfo` metadata object with:
|
|
48
|
+
|
|
49
|
+
- `dependency`: a callable dependency, or `None`
|
|
50
|
+
- `use_cache`: whether a framework may reuse the dependency result within its active solving context
|
|
51
|
+
- `scope`: an opaque framework-defined string, or `None`
|
|
52
|
+
|
|
53
|
+
The package only declares dependency metadata. It does not solve, execute, cache, inject request data, manage lifecycles, generate OpenAPI, or define framework-specific scopes.
|
|
54
|
+
|
|
55
|
+
## Example
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from depende import Depends
|
|
59
|
+
from typing import Annotated
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def get_settings() -> dict[str, str]:
|
|
63
|
+
return {"mode": "prod"}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
SettingsDep = Annotated[dict[str, str], Depends(get_settings, scope="command")]
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Frameworks decide what `scope` means and how dependency solving works.
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
This project is licensed under the terms of the [MIT license](https://github.com/tiangolo/depende/blob/main/LICENSE).
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["uv_build>=0.9.11,<0.10.0"]
|
|
3
|
+
build-backend = "uv_build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "depende"
|
|
7
|
+
version = "0.1.2"
|
|
8
|
+
description = "Dependency declarations for Python frameworks and tools"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 4 - Beta",
|
|
15
|
+
"Intended Audience :: Developers",
|
|
16
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
17
|
+
"Programming Language :: Python :: 3.10",
|
|
18
|
+
"Programming Language :: Python :: 3.11",
|
|
19
|
+
"Programming Language :: Python :: 3.12",
|
|
20
|
+
"Programming Language :: Python :: 3.13",
|
|
21
|
+
"Programming Language :: Python :: 3.14",
|
|
22
|
+
"Programming Language :: Python :: 3.15",
|
|
23
|
+
"Typing :: Typed",
|
|
24
|
+
]
|
|
25
|
+
dependencies = []
|
|
26
|
+
|
|
27
|
+
[[project.authors]]
|
|
28
|
+
name = "Sebastián Ramírez"
|
|
29
|
+
email = "tiangolo@gmail.com"
|
|
30
|
+
|
|
31
|
+
[project.urls]
|
|
32
|
+
Homepage = "https://github.com/tiangolo/depende"
|
|
33
|
+
Documentation = "https://depende.tiangolo.com"
|
|
34
|
+
Repository = "https://github.com/tiangolo/depende"
|
|
35
|
+
Issues = "https://github.com/tiangolo/depende/issues"
|
|
36
|
+
Changelog = "https://depende.tiangolo.com/release-notes/"
|
|
37
|
+
|
|
38
|
+
[dependency-groups]
|
|
39
|
+
dev = [
|
|
40
|
+
{ include-group = "docs" },
|
|
41
|
+
{ include-group = "tests" },
|
|
42
|
+
"prek>=0.2.24,<1.0.0",
|
|
43
|
+
"zizmor >=1.23.1",
|
|
44
|
+
]
|
|
45
|
+
docs = [
|
|
46
|
+
"griffe-typingdoc >=0.3.0",
|
|
47
|
+
"griffe-warnings-deprecated >=1.1.0",
|
|
48
|
+
"markdown-include-variants >=0.0.8",
|
|
49
|
+
"mdx-include >=1.4.1",
|
|
50
|
+
"mkdocstrings[python] >=1.0.3",
|
|
51
|
+
"pyyaml >=5.3.1",
|
|
52
|
+
"typer >=0.24.1",
|
|
53
|
+
"zensical>=0.0.42",
|
|
54
|
+
]
|
|
55
|
+
github-actions = [
|
|
56
|
+
"httpx >=0.28.1",
|
|
57
|
+
"pydantic >=2.5.3",
|
|
58
|
+
"pydantic-settings >=2.1.0",
|
|
59
|
+
"pygithub >=2.3.0",
|
|
60
|
+
"smokeshow >=0.5.0",
|
|
61
|
+
]
|
|
62
|
+
tests = [
|
|
63
|
+
"coverage[toml] >=6.2",
|
|
64
|
+
"pytest >=8.4.0",
|
|
65
|
+
"ruff >=0.16.0",
|
|
66
|
+
"ty>=0.0.25",
|
|
67
|
+
]
|
|
68
|
+
|
|
69
|
+
[tool.coverage.run]
|
|
70
|
+
parallel = true
|
|
71
|
+
data_file = "coverage/.coverage"
|
|
72
|
+
source = [
|
|
73
|
+
"depende",
|
|
74
|
+
"tests",
|
|
75
|
+
]
|
|
76
|
+
context = "${CONTEXT}"
|
|
77
|
+
dynamic_context = "test_function"
|
|
78
|
+
relative_files = true
|
|
79
|
+
|
|
80
|
+
[tool.coverage.report]
|
|
81
|
+
show_missing = true
|
|
82
|
+
sort = "-Cover"
|
|
83
|
+
exclude_lines = [
|
|
84
|
+
"pragma: no cover",
|
|
85
|
+
"@overload",
|
|
86
|
+
'if __name__ == "__main__":',
|
|
87
|
+
"if TYPE_CHECKING:",
|
|
88
|
+
]
|
|
89
|
+
|
|
90
|
+
[tool.coverage.html]
|
|
91
|
+
show_contexts = true
|
|
92
|
+
|
|
93
|
+
[tool.ruff.lint]
|
|
94
|
+
select = [
|
|
95
|
+
"E",
|
|
96
|
+
"W",
|
|
97
|
+
"F",
|
|
98
|
+
"I",
|
|
99
|
+
"B",
|
|
100
|
+
"C4",
|
|
101
|
+
"UP",
|
|
102
|
+
]
|
|
103
|
+
ignore = [
|
|
104
|
+
"E501",
|
|
105
|
+
"B008",
|
|
106
|
+
"C901",
|
|
107
|
+
]
|
|
108
|
+
|
|
109
|
+
[tool.ty.terminal]
|
|
110
|
+
error-on-warning = true
|
|
111
|
+
|
|
112
|
+
[tool.typos.files]
|
|
113
|
+
extend-exclude = [
|
|
114
|
+
"coverage/",
|
|
115
|
+
"dist/",
|
|
116
|
+
"docs/img/",
|
|
117
|
+
"htmlcov/",
|
|
118
|
+
"site/",
|
|
119
|
+
"site_build/",
|
|
120
|
+
"uv.lock",
|
|
121
|
+
]
|
|
122
|
+
|
|
123
|
+
[tool.typos.default.extend-identifiers]
|
|
124
|
+
alls = "alls"
|
|
125
|
+
|
|
126
|
+
[tool.typos.default.extend-words]
|
|
127
|
+
Ines = "Ines"
|
|
128
|
+
|
|
129
|
+
[tool.uv.build-backend]
|
|
130
|
+
source-include = [
|
|
131
|
+
"scripts/test.sh",
|
|
132
|
+
"tests/**",
|
|
133
|
+
]
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["uv_build>=0.9.11,<0.10.0"]
|
|
3
|
+
build-backend = "uv_build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "depende"
|
|
7
|
+
version = "0.1.2"
|
|
8
|
+
description = "Dependency declarations for Python frameworks and tools"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
authors = [
|
|
12
|
+
{ name = "Sebastián Ramírez", email = "tiangolo@gmail.com" },
|
|
13
|
+
]
|
|
14
|
+
license = "MIT"
|
|
15
|
+
license-files = ["LICENSE"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
20
|
+
"Programming Language :: Python :: 3.10",
|
|
21
|
+
"Programming Language :: Python :: 3.11",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Programming Language :: Python :: 3.13",
|
|
24
|
+
"Programming Language :: Python :: 3.14",
|
|
25
|
+
"Programming Language :: Python :: 3.15",
|
|
26
|
+
"Typing :: Typed",
|
|
27
|
+
]
|
|
28
|
+
dependencies = []
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Homepage = "https://github.com/tiangolo/depende"
|
|
32
|
+
Documentation = "https://depende.tiangolo.com"
|
|
33
|
+
Repository = "https://github.com/tiangolo/depende"
|
|
34
|
+
Issues = "https://github.com/tiangolo/depende/issues"
|
|
35
|
+
Changelog = "https://depende.tiangolo.com/release-notes/"
|
|
36
|
+
|
|
37
|
+
[dependency-groups]
|
|
38
|
+
dev = [
|
|
39
|
+
{ include-group = "docs" },
|
|
40
|
+
{ include-group = "tests" },
|
|
41
|
+
"prek>=0.2.24,<1.0.0",
|
|
42
|
+
"zizmor >=1.23.1",
|
|
43
|
+
]
|
|
44
|
+
docs = [
|
|
45
|
+
"griffe-typingdoc >=0.3.0",
|
|
46
|
+
"griffe-warnings-deprecated >=1.1.0",
|
|
47
|
+
"markdown-include-variants >=0.0.8",
|
|
48
|
+
"mdx-include >=1.4.1",
|
|
49
|
+
"mkdocstrings[python] >=1.0.3",
|
|
50
|
+
"pyyaml >=5.3.1",
|
|
51
|
+
"typer >=0.24.1",
|
|
52
|
+
"zensical>=0.0.42",
|
|
53
|
+
]
|
|
54
|
+
github-actions = [
|
|
55
|
+
"httpx >=0.28.1",
|
|
56
|
+
"pydantic >=2.5.3",
|
|
57
|
+
"pydantic-settings >=2.1.0",
|
|
58
|
+
"pygithub >=2.3.0",
|
|
59
|
+
"smokeshow >=0.5.0",
|
|
60
|
+
]
|
|
61
|
+
tests = [
|
|
62
|
+
"coverage[toml] >=6.2",
|
|
63
|
+
"pytest >=8.4.0",
|
|
64
|
+
"ruff >=0.16.0",
|
|
65
|
+
"ty>=0.0.25",
|
|
66
|
+
]
|
|
67
|
+
|
|
68
|
+
[tool.coverage.run]
|
|
69
|
+
parallel = true
|
|
70
|
+
data_file = "coverage/.coverage"
|
|
71
|
+
source = [
|
|
72
|
+
"depende",
|
|
73
|
+
"tests",
|
|
74
|
+
]
|
|
75
|
+
context = '${CONTEXT}'
|
|
76
|
+
dynamic_context = "test_function"
|
|
77
|
+
relative_files = true
|
|
78
|
+
|
|
79
|
+
[tool.coverage.report]
|
|
80
|
+
show_missing = true
|
|
81
|
+
sort = "-Cover"
|
|
82
|
+
exclude_lines = [
|
|
83
|
+
"pragma: no cover",
|
|
84
|
+
"@overload",
|
|
85
|
+
'if __name__ == "__main__":',
|
|
86
|
+
"if TYPE_CHECKING:",
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
[tool.coverage.html]
|
|
90
|
+
show_contexts = true
|
|
91
|
+
|
|
92
|
+
[tool.ruff.lint]
|
|
93
|
+
select = [
|
|
94
|
+
"E", # pycodestyle errors
|
|
95
|
+
"W", # pycodestyle warnings
|
|
96
|
+
"F", # pyflakes
|
|
97
|
+
"I", # isort
|
|
98
|
+
"B", # flake8-bugbear
|
|
99
|
+
"C4", # flake8-comprehensions
|
|
100
|
+
"UP", # pyupgrade
|
|
101
|
+
]
|
|
102
|
+
ignore = [
|
|
103
|
+
"E501", # line too long
|
|
104
|
+
"B008", # do not perform function calls in argument defaults
|
|
105
|
+
"C901", # too complex
|
|
106
|
+
]
|
|
107
|
+
|
|
108
|
+
[tool.ty.terminal]
|
|
109
|
+
error-on-warning = true
|
|
110
|
+
|
|
111
|
+
[tool.typos.files]
|
|
112
|
+
extend-exclude = [
|
|
113
|
+
"coverage/",
|
|
114
|
+
"dist/",
|
|
115
|
+
"docs/img/",
|
|
116
|
+
"htmlcov/",
|
|
117
|
+
"site/",
|
|
118
|
+
"site_build/",
|
|
119
|
+
"uv.lock",
|
|
120
|
+
]
|
|
121
|
+
|
|
122
|
+
[tool.typos.default.extend-identifiers]
|
|
123
|
+
alls = "alls"
|
|
124
|
+
|
|
125
|
+
[tool.typos.default.extend-words]
|
|
126
|
+
Ines = "Ines"
|
|
127
|
+
|
|
128
|
+
[tool.uv.build-backend]
|
|
129
|
+
source-include = [
|
|
130
|
+
"scripts/test.sh",
|
|
131
|
+
"tests/**",
|
|
132
|
+
]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from collections.abc import Callable
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@dataclass(frozen=True, slots=True)
|
|
7
|
+
class DependsInfo:
|
|
8
|
+
dependency: Callable[..., Any] | None = None
|
|
9
|
+
use_cache: bool = True
|
|
10
|
+
scope: str | None = None
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def Depends(
|
|
14
|
+
dependency: Callable[..., Any] | None = None,
|
|
15
|
+
*,
|
|
16
|
+
use_cache: bool = True,
|
|
17
|
+
scope: str | None = None,
|
|
18
|
+
) -> DependsInfo:
|
|
19
|
+
return DependsInfo(dependency=dependency, use_cache=use_cache, scope=scope)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from dataclasses import FrozenInstanceError
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
from depende import Depends, DependsInfo
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def dependency() -> str:
|
|
9
|
+
return "value"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def test_depends_returns_depends_info() -> None:
|
|
13
|
+
info = Depends(dependency)
|
|
14
|
+
|
|
15
|
+
assert info == DependsInfo(dependency=dependency, use_cache=True, scope=None)
|
|
16
|
+
assert info.dependency is not None
|
|
17
|
+
assert info.dependency() == "value"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def test_depends_accepts_declaration_options() -> None:
|
|
21
|
+
info = Depends(dependency, use_cache=False, scope="command")
|
|
22
|
+
|
|
23
|
+
assert info.dependency is dependency
|
|
24
|
+
assert info.use_cache is False
|
|
25
|
+
assert info.scope == "command"
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def test_depends_info_is_frozen() -> None:
|
|
29
|
+
info = Depends()
|
|
30
|
+
|
|
31
|
+
with pytest.raises(FrozenInstanceError):
|
|
32
|
+
info.use_cache = False # type: ignore[misc] # ty: ignore[invalid-assignment]
|
depende-0.1.0/PKG-INFO
DELETED
depende-0.1.0/pyproject.toml
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
[project]
|
|
2
|
-
name = "depende"
|
|
3
|
-
version = "0.1.0"
|
|
4
|
-
description = "Add your description here"
|
|
5
|
-
readme = "README.md"
|
|
6
|
-
authors = [
|
|
7
|
-
{ name = "Sebastián Ramírez", email = "tiangolo@gmail.com" }
|
|
8
|
-
]
|
|
9
|
-
requires-python = ">=3.14"
|
|
10
|
-
dependencies = []
|
|
11
|
-
|
|
12
|
-
[project.scripts]
|
|
13
|
-
depende = "depende:main"
|
|
14
|
-
|
|
15
|
-
[build-system]
|
|
16
|
-
requires = ["uv_build>=0.9.11,<0.10.0"]
|
|
17
|
-
build-backend = "uv_build"
|
|
File without changes
|