anydi 0.18.1__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.
anydi-0.18.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Anton Ruhlov
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 all
13
+ 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 THE
21
+ SOFTWARE.
anydi-0.18.1/PKG-INFO ADDED
@@ -0,0 +1,102 @@
1
+ Metadata-Version: 2.1
2
+ Name: anydi
3
+ Version: 0.18.1
4
+ Summary: Dependency Injection library
5
+ Home-page: https://github.com/antonrh/pyxdi
6
+ License: MIT
7
+ Keywords: dependency injection,dependencies,di,async,asyncio,application
8
+ Author: Anton Ruhlov
9
+ Author-email: antonruhlov@gmail.com
10
+ Requires-Python: >=3.8,<4.0
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Environment :: Web Environment
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Information Technology
15
+ Classifier: Intended Audience :: System Administrators
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.8
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3 :: Only
25
+ Classifier: Programming Language :: Python :: 3.7
26
+ Classifier: Topic :: Internet
27
+ Classifier: Topic :: Software Development
28
+ Classifier: Topic :: Software Development :: Libraries
29
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
30
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
31
+ Classifier: Typing :: Typed
32
+ Provides-Extra: async
33
+ Provides-Extra: docs
34
+ Requires-Dist: anyio (>=3.6.2,<4.0.0) ; extra == "async"
35
+ Requires-Dist: mkdocs (>=1.4.2,<2.0.0) ; extra == "docs"
36
+ Requires-Dist: mkdocs-material (>=9.1.13,<10.0.0) ; extra == "docs"
37
+ Project-URL: Repository, https://github.com/antonrh/pyxdi
38
+ Description-Content-Type: text/markdown
39
+
40
+ # PyxDI
41
+
42
+ `PyxDI` is a modern, lightweight and async-friendly Python Dependency Injection library that leverages type annotations ([PEP 484](https://peps.python.org/pep-0484/))
43
+ to effortlessly manage dependencies in your applications.
44
+
45
+ [![CI](https://github.com/antonrh/pyxdi/actions/workflows/ci.yml/badge.svg)](https://github.com/antonrh/pyxdi/actions/workflows/ci.yml)
46
+ [![codecov](https://codecov.io/gh/antonrh/pyxdi/branch/main/graph/badge.svg?token=67CLD19I0C)](https://codecov.io/gh/antonrh/pyxdi)
47
+ [![Documentation Status](https://readthedocs.org/projects/pyxdi/badge/?version=latest)](https://pyxdi.readthedocs.io/en/latest/?badge=latest)
48
+
49
+ ---
50
+ Documentation
51
+
52
+ http://pyxdi.readthedocs.io/
53
+
54
+ ---
55
+
56
+ ## Requirements
57
+
58
+ Python 3.8+
59
+
60
+ and optional dependencies:
61
+
62
+ * [anyio](https://github.com/agronholm/anyio) (for supporting synchronous resources with an asynchronous runtime)
63
+
64
+
65
+ ## Installation
66
+
67
+ Install using `pip`:
68
+
69
+ ```shell
70
+ pip install pyxdi
71
+ ```
72
+
73
+ or using `poetry`:
74
+
75
+ ```shell
76
+ poetry add pyxdi
77
+ ```
78
+
79
+ ## Quick Example
80
+
81
+ *app.py*
82
+
83
+ ```python
84
+ from pyxdi import dep, PyxDI
85
+
86
+ di = PyxDI()
87
+
88
+
89
+ @di.provider(scope="singleton")
90
+ def message() -> str:
91
+ return "Hello, world!"
92
+
93
+
94
+ @di.inject
95
+ def say_hello(message: str = dep) -> None:
96
+ print(message)
97
+
98
+
99
+ if __name__ == "__main__":
100
+ say_hello()
101
+ ```
102
+
anydi-0.18.1/README.md ADDED
@@ -0,0 +1,62 @@
1
+ # PyxDI
2
+
3
+ `PyxDI` is a modern, lightweight and async-friendly Python Dependency Injection library that leverages type annotations ([PEP 484](https://peps.python.org/pep-0484/))
4
+ to effortlessly manage dependencies in your applications.
5
+
6
+ [![CI](https://github.com/antonrh/pyxdi/actions/workflows/ci.yml/badge.svg)](https://github.com/antonrh/pyxdi/actions/workflows/ci.yml)
7
+ [![codecov](https://codecov.io/gh/antonrh/pyxdi/branch/main/graph/badge.svg?token=67CLD19I0C)](https://codecov.io/gh/antonrh/pyxdi)
8
+ [![Documentation Status](https://readthedocs.org/projects/pyxdi/badge/?version=latest)](https://pyxdi.readthedocs.io/en/latest/?badge=latest)
9
+
10
+ ---
11
+ Documentation
12
+
13
+ http://pyxdi.readthedocs.io/
14
+
15
+ ---
16
+
17
+ ## Requirements
18
+
19
+ Python 3.8+
20
+
21
+ and optional dependencies:
22
+
23
+ * [anyio](https://github.com/agronholm/anyio) (for supporting synchronous resources with an asynchronous runtime)
24
+
25
+
26
+ ## Installation
27
+
28
+ Install using `pip`:
29
+
30
+ ```shell
31
+ pip install pyxdi
32
+ ```
33
+
34
+ or using `poetry`:
35
+
36
+ ```shell
37
+ poetry add pyxdi
38
+ ```
39
+
40
+ ## Quick Example
41
+
42
+ *app.py*
43
+
44
+ ```python
45
+ from pyxdi import dep, PyxDI
46
+
47
+ di = PyxDI()
48
+
49
+
50
+ @di.provider(scope="singleton")
51
+ def message() -> str:
52
+ return "Hello, world!"
53
+
54
+
55
+ @di.inject
56
+ def say_hello(message: str = dep) -> None:
57
+ print(message)
58
+
59
+
60
+ if __name__ == "__main__":
61
+ say_hello()
62
+ ```
@@ -0,0 +1,98 @@
1
+ [tool.poetry]
2
+ name = "anydi"
3
+ version = "0.18.1"
4
+ description = "Dependency Injection library"
5
+ authors = ["Anton Ruhlov <antonruhlov@gmail.com>"]
6
+ license = "MIT"
7
+ readme = "README.md"
8
+ repository = "https://github.com/antonrh/pyxdi"
9
+ keywords = ["dependency injection", "dependencies", "di", "async", "asyncio", "application"]
10
+ classifiers = [
11
+ "Intended Audience :: Information Technology",
12
+ "Intended Audience :: System Administrators",
13
+ "Operating System :: OS Independent",
14
+ "Development Status :: 5 - Production/Stable",
15
+ "Topic :: Internet",
16
+ "Topic :: Software Development :: Libraries :: Application Frameworks",
17
+ "Topic :: Software Development :: Libraries :: Python Modules",
18
+ "Topic :: Software Development :: Libraries",
19
+ "Topic :: Software Development",
20
+ "Typing :: Typed",
21
+ "Environment :: Web Environment",
22
+ "Intended Audience :: Developers",
23
+ "License :: OSI Approved :: MIT License",
24
+ "Programming Language :: Python :: 3",
25
+ "Programming Language :: Python :: 3.7",
26
+ "Programming Language :: Python :: 3.8",
27
+ "Programming Language :: Python :: 3.9",
28
+ "Programming Language :: Python :: 3.10",
29
+ "Programming Language :: Python :: 3.11",
30
+ "Programming Language :: Python :: 3.12",
31
+ "Programming Language :: Python :: 3 :: Only",
32
+ ]
33
+ packages = [
34
+ { include = "pyxdi", from = "." },
35
+ ]
36
+
37
+ [tool.poetry.dependencies]
38
+ python = "^3.8"
39
+ anyio = { version = "^3.6.2", optional = true }
40
+ mkdocs = { version = "^1.4.2", optional = true }
41
+ mkdocs-material = { version = "^9.1.13", optional = true }
42
+
43
+ [tool.poetry.extras]
44
+ docs = ["mkdocs", "mkdocs-material"]
45
+ async = ["anyio"]
46
+
47
+ [tool.poetry.group.dev.dependencies]
48
+ mypy = "^1.8.0"
49
+ ruff = "^0.1.13"
50
+ pytest = "^7.4.3"
51
+ pytest-cov = "^4.0.0"
52
+ fastapi = "^0.95.1"
53
+ httpx = "^0.26.0"
54
+
55
+ [tool.ruff]
56
+ line-length = 88
57
+
58
+ [tool.ruff.lint]
59
+ select = ["A", "B", "C", "E", "F", "I", "W", "TID252", "T20"]
60
+ ignore = ["A003", "B008", "B009", "B010", "D104", "D107"]
61
+
62
+ [tool.ruff.isort]
63
+ combine-as-imports = true
64
+ forced-separate = ["tests", "app"]
65
+
66
+ [tool.ruff.pydocstyle]
67
+ convention = "google"
68
+
69
+ [tool.mypy]
70
+ python_version = "3.10"
71
+ strict = true
72
+
73
+ [tool.pytest.ini_options]
74
+ addopts = [
75
+ "--strict-config",
76
+ "--strict-markers",
77
+ ]
78
+ xfail_strict = true
79
+ junit_family = "xunit2"
80
+
81
+ [tool.coverage.report]
82
+ exclude_also = [
83
+ "pragma: no cover",
84
+ "@abstractmethod",
85
+ "@abc.abstractmethod",
86
+ "if TYPE_CHECKING",
87
+ "if t.TYPE_CHECKING",
88
+ "@overload",
89
+ "@t.overload",
90
+ "raise NotImplementedError",
91
+ "except ImportError:",
92
+ "if has_signature_eval_str_arg",
93
+ "if not anyio:",
94
+ ]
95
+
96
+ [build-system]
97
+ requires = ["poetry-core>=1.0.0"]
98
+ build-backend = "poetry.core.masonry.api"
@@ -0,0 +1,26 @@
1
+ """PyxDI public objects and functions."""
2
+ from typing import Any
3
+
4
+ from ._container import Container, request, singleton, transient
5
+ from ._module import Module, provider
6
+ from ._scanner import inject
7
+ from ._types import Marker, Provider, Scope
8
+
9
+
10
+ def auto() -> Any:
11
+ """A marker for automatic dependency injection."""
12
+ return Marker()
13
+
14
+
15
+ __all__ = [
16
+ "Container",
17
+ "Module",
18
+ "Provider",
19
+ "Scope",
20
+ "auto",
21
+ "inject",
22
+ "provider",
23
+ "request",
24
+ "singleton",
25
+ "transient",
26
+ ]