Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support injecting via generics #6

Merged
merged 43 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
d52016f
Experiment with child container mechanism
SimonHeybrock Jun 9, 2023
ab65e6d
Experiments
SimonHeybrock Jul 6, 2023
f0f1941
Remove dead-end ideas
SimonHeybrock Jul 6, 2023
1a960eb
Remove 'make_child_container'
SimonHeybrock Jul 7, 2023
f651c23
Cleanup
SimonHeybrock Jul 7, 2023
a232787
Properly working parametrized_domain_type
SimonHeybrock Jul 10, 2023
7912185
Add NumPy to test requirements
SimonHeybrock Jul 10, 2023
fbf47cc
Exploring different solutions to mypy problems
SimonHeybrock Jul 11, 2023
7acfffb
Begin refactor
SimonHeybrock Jul 11, 2023
b0c86a4
Cleanup
SimonHeybrock Jul 11, 2023
7a7990e
Remove old implementation
SimonHeybrock Jul 11, 2023
c858502
Refactor tests
SimonHeybrock Jul 11, 2023
6a8afd1
Remove unused code
SimonHeybrock Jul 11, 2023
1ff5f26
Simplify
SimonHeybrock Jul 11, 2023
aed0367
Some mypy fixes
SimonHeybrock Jul 11, 2023
d96d022
Remove unused tests
SimonHeybrock Jul 11, 2023
4750732
Drop 'injector' dependency
SimonHeybrock Jul 11, 2023
c1a9b07
Cleanup
SimonHeybrock Jul 11, 2023
35ce11b
Remove 'lazy' argumentin favor of dedicated methods to fix mypy
SimonHeybrock Jul 11, 2023
ca9d62b
Fix more mypy
SimonHeybrock Jul 11, 2023
2cd0c62
Begin refactor to track individual TypeVar bindings
SimonHeybrock Jul 12, 2023
0e14c13
Cleanup and more testing
SimonHeybrock Jul 12, 2023
07e08b0
Support multiple partially bound instances of same generic
SimonHeybrock Jul 12, 2023
6115194
Raise if multiple providers match
SimonHeybrock Jul 12, 2023
54f8bc4
Refactor for passin mypy
SimonHeybrock Jul 12, 2023
6e1549b
Cleanup tests
SimonHeybrock Jul 12, 2023
6326663
Cleanup
SimonHeybrock Jul 12, 2023
6457edf
Forbit providers providing 'None'
SimonHeybrock Jul 12, 2023
a5cea72
Check for more errors
SimonHeybrock Jul 12, 2023
0049206
Test resolving multiple typevars
SimonHeybrock Jul 12, 2023
91f2c91
Use better exception type
SimonHeybrock Jul 12, 2023
0732354
NoneType is not available in older Python
SimonHeybrock Jul 12, 2023
dc54e9b
Remove complication of eager wrapping in delayed
SimonHeybrock Jul 12, 2023
e4b576f
Make mypy happier
SimonHeybrock Jul 12, 2023
676e914
Improve readability
SimonHeybrock Jul 12, 2023
3d943d4
Correct type hints
SimonHeybrock Jul 12, 2023
7486d30
More readability improvements
SimonHeybrock Jul 12, 2023
8bed356
Add UnboundTypeVar exception
SimonHeybrock Jul 12, 2023
5f1dc10
Fix mypy
SimonHeybrock Jul 12, 2023
f0e66b6
Pass mypy
SimonHeybrock Jul 13, 2023
d9bf747
Fix runtime
SimonHeybrock Jul 13, 2023
0609655
Fix mypy and tests
SimonHeybrock Jul 13, 2023
0363c3a
Small refactor for readability
SimonHeybrock Jul 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ classifiers = [
requires-python = ">=3.8"
dependencies = [
"dask",
"injector",
]
dynamic = ["version"]

Expand Down
1 change: 0 additions & 1 deletion requirements/base.in
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
dask
injector
14 changes: 5 additions & 9 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
# SHA1:436d53b37d30cc5f2a62b6ed730bcf46f1762d7b
# SHA1:b153fb0209b1ab0c52d1b98a28b498e4dc303498
#
# This file is autogenerated by pip-compile-multi
# To update, run:
#
# pip-compile-multi
#
click==8.1.3
click==8.1.4
# via dask
cloudpickle==2.2.1
# via dask
dask==2023.5.0
# via -r base.in
fsspec==2023.5.0
fsspec==2023.6.0
# via dask
importlib-metadata==6.6.0
importlib-metadata==6.8.0
# via dask
injector==0.20.1
# via -r base.in
locket==1.0.0
# via partd
packaging==23.1
Expand All @@ -29,7 +27,5 @@ toolz==0.12.0
# via
# dask
# partd
typing-extensions==4.6.3
# via injector
zipp==3.15.0
zipp==3.16.0
# via importlib-metadata
16 changes: 8 additions & 8 deletions requirements/ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ certifi==2023.5.7
# via requests
chardet==5.1.0
# via tox
charset-normalizer==3.1.0
charset-normalizer==3.2.0
# via requests
colorama==0.4.6
# via tox
distlib==0.3.6
# via virtualenv
filelock==3.12.0
filelock==3.12.2
# via
# tox
# virtualenv
gitdb==4.0.10
# via gitpython
gitpython==3.1.31
gitpython==3.1.32
# via -r ci.in
idna==3.4
# via requests
Expand All @@ -32,13 +32,13 @@ packaging==23.1
# -r ci.in
# pyproject-api
# tox
platformdirs==3.5.1
platformdirs==3.8.1
# via
# tox
# virtualenv
pluggy==1.0.0
pluggy==1.2.0
# via tox
pyproject-api==1.5.1
pyproject-api==1.5.3
# via tox
requests==2.31.0
# via -r ci.in
Expand All @@ -48,9 +48,9 @@ tomli==2.0.1
# via
# pyproject-api
# tox
tox==4.6.0
tox==4.6.4
# via -r ci.in
urllib3==2.0.3
# via requests
virtualenv==20.23.0
virtualenv==20.23.1
# via tox
59 changes: 38 additions & 21 deletions requirements/docs.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SHA1:58bb49d5210e2885ee4c5c48167d217012b5b723
# SHA1:c8d387b90560a2db42c26e33735a4f78ada867c3
#
# This file is autogenerated by pip-compile-multi
# To update, run:
Expand All @@ -13,8 +13,10 @@ alabaster==0.7.13
asttokens==2.2.1
# via stack-data
attrs==23.1.0
# via jsonschema
autodoc-pydantic==1.8.0
# via
# jsonschema
# referencing
autodoc-pydantic==1.9.0
# via -r docs.in
babel==2.12.1
# via
Expand All @@ -30,7 +32,7 @@ bleach==6.0.0
# via nbconvert
certifi==2023.5.7
# via requests
charset-normalizer==3.1.0
charset-normalizer==3.2.0
# via requests
comm==0.1.3
# via ipykernel
Expand All @@ -54,9 +56,11 @@ idna==3.4
# via requests
imagesize==1.4.1
# via sphinx
importlib-resources==5.12.0
# via jsonschema
ipykernel==6.23.1
importlib-resources==6.0.0
# via
# jsonschema
# jsonschema-specifications
ipykernel==6.24.0
# via -r docs.in
ipython==8.12.2
# via
Expand All @@ -70,13 +74,15 @@ jinja2==3.1.2
# nbconvert
# nbsphinx
# sphinx
jsonschema==4.17.3
jsonschema==4.18.0
# via nbformat
jupyter-client==8.2.0
jsonschema-specifications==2023.6.1
# via jsonschema
jupyter-client==8.3.0
# via
# ipykernel
# nbclient
jupyter-core==5.3.0
jupyter-core==5.3.1
# via
# ipykernel
# jupyter-client
Expand All @@ -85,7 +91,7 @@ jupyter-core==5.3.0
# nbformat
jupyterlab-pygments==0.2.2
# via nbconvert
markdown-it-py==2.2.0
markdown-it-py==3.0.0
# via
# mdit-py-plugins
# myst-parser
Expand All @@ -97,19 +103,19 @@ matplotlib-inline==0.1.6
# via
# ipykernel
# ipython
mdit-py-plugins==0.3.5
mdit-py-plugins==0.4.0
# via myst-parser
mdurl==0.1.2
# via markdown-it-py
mistune==2.0.5
mistune==3.0.1
# via nbconvert
myst-parser==1.0.0
myst-parser==2.0.0
# via -r docs.in
nbclient==0.8.0
# via nbconvert
nbconvert==7.4.0
nbconvert==7.6.0
# via nbsphinx
nbformat==5.9.0
nbformat==5.9.1
# via
# nbclient
# nbconvert
Expand All @@ -128,17 +134,17 @@ pickleshare==0.7.5
# via ipython
pkgutil-resolve-name==1.3.10
# via jsonschema
platformdirs==3.5.1
platformdirs==3.8.1
# via jupyter-core
prompt-toolkit==3.0.38
prompt-toolkit==3.0.39
# via ipython
psutil==5.9.5
# via ipykernel
ptyprocess==0.7.0
# via pexpect
pure-eval==0.2.2
# via stack-data
pydantic==1.10.9
pydantic==1.10.11
# via autodoc-pydantic
pydata-sphinx-theme==0.13.3
# via -r docs.in
Expand All @@ -149,8 +155,6 @@ pygments==2.15.1
# nbconvert
# pydata-sphinx-theme
# sphinx
pyrsistent==0.19.3
# via jsonschema
python-dateutil==2.8.2
# via jupyter-client
pytz==2023.3
Expand All @@ -159,8 +163,16 @@ pyzmq==25.1.0
# via
# ipykernel
# jupyter-client
referencing==0.29.1
# via
# jsonschema
# jsonschema-specifications
requests==2.31.0
# via sphinx
rpds-py==0.8.10
# via
# jsonschema
# referencing
six==1.16.0
# via
# asttokens
Expand Down Expand Up @@ -218,6 +230,11 @@ traitlets==5.9.0
# nbconvert
# nbformat
# nbsphinx
typing-extensions==4.7.1
# via
# ipython
# pydantic
# pydata-sphinx-theme
urllib3==2.0.3
# via requests
wcwidth==0.2.6
Expand Down
8 changes: 4 additions & 4 deletions requirements/static.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ cfgv==3.3.1
# via pre-commit
distlib==0.3.6
# via virtualenv
filelock==3.12.0
filelock==3.12.2
# via virtualenv
identify==2.5.24
# via pre-commit
nodeenv==1.8.0
# via pre-commit
platformdirs==3.5.1
platformdirs==3.8.1
# via virtualenv
pre-commit==3.3.2
pre-commit==3.3.3
# via -r static.in
pyyaml==6.0
# via pre-commit
virtualenv==20.23.0
virtualenv==20.23.1
# via pre-commit

# The following packages are considered to be unsafe in a requirements file:
Expand Down
1 change: 1 addition & 0 deletions requirements/test.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
-r base.in
numpy
pytest
10 changes: 6 additions & 4 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# SHA1:a035a60fcbac4cd7bf595dbd81ee7994505d4a95
# SHA1:3720d9b18830e4fcedb827ec36f6808035c1ea2c
#
# This file is autogenerated by pip-compile-multi
# To update, run:
#
# pip-compile-multi
#
-r base.txt
exceptiongroup==1.1.1
exceptiongroup==1.1.2
# via pytest
iniconfig==2.0.0
# via pytest
pluggy==1.0.0
numpy==1.24.4
# via -r test.in
pluggy==1.2.0
# via pytest
pytest==7.3.1
pytest==7.4.0
# via -r test.in
tomli==2.0.1
# via pytest
5 changes: 4 additions & 1 deletion src/sciline/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@
except importlib.metadata.PackageNotFoundError:
__version__ = "0.0.0"

from .container import Container, UnsatisfiedRequirement, make_container
from .container import AmbiguousProvider, Container, UnsatisfiedRequirement
from .domain import Scope

__all__ = ["AmbiguousProvider", "Container", "Scope", "UnsatisfiedRequirement"]
Loading