Coder Social home page Coder Social logo

Comments (12)

minrk avatar minrk commented on July 22, 2024 1

Importing * is still probably the right thing to do, and relevance can be governed by __all__ in the files.

from traitlets.

NeilGirdhar avatar NeilGirdhar commented on July 22, 2024 1

Please don't merge the files. One reason for logical separation is that it makes things easy to understand. At the very least, the TraitType subclasses should each be in their own file, or at least in a separate file from the other class definitions.

Also, I don't understand this concern over startup time. On my laptop, traitlets is imported in half a microsecond.

from traitlets.

SylvainCorlay avatar SylvainCorlay commented on July 22, 2024

I guess we could separate things in multiple files, but we should probably wait for the main changes planned with #48 to be completed and the API to stabilize before we decide how to do this.

from traitlets.

minrk avatar minrk commented on July 22, 2024

@jasongrout after looking into it, I think it's largely our habit of liberally splitting files as proposed here that contributes most to the slow startup time. I'm actually investigating merging files elsewhere in our code.

I never thought I'd say this, but I wish Python had javascript-like module concatenation...

from traitlets.

jasongrout avatar jasongrout commented on July 22, 2024

Isn't that what zip modules are for? We can import from zip files.

from traitlets.

jasongrout avatar jasongrout commented on July 22, 2024

That's what the zipsafe option is about in setup.py, for example.

from traitlets.

jasongrout avatar jasongrout commented on July 22, 2024

Lazy imports could possible help too (see also the comments on zip modules): https://www.rfk.id.au/blog/entry/frozen-app-starting-faster/

from traitlets.

minrk avatar minrk commented on July 22, 2024

I'm not sure how much lazy imports can help IPython, since we use ~all of the files we import by the time objects are instantiated. I think we would have to refactor lots of code to delay instantiation. I doubt lazy imports would help much at all.

from traitlets.

SylvainCorlay avatar SylvainCorlay commented on July 22, 2024

ok, I was not especially thinking of complexity, but rather in terms of logical separation of features in different files.

from traitlets.

minrk avatar minrk commented on July 22, 2024

Please don't merge the files. One reason for logical separation is that it makes things easy to understand.

100% agreed, and that's why we habitually split files throughout IPython and Jupyter. traitlets.py is a rare exception, and I'm actually in support of splitting it up. What gives me pause is recent comments about IPython startup time. When a collection of projects have this same pattern, it adds up, and you get things like IPython taking ~1s to start up, most of which time is spent importing.

from traitlets.

NeilGirdhar avatar NeilGirdhar commented on July 22, 2024

@minrk It's true. My IPython takes a while to start up. I just use the notebook now and never close it :)

from traitlets.

rmorshea avatar rmorshea commented on July 22, 2024

I think we can close this for now.

from traitlets.

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.