Comments (7)
Yes, I see what you mean. I agree that just importing the sharptab module shouldn't require importing all the other stuff that requires PySide.
It appears that when you run import sharppy.sharptab
, it executes all the statements in sharppy/__init__.py
, even though we only want the sharptab submodule. I suppose this makes sense, but it's still counter-intuitive to me. The decision to have all the __init__.py
files import all the submodules was made before I started working on SHARPpy. I'll have to decide what's the best course of action for resolving this.
from sharppy.
I have personally encountered this issue when trying to import on graphic-less servers as well.
To be honest, I didn't know much about how the import system was supposed to be structured, so that's how it ended up in the state it's in. I'm all in favor of changing it though. What's the best means of resolving this?
from sharppy.
Ditto. I've just been commenting out all references to PySide as a solution, however it's possible the "import pyside" statements could go in a "try, except" block with a message that it's not installed or not found. That should run upon import of any SHARPpy package.
from sharppy.
@wblumberg, that could work, but that doesn't take care of the unused imports that @aarande noted. The unused imports won't break things, but it uses unnecessary time and memory to load all that stuff and then never use it.
One method (and I think my favored one) would be to remove all import statements from the __init__.py
files. I've had issues with circular imports with all those in the past, so that would clear them up in the future.
The other method is try to figure out in sharppy/__init__.py
if we're just importing the sharptab module and, and if we are, bypass all the rest of the imports. This is not my favored method because a) it's an awful, awful hack and b) I don't know off the top of my head how we'd do it or if there's even a way to do it.
from sharppy.
Okay, I think I've successfully implemented the first method described in my previous post. It's checked into the xenia (development) branch.
from sharppy.
Thanks for your work on this! I just recently was able to grab the xenia release and work with it. It is working fine now but I am a little worried we may have taken this too far. I think we just needed to remove the imports from the top level sharppy init.py but not from sharptab. It would still be nice to be able to do from sharppy import sharptab and then be able to call things like sharptab.profile, sharptab.interp, etc. The problem came about because by calling from sharppy import sharptab it would run the init.py in sharppy which would import all the viz stuff. I worry a little about namespace collision now since have to do a from sharppy.sharptab import * or name the module level file. It can also get confusing to a user when they are using names like profile, interp, etc. It would keep things cleaner and avoid namespace collision if we were calling them by sharptab.profile, sharptab.interp, etc.
I will play around with this some more and let you know what I find and maybe submit a pull request.
Again thanks for all your work!
from sharppy.
The internal SHARPpy code makes frequent use of the import sharppy.sharptab.profile as profile
constructs, so might I suggest that, if you don't want to clutter up your namespace. We (I) decided to go with the "explicit is better than implicit" philosophy when re-designing the package imports. And a lot of the internal code was already imported that way, anyway.
from sharppy.
Related Issues (20)
- lhp calculation error
- [FEATURE] NUCAPS? HOT 14
- [BUG] When using the GFS model of sharppy to open Beijing, Shanghai and other Chinese regions, there is an error. There is no problem opening other regions such as the United States
- [BUG] Preferences window fails to open HOT 2
- Error could not figure out format custom sounding HOT 2
- [FEATURE] ACARS Soundings
- [BUG] name 'PYQT6' is not defined HOT 13
- Hodograph Issue HOT 1
- [BUG] app wont even run it either gives me a failed to execute warning or it prompts me a update message and crashed
- Convective Profile = NoneType HOT 3
- [BUG] Documentation issue - Interpreting GUI HOT 3
- CAPE Method Calculation Error
- [BUG] QTFont Error results in crashed SHARPpy GUI HOT 4
- upa files from weather.cod.edu/digatmos/upa/ HOT 4
- [BUG] SHARPpy Unable to Display Soundings on Ubuntu 18.04 - Crash in _getOutletWithProfile HOT 3
- [BUG] When selecting sounding source, GUI crashes, returning "QThread: Destroyed while thread is still running"
- [BUG]
- Errors in the Large Hail Parameter (LHP) calculation
- [BUG] mixed-layer parcel in parcelx and DefineParcel
- Question about mixed-layer parcel properties
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 sharppy.