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
MAINT: allow users to import id constants from api #508
Conversation
Thank you for the PR! A couple of things:
|
Thanks for the comments, I have two questions: 1 which other ids should be included? I actually discussed with a colleague in the same office, we thought that only these two are ids... 2 For the unit test, should I just implement an assert equal for the values imported from api vs from the ids? |
That's a good question - the goal here is that in the future, all imports from
That would work. It's always worth stepping back a bit before writing a unit test and asking exactly what should be tested: we're making a behaviour change for a reason (in this case so that Envisage users can import from So in this case, the key thing is to test that these constants are importable from |
@homosapien-lcy : Please do add a PR description when you get the chance. (Different projects have different coding standards, but on ETS projects every PR should have a description.) |
Got it! Just added |
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.
Thanks for the updates! I have a few minor style nitpicks - see line-by-line comments.
Please could you also add the new constants to the docstring at the top of api.py
? You should be able to use the :data:
Sphinx role for all of them.
envisage/api.py
Outdated
@@ -65,6 +65,9 @@ | |||
from .i_plugin_manager import IPluginManager | |||
from .i_service_registry import IServiceRegistry | |||
|
|||
from .ids import BINDINGS, COMMANDS, PREFERENCES, PREFERENCES_CATEGORIES, \ |
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.
Style note: on this project, we tend to break up long import lines to place the imports one-per-line. For an example, see the from .extension_point_binding
line below.
I'd also like to keep the imports alphabetically ordered as far as possible - this makes it easier for a code reader to scan the set of imports to see if something's there or not (and also helps to minimise merge conflicts in the event that two separate PRs both touch the import list). Please could you move this addition so that it's just before the from .import_manager
import?
envisage/tests/test_api.py
Outdated
import envisage.ids as ids | ||
|
||
|
||
class ApiTestCase(unittest.TestCase): |
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.
I suggest TestApi
, to match the name of the module. (We do have a few existing *TestCase
names, but in new code we should migrate away from that pattern.)
class ApiTestCase(unittest.TestCase): | |
class TestApi(unittest.TestCase): |
Thanks for updating the description! By the way, there's a bit of GitHub magic that's useful here: if you spell the issue reference as "Fixes #506", or "Closes #506", then when this PR is merged, the issue will be automatically closed. More details here: https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue |
Thank you so much! Closes #508 |
@mdickinson The changes you requested have been made |
@homosapien-lcy Thank you for the updates! I made a quick drive-by fix to the heading underlines. (Otherwise Sphinx will complain at some point.) I'll merge when the CI completes. |
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.
Updates look good; thank you.
Import ids constants in api, allow downstream users to import them from envisage.api.
Closes #506