Giter Site home page Giter Site logo

Remove Magical Import System about werkzeug HOT 7 CLOSED

pallets avatar pallets commented on May 9, 2024 2
Remove Magical Import System

from werkzeug.

Comments (7)

aenglander avatar aenglander commented on May 9, 2024 1

I think it would be reasonable to warn about deprecation in 0.x and deprecate in 1.0 as long as it's done well and an upgrade guide for 0.x to 1.0 is provided.

from werkzeug.

untitaker avatar untitaker commented on May 9, 2024

I think we still could autogenerate __all__ from globals(). The repetition is otherwise just too heavy IMO.

from werkzeug.

davidism avatar davidism commented on May 9, 2024

@mitsuhiko this issue only mentions removing the magic, and I'm assuming leaving the top-level imports. However, the docs have said for quite some time that the top-level imports will be removed completely and users should use specific imports: http://werkzeug.palletsprojects.com/en/0.15.x/transition/#automatically-rewriting-imports

I think using specific imports is preferable, and would like to phase out the top-level, but this has been open for 8.5 years now. Any opinion on what should happen? Basically, do we just remove the magic, or do we also remove the top-level imports?

from werkzeug.

davidism avatar davidism commented on May 9, 2024

With the current magic, PyCharm (and possibly other IDEs) has no idea what's going on and so it always uses specific imports. Removing the magic will make it more likely that users will import from the top-level because it will become more discoverable.

The top-level imports are somewhat haphazard as well. Perhaps a compromise would be a reduced set of just the common entry points into Werkzeug (Request, Response, Client, run_simple, etc.)

from werkzeug.

mitsuhiko avatar mitsuhiko commented on May 9, 2024

I somehow feel like changing this now will be super frustrating to users. I think at least we should not remove it with 1.0 but we could deprecate them with 1.0 (with a warning) and then remove them with 2.0.

from werkzeug.

davidism avatar davidism commented on May 9, 2024

The only problem with putting off removal until 2.0 is that there's no definite time when that happens. The deprecation warning would be around for a long time. We had this issue with Flask-SQLAlchemy, where a deprecation warning has been bugging people for years, although admittedly I handled that less well by making it visible by default instead of only during tests.

from werkzeug.

mitsuhiko avatar mitsuhiko commented on May 9, 2024

from werkzeug.

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.