Comments (2)
Thanks for looking into it @tlambert03, I think the workaround is simple enough for now.
from in-n-out.
yeah, I don't think this one is going to be possible, but i think it's more of a typer limitation than in-n-out, and I don't think there's anything (safe) we could do to help it along.
if I'm not mistaken, typer just doesn't support custom types? tiangolo/typer#77
so, as you no doubt found, removing in-n-out altogether from the example still gives the Type not yet supported error
when typer encounters thing: Thing
in the signature.
The very best we could do (and I don't like it) is to patch the __signature__
attribute of an in-n-out injected function to essentially remove injected types from the signature, so that typer simply doesn't see them when it inspects signatures here: https://github.com/tiangolo/typer/blob/50caff27573e0d1381701d24122ca9fed20d6343/typer/main.py#L548
... the problem with that is
- it's a lie: the parameters are still in the signature, and in-n-out does allow you to pass them to the function if you wish to override injection when calling the function.
- we actually don't know which parameters will be injected (at injection time). we only know it at call time (since providers can be registered at any point, even after decorating a function with
ino.inject
). So, even if we wanted to remove something, we wouldn't know it wasthing
that needed to be removed.
Since typer is its own dependency injection system, this one is probably going to be tough to pull off. but perhaps if tiangolo/typer#77 is addressed, we could extend support for it
from in-n-out.
Related Issues (20)
- Tests failing in CI
- Register a processor which has injections HOT 5
- Loosen cython reqs HOT 4
- Mock obj `resolve_single_type_hints` results in empty `globalns`, preventing resolve HOT 3
- Tests failing
- Tests failing
- Tests failing
- Tests failing
- Tests failing
- Tests failing
- Tests failing
- Tests failing
- Tests failing
- Tests failing
- Tests failing
- Tests failing
- Tests failing in ${WORKFLOW_NAME}
- Tests failing in CI
- Object in localns but signature of inner function not resolved HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from in-n-out.