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
Export as script #950
Open
remram44
wants to merge
55
commits into
master
Choose a base branch
from
export-as-script
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Export as script #950
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
remram44
force-pushed
the
export-as-script
branch
from
January 21, 2015 15:58
df42418
to
1615228
Compare
remram44
force-pushed
the
export-as-script
branch
3 times, most recently
from
April 23, 2015 20:32
27c9977
to
9c8dccd
Compare
remram44
force-pushed
the
export-as-script
branch
4 times, most recently
from
May 7, 2015 14:16
ee1dce0
to
e15a1b5
Compare
remram44
force-pushed
the
export-as-script
branch
from
May 13, 2015 19:48
e15a1b5
to
1dd7163
Compare
Only works for PythonSources right now core/modules/basic_modules.py: - PythonSource.to_python_script: Returns value of source parameter as string core/vistrail/controller.py: - write_workflow_to_python: *new Creates python script from workflow gui/vistrail_view.py: - export_python: *new Exports current workflow as python script gui/vistrails_window.py: New menu option Export Workflow as Python script
* Don't summon modules for nothing * 'indent' spelling
An unconnected port might be in the connected_input_ports dictionary, with associated value 0; check for that.
Slicing the proxy list messes up formatting.
remram44
force-pushed
the
export-as-script
branch
from
June 15, 2015 20:33
c7d4691
to
053db4d
Compare
Remove the re-export from core.scripting, import directly from core.scripting.export.
Instead of taking a filename to write to, return an iterable of unicode lines.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Translating a pipeline to a Python script.
Several things here.
Getting a piece of Python code from a single module
This is done through the
vistrails_module:Module#to_python_script()
function. Currently, modules need to provide that, but with a lot of magic we can probably get this from a package's code (at least in simple cases).In the general case, modules have code in functions outside of their compute() method, so this gets tricky. They can also be generated dynamically with weird closures and hidden state that we can't deal with automatically.
Assembling modules as a Python script
Once the code for each module as been collected, they need to be assembled into the final script. This includes:
UI
In addition to exporting a pipeline as a script, we might want to replace a module or a subpipeline with a PythonSource with the generated code (allowing the user to tweak it, at the cost of losing the tie with the package's code).
Work in progress. TODO: import back these scripts (add metadata for the importer as comments).