-
Notifications
You must be signed in to change notification settings - Fork 26
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
Make example run from any directory #377
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we're missing __init__
files in envisage.examples
and envisage.examples.tests
. Apart from that the examples ran as expected.
Did you also test if these work as expected when run via etsdemo?
Thank you! Will be adding them back.
Yes, and the examples can be run from there. However since this PR does not move the files into
(where the script sits in the examples folder). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Do you have time to also work on a PR contributing the examples to etsdemo? If it can be done within a couple of days, i think it's worth holding the 5.0.0 release of envisage.
Yes it can be done in a couple of days. I can give this a try. Sorry for visiting the issue this late. |
* Make it possible to run example scripts from anywhere. * Add a docstring for the test case * Add missing __init__.py * Import abcdefg...
* Fix index slice in ExtensionPointChangedEvent when plugin changes (#357) * Turn off macOS builds on Travis CI (#375) This PR turns off expensive macOS builds on Travis CI. We'll eventually use GitHub Actions to replace these. * update changelog with backported PRs * Make example run from any directory (#377) * Make it possible to run example scripts from anywhere. * Add a docstring for the test case * Add missing __init__.py * Import abcdefg... * Refactor documentation links to source on GitHub (#379) * Refactor external links to demo examples from extension_points.rst * Update links to github in introduction.rst * Refactor substitutions * Group substitutions * Update other references to github links * Flake8 * Remove two other links to github that point to TraitsGUI * Remove redundant newlines * Maintain all substituions in the same place * Remove two redundant lines * Contribute examples to etsdemo (#380) * remove logging from hello world and motd * remove logging from other examples * move examples into envisage * update the single URL in docs/conf.py * add examples as package_data * add entry point * flake8 * add demo folder and update package_data based off code review suggestion * Update docs/source/conf.py Co-authored-by: Kit Choi <kitchoi@users.noreply.github.com> * rename and add test for entry point * move GUI_Application example into envisage/examples * move old examples into envisage/examples/demo/legacy * Revert "move old examples into envisage/examples/demo/legacy" This reverts commit c026040. * move old examples into a new subdirectory called legacy * add a readme to reference new location for examples Co-authored-by: Kit Choi <kitchoi@users.noreply.github.com> * more changelog updates * more changes to changelog Co-authored-by: Kit Choi <kitchoi@users.noreply.github.com> Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
* Fix index slice in ExtensionPointChangedEvent when plugin changes (#357) * Turn off macOS builds on Travis CI (#375) This PR turns off expensive macOS builds on Travis CI. We'll eventually use GitHub Actions to replace these. * update changelog with backported PRs * Make example run from any directory (#377) * Make it possible to run example scripts from anywhere. * Add a docstring for the test case * Add missing __init__.py * Import abcdefg... * Refactor documentation links to source on GitHub (#379) * Refactor external links to demo examples from extension_points.rst * Update links to github in introduction.rst * Refactor substitutions * Group substitutions * Update other references to github links * Flake8 * Remove two other links to github that point to TraitsGUI * Remove redundant newlines * Maintain all substituions in the same place * Remove two redundant lines * Contribute examples to etsdemo (#380) * remove logging from hello world and motd * remove logging from other examples * move examples into envisage * update the single URL in docs/conf.py * add examples as package_data * add entry point * flake8 * add demo folder and update package_data based off code review suggestion * Update docs/source/conf.py Co-authored-by: Kit Choi <kitchoi@users.noreply.github.com> * rename and add test for entry point * move GUI_Application example into envisage/examples * move old examples into envisage/examples/demo/legacy * Revert "move old examples into envisage/examples/demo/legacy" This reverts commit c026040. * move old examples into a new subdirectory called legacy * add a readme to reference new location for examples Co-authored-by: Kit Choi <kitchoi@users.noreply.github.com> * more changelog updates * more changes to changelog Co-authored-by: Kit Choi <kitchoi@users.noreply.github.com> Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
* Backports for 5.0.0 and update changelog (#378) * Fix index slice in ExtensionPointChangedEvent when plugin changes (#357) * Turn off macOS builds on Travis CI (#375) This PR turns off expensive macOS builds on Travis CI. We'll eventually use GitHub Actions to replace these. * update changelog with backported PRs * Make example run from any directory (#377) * Make it possible to run example scripts from anywhere. * Add a docstring for the test case * Add missing __init__.py * Import abcdefg... * Refactor documentation links to source on GitHub (#379) * Refactor external links to demo examples from extension_points.rst * Update links to github in introduction.rst * Refactor substitutions * Group substitutions * Update other references to github links * Flake8 * Remove two other links to github that point to TraitsGUI * Remove redundant newlines * Maintain all substituions in the same place * Remove two redundant lines * Contribute examples to etsdemo (#380) * remove logging from hello world and motd * remove logging from other examples * move examples into envisage * update the single URL in docs/conf.py * add examples as package_data * add entry point * flake8 * add demo folder and update package_data based off code review suggestion * Update docs/source/conf.py Co-authored-by: Kit Choi <kitchoi@users.noreply.github.com> * rename and add test for entry point * move GUI_Application example into envisage/examples * move old examples into envisage/examples/demo/legacy * Revert "move old examples into envisage/examples/demo/legacy" This reverts commit c026040. * move old examples into a new subdirectory called legacy * add a readme to reference new location for examples Co-authored-by: Kit Choi <kitchoi@users.noreply.github.com> * more changelog updates * more changes to changelog Co-authored-by: Kit Choi <kitchoi@users.noreply.github.com> Co-authored-by: Mark Dickinson <mdickinson@enthought.com> * add release date Co-authored-by: Kit Choi <kitchoi@users.noreply.github.com> Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
This approach may provide for solving #320 and resolves the import issues seen in #359.
This PR changes the main scripts in the examples such that they can be run from another directory while still be able to import the local packages. The (dirty) trick is to temporarily insert the directory path where the script is to
sys.path
(which is how it works when one runs the script from that directory).