Sage-Bionetworks / synapsePythonClient

Programmatic interface to Synapse services for Python
https://www.synapse.org
Apache License 2.0
65 stars 67 forks source link

[SYNPY-1414] Project model finishing touches #1067

Closed BryanFauble closed 4 months ago

BryanFauble commented 4 months ago

Problem:

  1. Not all fields were being saved on the Project
  2. I missed the is_restricted flag at the folder level that gets passed to syn.store()
  3. We are not able to store projects or folders by ID only in a non-destructive way. When we did an upsert action (Called createOrUpdate) we did so only after we got an HTTP 409 conflict, but only if we did not specify the ID of the resource. This led to inconsistent behavior if you supplied an ID, instead of a name when saving resources like the Project.
  4. You could not specify project alias through the client before
  5. copy needed to be added to project
  6. Copy on the project/folder level could take in parameters that affect how files are copied
  7. Annotations were not copied over during a project copy

Solution:

  1. Adding missing fields to be saved on project
  2. Adding an is_restricted flag to the folder level
  3. Allow storing projects/folders by ID with an upsert by reading for the stored synapse instance if we didn't already communicate with Synapse for that instance before. Updating when an 'upsert' logic occurs to be before we attempt to persist anything to Synapse. First we do a check to find the ID of the resource being updated, and if found, retrieve the current state from Synapse. We then merge the object in Synapse to the requested changed - Only if there is an update will we then store the data via an HTTP PUT. If there are no change to be made we do not make the call. If the resource is not found in Synapse we perform a create via HTTP POST.
  4. Adding project alias
  5. Adding copy to Project
  6. Adding in project/folder level parameters for file copying
  7. Copy project annotations

Testing:

  1. Added the POC script for working with a project object
  2. Added unit/integration testing
pep8speaks commented 4 months ago

Hello @BryanFauble! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 1359:89: E501 line too long (97 > 88 characters)

Line 125:89: E501 line too long (89 > 88 characters) Line 153:89: E501 line too long (91 > 88 characters) Line 387:89: E501 line too long (89 > 88 characters) Line 389:89: E501 line too long (89 > 88 characters) Line 392:89: E501 line too long (90 > 88 characters)

Line 188:89: E501 line too long (91 > 88 characters) Line 233:89: E501 line too long (102 > 88 characters) Line 376:89: E501 line too long (99 > 88 characters) Line 442:89: E501 line too long (89 > 88 characters) Line 444:89: E501 line too long (89 > 88 characters) Line 447:89: E501 line too long (90 > 88 characters) Line 456:89: E501 line too long (89 > 88 characters) Line 463:89: E501 line too long (111 > 88 characters)

Line 555:89: E501 line too long (89 > 88 characters)

Line 469:89: E501 line too long (109 > 88 characters)

Comment last updated at 2024-02-15 21:20:43 UTC
sonarcloud[bot] commented 4 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues

Measures
0 Security Hotspots
97.2% Coverage on New Code
8.7% Duplication on New Code

See analysis details on SonarCloud