Comments (8)
If you're going to implement it, I'll keep it open.
from litestar.
Hi @Bobronium. This will be a breaking change because the test client etc. are returned from the bottom level __init__
at present.
from litestar.
@Goldziher, indeed. How big of an issue is that? Is that the only issue you see in the proposal?
from litestar.
Well it is. I understand if you want to make it an extra to remove it from the production code - that's fine. But a breaking change is a problem. Is there a way to add it to extra and have it as the default install path? Otherwise I think this is a no go TBH. The other issue is documentation - it needs to be made clear that this is required for the testing component etc.
from litestar.
We can overcome this by declaring __getattr__
in init.py (PEP 562) to make smooth transition then:
cat starlight/__init__.py
...
def __getattr__(name: str):
if name not in {"TestClient", "create_test_client", "create_test_request"}:
raise AttributeError()
import warnings
warnings.warn(f"Importing {name} from {__package__} is deprecated, use `from startlite.testing import {name}` instead", DeprecationWarning, stacklevel=2)
from . import testing
attr = globals()[name] = getattr(testing, name)
return attr
python -c "from starlite import TestClient; print(TestClient)"
<string>:1: DeprecationWarning: Importing TestClient from starlite is deprecated, use `from startlite.testing impory TestClient` instead
<class 'starlite.testing.TestClient'>
from litestar.
go ahead and make a PR if it's not a big issue. @peterschutt and myself will check it out - I am apprehensive about breaking code for users TBH, but i am will to test it first.
Thanks for contributing!
from litestar.
So, should I close this issue?
from litestar.
If you don't consider this an issue, sure.
I'm still positive on implementing this. Just haven't have time to do it yet.
from litestar.
Related Issues (20)
- Bug: SerializationException when running modeling-and-features demo from docs HOT 3
- Bug: Can't convert sqlalchemy model to pydantic model which is inherited from BaseModel HOT 1
- Enhancement: Add Pydantic's error dictionary to ValidationException's extra dict
- Enhancement: make `SessionMiddleware` return custom types HOT 3
- Bug: OpenAPI docs fail to generate with certain validators and pydantic v1 HOT 3
- Bug: Multi-body response incompatible with LoggingMiddleware HOT 2
- Bug: test failures
- Bug: `return_dto` is silently ignored if return data type does not match DTO definition HOT 1
- Bug: Test error
- Enhancement: add `default_json_serializer` to `__all__` in `litestar.logging.config`
- Docs: Migrating to Litestar from Django HOT 1
- Decoupled, transactional communication of domain events and commands
- Docs: Support for domain driven designs
- Enhancement: Repository pattern interfaces HOT 1
- Enhancement: Kubernetes application health endpoints HOT 1
- Enhancement: Allow status code categories in route handlers responses
- Enhancement: Provide option to set DTOs for nested fields HOT 7
- Bug: mounted app path interferes with regular paths HOT 4
- Examples not shown when using DTO HOT 1
- Bug: LoggingMiddleware breaks static file serving
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 litestar.