-
Notifications
You must be signed in to change notification settings - Fork 67
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
[SYNPY-1398] Support .[version]
syntax for input SynIDs
#1047
Conversation
Hello @jaymedina! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2024-01-25 22:27:28 UTC |
I had a to-do item in the description for deprecating the |
I think that is a good idea, but I think that would be a pretty big breaking change, and would require stakeholder feedback. Let's hold off for now until I can gather some of that feedback. One thought I had was to suggest the API itself to support the dot notation. I think both the web and this current feature branch are extracting the version and feeding it to the API. Another thing is this:
The |
I think it's ideal for the Python client behavior to reflect the API and web client as closely as possible, so this makes sense. Do we have anyone from PLATFORM team coming to the demo on Friday? It might also be good to get more feedback from users on how valuable the |
This test seems to be failing because there is already a File entity called After deleting my It looks like the Projects don't get deleted after integration tests run. I'm wondering why that is? I notice when I run integration tests locally the Projects remain in my Synapse Projects page indefinitely. Should we start an initiative to update tests so that we have complete teardowns after integration tests complate/fail, or is there a reason for Entities to stay up after the fact? @BryanFauble @thomasyu888 |
d5e7c5b
to
8c5ca72
Compare
8c5ca72
to
126c3e9
Compare
I'm thinking of handling this in two ways:
Aside from this, I think this PR is in a good state for a final review. Let me know if there are other ideas @thomasyu888 @BryanFauble |
I agree that it'll be confusing, but IMO we should let folks use I also put together the following code to show explicit examples of what you are talking about with
For a final version, should we support creating an Entity object like: |
I think that makes sense, and yes I can recycle the logic that splits up the synid from the version number. Are you suggesting folding this into the PR as well? |
We've agreed on how I implemented the changes for |
@jaymedina It's an option, but I don't think it's required for us to support at this exact moment. |
I've added this item to the Jira ticket for broader .version support across synpy: https://sagebionetworks.jira.com/browse/SYNPY-699 |
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!
@jaymedina I believe |
067a29d
to
f02ec28
Compare
Quality Gate passedThe SonarCloud Quality Gate passed, but some issues were introduced. 6 New issues |
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.
@jaymedina Just wanted to say this is great work and great reviews by @BryanFauble . I left some nits just for future reference, but no action required. Thanks everyone!
""" | ||
if utils.is_synapse_id_str(entity) or is_synapse_entity(entity): | ||
return self.restGET("/entity/%s/benefactor" % id_of(entity)) | ||
synid, _ = utils.get_synid_and_version(entity) | ||
return self.restGET("/entity/%s/benefactor" % synid) |
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.
Nit: in the future, when we see %
lets switch to f-string interpolation.
if "versionNumber" in obj: | ||
version = obj["versionNumber"] | ||
|
||
return id, version |
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.
Nit: Just a thought for the future, but tuples can be a bit risky because the order really matters. Look into namedtuples
for something more explicit.
# https://sagebionetworks.jira.com/browse/SYNPY-1425 | ||
|
||
|
||
def test_get_synid_and_version(): |
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.
Nit: Not to over-engineer the solution, but in the future, these are technically different test cases. For example, right now it would be harder to determine if Test 2 or Test 3 failed, but if you split them into separate tests OR use pytest.parametrize
(it it makes sense to) then it'd be easier to navigate.
problem
syncToSynapse
fails for provenance pointing to a specific version of a synID usingsyn[id].[version]
notation (e.g.syn1234.5
). This revisits the discussion on the Python client adding support for synID.[version]
notation.solution
The scope of this PR is constrained to allowing .version syntax in syncTo/FromSynapse
syn.get
andsynapse get
for the CLIsyncToSynapse
supports.[version]
notationsyncFromSynapse
supports.[version]
notationsyn.get
supports.[version]
notationsynapse get
command supports.[version]
notationtesting & preview
support for
syn.get(...)
:support for
synapse get
for CLI :support for
syncFromSynapse
:support for
syncToSynapse
: