Comments (12)
Importing *
is still probably the right thing to do, and relevance can be governed by __all__
in the files.
from traitlets.
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.
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.
@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.
Isn't that what zip modules are for? We can import from zip files.
from traitlets.
That's what the zipsafe option is about in setup.py, for example.
from traitlets.
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.
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.
ok, I was not especially thinking of complexity, but rather in terms of logical separation of features in different files.
from traitlets.
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.
@minrk It's true. My IPython takes a while to start up. I just use the notebook now and never close it :)
from traitlets.
I think we can close this for now.
from traitlets.
Related Issues (20)
- pull request blocked by "Enforce PR label / enforce-label (pull_request)" HOT 1
- Issues with trait typing HOT 12
- Consider using mypyc HOT 1
- Promise not to remove Sentinel?
- One test fails HOT 3
- Singletons configurable allow multiple instances HOT 2
- `__doc__` no longer contains the traitlets help string for reference type traitlets (Dict, List, ...) HOT 2
- Fix License metadata in PyPi package
- More typing edge cases
- Uncaught Exception `TypeError: 'ExtendedCompletionFinder' object is not callable` caused by orphaned pyc in site-packages HOT 5
- execution order of trait observers HOT 2
- Traitlets documentation incorrectly shows `__version__`
- Upgrade from traitlets `5.11.2` to `5.12.0` broke script HOT 1
- 5.13.0: pytest is failing with error in tests/test_typing.py HOT 1
- Changed behaviour since v5.12.0 of `traitlets.Set.set` if value is a string HOT 1
- Obeserve not works when showing result in widgets.Output()
- 26 tests fail
- test_complete_custom_completers failing HOT 4
- in get_type_hints(Appliction), TypeError: <class 'traitlets.traitlets.Dict'> is not a generic class HOT 1
- unobserve is not listed in the API in read the docs
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 traitlets.