Skip to content

[SYNPY-1798]: updated black to 26.3.1 and reran pre-commit#1341

Merged
linglp merged 4 commits intodevelopfrom
update-black
Apr 7, 2026
Merged

[SYNPY-1798]: updated black to 26.3.1 and reran pre-commit#1341
linglp merged 4 commits intodevelopfrom
update-black

Conversation

@linglp
Copy link
Copy Markdown
Contributor

@linglp linglp commented Mar 20, 2026

Problem:

There's a high security risk of black 23.3.0. I updated black to the latest version of 26.3.1
see: https://github.com/Sage-Bionetworks/synapsePythonClient/security/dependabot/42
Screenshot 2026-03-20 at 10 36 19 AM

Solution:

  • updated black in pre-commit to 26.3.1
  • updated lock file to match the latest version of black
  • re-installed pre-commit and ran it to fix all files

@linglp linglp changed the title [technical debt]: update black to 26.3.1 and rerun pre-commit [technical debt]: updated black to 26.3.1 and reran pre-commit Mar 20, 2026
@thomasyu888 thomasyu888 requested a review from andrewelamb March 20, 2026 16:50
7. Delete wiki pages

"""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to cause the line numbers in the tutorial to be incorrect by 1 line.

Copy link
Copy Markdown
Member

@BryanFauble BryanFauble left a 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 didn't see any logic changes, just formatting updates. LGTM!

@andrewelamb
Copy link
Copy Markdown
Contributor

@linglp Should we put min version of back in the setup.cfg file?

@linglp
Copy link
Copy Markdown
Contributor Author

linglp commented Mar 20, 2026

@andrewelamb

@linglp Should we put min version of back in the setup.cfg file?

I think if you just do pip install -e ".[dev]", it installs the latest version from PyPI at install time anyway.

@linglp linglp marked this pull request as ready for review March 23, 2026 16:25
@linglp linglp requested a review from a team as a code owner March 23, 2026 16:25
@thomasyu888 thomasyu888 changed the title [technical debt]: updated black to 26.3.1 and reran pre-commit [SYNPY-1798]: updated black to 26.3.1 and reran pre-commit Mar 31, 2026
@thomasyu888
Copy link
Copy Markdown
Member

Wait for 4.12 release to be completed to merge

Copilot AI review requested due to automatic review settings April 7, 2026 19:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the repository’s formatting/tooling baseline by bumping the black pre-commit hook to 26.3.1, regenerating the Pipenv lockfile, and applying the resulting reformatting across code, tests, and docs.

Changes:

  • Bumped black in .pre-commit-config.yaml to 26.3.1.
  • Updated Pipfile.lock to reflect the new formatter dependency set.
  • Ran pre-commit/black across the repo, producing mostly whitespace/format-only diffs (plus a few incidental code edits).

Reviewed changes

Copilot reviewed 82 out of 83 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/unit/synapseutils/unit_test_synapseutils_walk.py Reformatted multi-patch contexts
tests/unit/synapseutils/unit_test_synapseutils_sync.py Reformatted multi-patch contexts
tests/unit/synapseutils/unit_test_synapseutils_monitor.py Reformatted multi-patch contexts
tests/unit/synapseutils/unit_test_synapseutils_migrate.py Reformatted SQL triple-quote usage
tests/unit/synapseutils/unit_test_synapseutils_describe.py Reformatted multi-patch contexts
tests/unit/synapseutils/unit_test_synapseutils_copy.py Reformatted multi-patch contexts
tests/unit/synapseclient/unit_test_tables.py Reformatted multi-patch contexts
tests/unit/synapseclient/unit_test_get_permissions.py Added blank line after docstring
tests/unit/synapseclient/unit_test_Entity.py Tuple-unpacking style cleanup
tests/unit/synapseclient/unit_test_commandline.py Docstring normalization
tests/unit/synapseclient/services/unit_test_json_schema.py Added blank line after docstring
tests/unit/synapseclient/operations/unit_test_utility_operations.py Added blank line after docstring
tests/unit/synapseclient/models/unit_test_entityview.py Added blank line after docstring
tests/unit/synapseclient/models/synchronous/unit_test_docker.py Reformatted multi-patch contexts
tests/unit/synapseclient/models/async/unit_test_wiki_async.py Reformatted multi-patch/raises contexts
tests/unit/synapseclient/models/async/unit_test_submission_bundle_async.py Reformatted async-for binding
tests/unit/synapseclient/models/async/unit_test_submission_async.py Reformatted multi-patch contexts
tests/unit/synapseclient/models/async/unit_test_schema_organization_async.py Reformatted multi-patch contexts
tests/unit/synapseclient/models/async/unit_test_recordset_async.py Reformatted multi-patch contexts
tests/unit/synapseclient/models/async/unit_test_project_async.py Reformatted multi-patch contexts
tests/unit/synapseclient/models/async/unit_test_link_async.py Reformatted multi-patch contexts
tests/unit/synapseclient/models/async/unit_test_form_async.py Reformatted multi-patch contexts
tests/unit/synapseclient/models/async/unit_test_folder_async.py Reformatted multi-patch contexts
tests/unit/synapseclient/models/async/unit_test_file_async.py Reformatted multi-patch contexts
tests/unit/synapseclient/models/async/unit_test_evaluation_async.py Reformatted multi-patch contexts
tests/unit/synapseclient/models/async/unit_test_docker_async.py Reformatted multi-patch contexts
tests/unit/synapseclient/models/async/unit_test_curation_async.py Reformatted multi-patch contexts
tests/unit/synapseclient/extensions/unit_test_create_json_schema.py Reformatted nested open() contexts
tests/unit/synapseclient/extensions/test_schema_management.py Reformatted multi-patch contexts
tests/unit/synapseclient/core/upload/unit_test_multipart_upload.py Reformatted multi-patch contexts
tests/unit/synapseclient/core/unit_test_version_check.py Removed extra blank line
tests/unit/synapseclient/core/unit_test_sts_transfer.py Reformatted conditional expression
tests/unit/synapseclient/core/unit_test_remote_storage_file_wrappers.py Reformatted multi-patch contexts
tests/unit/synapseclient/core/unit_test_doze.py Added blank line after module docstring
tests/unit/synapseclient/core/unit_test_Cache.py Reformatted multi-patch contexts
tests/unit/synapseclient/core/multithread_download/unit_test_download_threads.py Reformatted multi-patch contexts
tests/unit/synapseclient/core/download/unit_test_download_async.py Reformatted multi-patch contexts
tests/unit/synapseclient/core/credentials/unit_test_cred_provider.py Reformatted multi-patch contexts
tests/unit/synapseclient/api/unit_test_web_services.py Added blank line after docstring
tests/unit/synapseclient/api/unit_test_entity_services.py Added blank line after docstring
tests/test_utils.py Trailing comma in signature
tests/integration/synapseclient/test_command_line_client.py Reformatted multi-patch contexts
tests/integration/synapseclient/operations/async/test_utility_operations_async.py Added blank line after docstring
tests/integration/synapseclient/operations/async/test_delete_operations_async.py Added blank line after docstring
tests/integration/synapseclient/models/async/test_submission_bundle_async.py Reformatted async-for binding
tests/integration/synapseclient/models/async/test_schema_organization_async.py Added blank line after docstring
tests/integration/synapseclient/models/async/test_form_async.py Added blank line after docstring
tests/integration/synapseclient/integration_test.py Reformatted nested string writes
tests/integration/synapseclient/extensions/curator/test_schema_management.py Added blank line after docstring
tests/integration/synapseclient/core/upload/test_multipart_upload.py Tuple-unpacking style cleanup
tests/integration/synapseclient/core/upload/test_multipart_upload_async.py Tuple-unpacking style cleanup
tests/integration/synapseclient/core/test_external_storage.py Reformatted multi-patch contexts
synapseutils/sync.py Formatting-only line wrapping
synapseutils/migrate_functions.py Formatting-only SQL string wrapping
synapseclient/models/schema_organization.py Trailing comma in signature
synapseclient/models/recordset.py Formatting-only ternary wrapping
synapseclient/models/protocols/docker_protocol.py Added blank line after docstring
synapseclient/models/mixins/table_components.py Formatting-only line wrapping
synapseclient/models/link.py Formatting-only ternary wrapping
synapseclient/models/file.py Formatting-only ternary wrapping
synapseclient/models/entityview.py Formatting-only ternary wrapping
synapseclient/models/curation.py Trailing comma in signature
synapseclient/models/annotations.py Signature formatting
synapseclient/models/agent.py Formatting-only line wrapping
synapseclient/extensions/curator/schema_generation.py Type-ignore spacing & commas
synapseclient/extensions/curator/record_based_metadata_task.py Added blank line after docstring
synapseclient/core/utils.py Trailing commas in signatures
synapseclient/core/transfer_bar.py Added blank line after docstring
synapseclient/core/otel_config.py Added blank line after docstring
synapseclient/core/models/custom_json.py Added blank line after docstring
synapseclient/core/dozer.py Added blank line after docstring
synapseclient/core/download/download_functions.py Formatting-only await wrapping
synapseclient/client.py Formatting-only line wrapping
synapseclient/api/file_services.py Tuple-unpacking style cleanup
synapseclient/api/docker_commit_services.py Added blank line after docstring
synapseclient/activity.py Formatting-only line wrapping
Pipfile.lock Updated lock for black 26.3.1
docs/tutorials/python/wiki.md Adjusted snippet line range
docs/tutorials/python/tutorial_scripts/wiki.py Added blank line after docstring
docs/tutorials/python/tutorial_scripts/upload_data_in_bulk.py Formatting-only line wrapping
docs/scripts/object_orientated_programming_poc/synapse_project.py Added blank line after docstring
.pre-commit-config.yaml Bumped black rev to 26.3.1
Comments suppressed due to low confidence (1)

tests/integration/synapseclient/test_command_line_client.py:947

  • The call to run(...) passes "synapse" "--skip-checks" which Python concatenates into a single argument ("synapse--skip-checks"). Since run() sets sys.argv directly from these items, this will prevent argparse from seeing --skip-checks and likely makes the test fail. Pass these as separate arguments (e.g., "synapse", "--skip-checks", ...).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +446 to +450
with (
patch.object(self.syn, "get", return_value=self.file_ent) as patch_syn_get,
patch.object(
self.syn, "restGET", side_effects=[permissions, access_requirements]
) as patch_rest_get,
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this patch context, patch.object(..., side_effects=[...]) uses an invalid keyword argument (side_effects). unittest.mock.patch expects side_effect, so this will raise a TypeError and the test will fail.

Copilot uses AI. Check for mistakes.
Comment on lines +482 to +486
file_handle_result: Dict[str, str] = (
await get_file_handle_for_download_async(
file_handle_id=file_handle_id,
synapse_id=synapse_id,
entity_type=entity_type,
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type annotation for file_handle_result is incorrect: get_file_handle_for_download_async(...) returns a nested dict (e.g., containing a fileHandle dict), not Dict[str, str]. This annotation is misleading and will break static type checking; consider using Dict[str, Any] / Mapping[str, Any] (or a TypedDict) instead.

Copilot uses AI. Check for mistakes.
@linglp linglp merged commit 4f0721e into develop Apr 7, 2026
32 checks passed
@linglp linglp deleted the update-black branch April 7, 2026 21:16
thomasyu888 pushed a commit that referenced this pull request Apr 15, 2026
* [SYNPY-1798]: updated black to 26.3.1 and reran pre-commit (#1341)

* update black to 26.3.1 and rerun pre-commit

* update the tutorial line

---------

Co-authored-by: Lingling Peng <lpeng@w290.local>
Co-authored-by: Lingling Peng <lpeng@Mac.SageCorpWiFi>

* [SYNPY-1764] Add Trivy container vulnerability scanning (#1346)

* [SYNPY-1764] Add Trivy container vulnerability scanning to Docker build

Add Trivy scanning to gate Docker image publication on GHCR. Both release
and develop Docker jobs now follow a build→scan→push pattern where images
are only pushed if no Critical/High unfixed vulnerabilities are found.

New workflows:
- trivy.yml: reusable Trivy scanning workflow with SARIF upload to GitHub Security tab
- docker_build.yml: reusable build/scan/push workflow for image rebuilds
- trivy_periodic_scan.yml: daily rescan of latest published image with auto-remediation

* Address PR review feedback from linglp and jaymedina

- Fix push jobs to load scanned tar instead of rebuilding (build.yml)
- Pin trivy-action to SHA for v0.35.0 to address supply chain attack
- Fix env.repo_name output using $GITHUB_OUTPUT (trivy_periodic_scan.yml)
- Pin all third-party actions to commit SHAs
- Remove unnecessary permissions on get-image-reference job
- Use !cancelled() for SARIF upload condition (trivy.yml)
- Use LOCAL_IMAGE_TAG env var instead of hardcoded string (docker_build.yml)
- Fix IMAGE_REFERENCES YAML line continuation

* Prevent infinite rebuild loop in periodic Trivy scan

Restructure trivy_periodic_scan.yml so the git tag is only created
after a successful rebuild (not before). If the rebuild still has
vulnerabilities, a GitHub issue is opened for manual triage instead
of looping endlessly.

- Rename bump-tag → compute-next-version (dry_run: true)
- Add create-tag job gated on update-image success
- Add alert-on-failure job that opens a GitHub issue with
  duplicate prevention when remediation fails

* pre-commit

* Update Trivy scan workflow to use previous tag and adjust image references

* Address PR review feedback

- Pin codeql-action/upload-sarif to SHA and upgrade to v3.35.1
- Guard update-image job on compute-next-version success
- Use absolute URL for Security tab link in auto-created issues

* Add actions read permission for Trivy scan job (#1355)

* Add optional ARTIFACT_NAME_SUFFIX input to Trivy workflow and update artifact naming (#1357)

* remove sort

---------

Co-authored-by: Lingling <55448354+linglp@users.noreply.github.com>
Co-authored-by: Lingling Peng <lpeng@w290.local>
Co-authored-by: Lingling Peng <lpeng@Mac.SageCorpWiFi>
Co-authored-by: BryanFauble <17128019+BryanFauble@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants