Giter Club home page Giter Club logo

Comments (5)

provinzkraut avatar provinzkraut commented on July 19, 2024

I agree that we shouldn't just monkey-patch things out of the box.

I'm curious however what your use case is that involves making use of the Litestar CLI and typer simultaneously?

from litestar.

scott2b avatar scott2b commented on July 19, 2024

I am not using LItestar CLI, other than my assumption that it is perhaps used for the litestar command itself. I typically use a mix of Typer, argparse, and sometimes Click for building out command line tools such as administrative utilities, backend processing, etc.

It is not so much that I am using them "simultaneously", i.e. Litestar would typically run in its own runtime environment from whatever utilities and processes I have. The issue is more that they share the same code. The ORM code is a particularly strong case in point, although I don't really expect that to be the only conflict. In my case however, it does seem that orm code is directly implicated: I ran into this issue trying to build a typer-based utility and traced the issue's source through interdependencies between Litestar itself and advanced-alchemy. Even if you are not using Litestar CLI directly, indirect imports will cause the patch to happen. At least I have found this to be the case when advanced-alchemy is being used. I have not yet tried to isolate this issue in a codebase that does not utilize advanced-alchemy.

from litestar.

scott2b avatar scott2b commented on July 19, 2024

Ok, looking back at the code I provided, and digging through my history of chasing this down, I see the point you are making. I do not have any examples of imports from Litestar proper that cause this problem other than the one above of directly importing litestar.cli. In this sense, I see your point about them being simultaneous.

However, if you install litestar[sqlalchemy] and make just about any import from advanced-alchemy, the issue will show itself. This happens due to a number of interdependent imports within advanced-alchemy that result in the cli module being loaded and the implicit patch executed.

So, yes, depending on your perspective, you might consider this to be more of an advanced-alchemy issue than a Litestar issue. I suppose it comes down to whether or not any other similar implicit imports might happen within Litestar per se, and/or whether general click interoperability is something you see as a priority.


Clarification: advanced-alchemy imports do not have to be direct to show this issue. E.g., the mcve shows an import via litestar.contrib

from litestar.

github-actions avatar github-actions commented on July 19, 2024

This issue has been closed in #3570. The change will be included in the upcoming patch release.

from litestar.

github-actions avatar github-actions commented on July 19, 2024

A fix for this issue has been released in v2.9.1

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.