Coder Social home page Coder Social logo

Comments (8)

Goldziher avatar Goldziher commented on May 23, 2024 1

If you're going to implement it, I'll keep it open.

from litestar.

Goldziher avatar Goldziher commented on May 23, 2024

Hi @Bobronium. This will be a breaking change because the test client etc. are returned from the bottom level __init__ at present.

from litestar.

Bobronium avatar Bobronium commented on May 23, 2024

@Goldziher, indeed. How big of an issue is that? Is that the only issue you see in the proposal?

from litestar.

Goldziher avatar Goldziher commented on May 23, 2024

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.

Bobronium avatar Bobronium commented on May 23, 2024

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.

Goldziher avatar Goldziher commented on May 23, 2024

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.

Goldziher avatar Goldziher commented on May 23, 2024

So, should I close this issue?

from litestar.

Bobronium avatar Bobronium commented on May 23, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.