-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allows to have main program file in a directory. #238
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #238 +/- ##
==========================================
- Coverage 63.08% 63.03% -0.06%
==========================================
Files 168 168
Lines 17838 17959 +121
Branches 2051 2066 +15
==========================================
+ Hits 11253 11320 +67
- Misses 5995 6038 +43
- Partials 590 601 +11 ☔ View full report in Codecov by Sentry. |
I need a bit of guidance on how to test this. I think I need to edit the tool spec manually somehow but I'm not sure how. And this only works in Python basic console and when executing in 'source directory', right? |
Let's say your main program is scripts/run.py.
Just noting that 'includes_main_path' is using a relative address starting from the tool specification location, which is not what we really want - the relative location should start from 'root_directory' (or 'source code root directory' to be more descriptive), but this quick fix does not address that yet. So, we should, later, replace 'includes_main_path' with 'source_code_root_directory'. I actually started doing that, but then I realized that 'source_code_root_directory' should be tool property rather than tool specification property (since it can and will differ between computers using the same tool spec - and even within computer if one has multiple versions of the same tool). |
Yes, this part works but what if your program needs some data files? Let's say the root directory of your program is
then you have a data file
I don't think this works. Do we need to worry about a situation like this? |
- Enable saving & loading the while item is loaded - Enable undo/redo
Hey @jkiviluo, can you please test this? It should now be possible to make a Tool Spec which has the main program file in a directory, directly in the app, without doing any manual edits to Tool Spec .json files. to test:
What do you think? |
The root directory is not saved. When I set it up at first, the tool worked. But when I close project and open again, the root directory is gone (and it tries to execute in the sub-directory where the main program file is). And now I can't get it to work at all. Minor things:
|
- Fix saving root directory into local project settings - Edit root directory lineEdit placeholder text - Add label above root directory lineEdit - Browse root directory button now opens the file explorer in the project dir by default - Enable Clear buttons in both lineEdits in the Tool Properties
Saving the root directory and the first bullet point has been fixed in 02e3b80. |
I do see the relativepath/filename in the tool spec editor, so I'm not sure how to recreate this. Can you try and remove it and add it again (in the tool spec editor) and make sure that the Root directory path in the Tool properties is correct. |
Sorry, I cannot reproduce this either. Can you send me the specification (json) file? Or can you make a new Tool and a Tool Spec for that item from scratch and try again? |
I forgot to push a commit into SpineToolbox repo fix_main_program_in_folder branch earlier. It's now there. Make sure to pull that branch as well before testing. |
I haven't done extensive testing, but I haven't encountered problems while using this now branch now for a while. |
Is this feature needed for Gams and Julia programs as well? How about generic executables? |
Yes, all of them can have that. (In Erkka's old issue it was actually about GAMS) |
Traceback (after a crash) on Ubuntu. I opened and closed tool specification. Then, when trying to re-open it, it crashed. Traceback (most recent call last): |
…l specs that don't have a main program
I'm now catching this TypeError but the reason for the crash is most likely somewhere else. |
I think this is ready. This new feature should now work with all Tool Spec types (Python, Julia, Gams, Executables), in both Basic and Jupyter Consoles and in both source directory and work directory modes. Should I merge or do you (@jkiviluo) still know of any problems here? |
Fixes spine-tools/Spine-Toolbox#3020
Checklist before merging