Comments (4)
I looked into it and the extra time is completely covered by importlib_metadata.packages_distributions()
which we call inside audobject.core.utils.create_class_key()
:
audobject/audobject/core/utils.py
Lines 30 to 36 in d1f3dd8
It's unfortunate as we only have a different package name in very rare cases. So it would be better to call it only if really needed, but so far I don't see how to achieve this.
from audobject.
Maybe we can first try with module_name
and only if we cannot create the object call packages_distributions()
?
from audobject.
The package_name
is indeed only needed if autoinstall=True
, see
audobject/audobject/core/utils.py
Lines 104 to 108 in d1f3dd8
But the problem is we can only call packages_distributions()
when the package is already installed, so indeed at the time we are storing the object and not when loading it as the mapping from module_name
to package_name
is ambiguous.
packages_distributions()
is also collecting the information for all installed packages and not only for the package we require. Maybe we can look into the source code of packages_distributions()
, provide the module name as argument and use only the code we need.
from audobject.
The code inside importlib_metadata.packages_distributions()
does indeed loop over all packages, which might not be needed, compare https://github.com/python/importlib_metadata/blob/353c3dfe83e08b3c86f30d192c315501cef97454/importlib_metadata/__init__.py#L955-L969
from audobject.
Related Issues (20)
- BUG: Cannot inherit borrow, hide and resolvers
- Move static Object functions to module level? HOT 1
- Sub-package for resolver classes HOT 4
- DOC: provide more background information about function resolver
- OSError: could not get source code
- Default arguments are not preserved with serialized functions
- `root` not supported as name of hidden attribute HOT 9
- What to do if a callable object is passed instead of a function
- Support short ID HOT 7
- Store package name in YAML
- Fix handling of kwargs in constructor HOT 4
- Way to find out if object was loaded from YAML
- Decoding non-keyword arguments fails in derived class
- Deprecated warning HOT 2
- Do not encode value with resolver if it is None
- Support Python 3.11 HOT 2
- Error with latest importlib-metadata on MacOS HOT 7
- Remove usage of deprecated pkg_resources module
- Enhance DX & Type Safety with Typed Loading Methods
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 audobject.