Skip to content

Conversation

@manulera
Copy link
Owner

No description provided.

@codecov
Copy link

codecov bot commented Nov 27, 2025

Codecov Report

❌ Patch coverage is 99.62121% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 97.29%. Comparing base (7137e1d) to head (cce8455).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/opencloning/ncbi_requests.py 98.24% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #378      +/-   ##
==========================================
+ Coverage   96.83%   97.29%   +0.45%     
==========================================
  Files          28       29       +1     
  Lines        1642     1698      +56     
==========================================
+ Hits         1590     1652      +62     
+ Misses         52       46       -6     
Flag Coverage Δ
unittests 97.29% <99.62%> (+0.45%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@manulera manulera requested a review from Copilot November 28, 2025 18:54
Copilot finished reviewing on behalf of manulera November 28, 2025 18:55
Copy link

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

This pull request refactors external sequence imports and oligonucleotide hybridization functionality to use pydna classes, improving code organization and type safety. The changes centralize external repository handling through catalog-based lookups and delegate hybridization logic to pydna's native implementations.

Key changes:

  • Introduced catalog system for external plasmid repositories (SEVA, SnapGene, iGEM2024, OpenDNA Collections)
  • Refactored external import endpoints to use pydna's RepositoryIdSource and other source models
  • Replaced custom oligonucleotide hybridization with pydna's oligonucleotide_hybridization function
  • Updated pydna dependency and opencloning-linkml schema version
  • Improved error handling with consistent use of FastAPI's HTTPException

Reviewed changes

Copilot reviewed 29 out of 31 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/opencloning/catalogs/init.py New catalog module for loading plasmid repository mappings from YAML/TSV files
src/opencloning/catalogs/*.yaml New catalog data files for SnapGene, SEVA, iGEM2024, and OpenDNA collections
src/opencloning/dna_functions.py Refactored repository functions to return Dseqrecord with pydna source models
src/opencloning/ncbi_requests.py Added genome annotation querying and region extraction with pydna source integration
src/opencloning/endpoints/external_import.py Simplified endpoint handlers using centralized error handling and pydna models
src/opencloning/endpoints/no_input.py Replaced custom hybridization with pydna's implementation
src/opencloning/endpoints/endpoint_utils.py Updated format_products to accept source_id and handle pydna sources
scripts/update_catalogs.py New script for automated catalog updates from upstream sources
tests/* Updated tests to reflect API changes and new error messages
pyproject.toml Updated pydna and opencloning-linkml dependencies

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

Comment on lines 18 to 30
return yaml.load(f, Loader=yaml.FullLoader)


def get_openDNA_collections_catalog():
catalog_path = os.path.join(os.path.dirname(__file__), 'openDNA_collections.yaml')
with open(catalog_path, 'r') as f:
return yaml.load(f, Loader=yaml.FullLoader)


def get_iGEM2024_catalog():
catalog_path = os.path.join(os.path.dirname(__file__), 'igem2024.yaml')
with open(catalog_path, 'r') as f:
return yaml.load(f, Loader=yaml.FullLoader)
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

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

Use yaml.safe_load() instead of yaml.load() with FullLoader. The yaml.load() function with FullLoader can execute arbitrary Python code and poses a security risk. yaml.safe_load() is the recommended secure alternative for loading YAML files.

Suggested change
return yaml.load(f, Loader=yaml.FullLoader)
def get_openDNA_collections_catalog():
catalog_path = os.path.join(os.path.dirname(__file__), 'openDNA_collections.yaml')
with open(catalog_path, 'r') as f:
return yaml.load(f, Loader=yaml.FullLoader)
def get_iGEM2024_catalog():
catalog_path = os.path.join(os.path.dirname(__file__), 'igem2024.yaml')
with open(catalog_path, 'r') as f:
return yaml.load(f, Loader=yaml.FullLoader)
return yaml.safe_load(f)
def get_openDNA_collections_catalog():
catalog_path = os.path.join(os.path.dirname(__file__), 'openDNA_collections.yaml')
with open(catalog_path, 'r') as f:
return yaml.safe_load(f)
def get_iGEM2024_catalog():
catalog_path = os.path.join(os.path.dirname(__file__), 'igem2024.yaml')
with open(catalog_path, 'r') as f:
return yaml.safe_load(f)

Copilot uses AI. Check for mistakes.
response = await client.get(
'https://raw.githubusercontent.com/manulera/SnapGene_crawler/refs/heads/master/index.yaml'
)
data = yaml.load(response.text, Loader=yaml.FullLoader)
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

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

Use yaml.safe_load() instead of yaml.load() with FullLoader. The yaml.load() function with FullLoader can execute arbitrary Python code and poses a security risk. yaml.safe_load() is the recommended secure alternative for loading YAML files.

Suggested change
data = yaml.load(response.text, Loader=yaml.FullLoader)
data = yaml.safe_load(response.text)

Copilot uses AI. Check for mistakes.
Comment on lines 18 to 30
return yaml.load(f, Loader=yaml.FullLoader)


def get_openDNA_collections_catalog():
catalog_path = os.path.join(os.path.dirname(__file__), 'openDNA_collections.yaml')
with open(catalog_path, 'r') as f:
return yaml.load(f, Loader=yaml.FullLoader)


def get_iGEM2024_catalog():
catalog_path = os.path.join(os.path.dirname(__file__), 'igem2024.yaml')
with open(catalog_path, 'r') as f:
return yaml.load(f, Loader=yaml.FullLoader)
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

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

Use yaml.safe_load() instead of yaml.load() with FullLoader. The yaml.load() function with FullLoader can execute arbitrary Python code and poses a security risk. yaml.safe_load() is the recommended secure alternative for loading YAML files.

Suggested change
return yaml.load(f, Loader=yaml.FullLoader)
def get_openDNA_collections_catalog():
catalog_path = os.path.join(os.path.dirname(__file__), 'openDNA_collections.yaml')
with open(catalog_path, 'r') as f:
return yaml.load(f, Loader=yaml.FullLoader)
def get_iGEM2024_catalog():
catalog_path = os.path.join(os.path.dirname(__file__), 'igem2024.yaml')
with open(catalog_path, 'r') as f:
return yaml.load(f, Loader=yaml.FullLoader)
return yaml.safe_load(f)
def get_openDNA_collections_catalog():
catalog_path = os.path.join(os.path.dirname(__file__), 'openDNA_collections.yaml')
with open(catalog_path, 'r') as f:
return yaml.safe_load(f)
def get_iGEM2024_catalog():
catalog_path = os.path.join(os.path.dirname(__file__), 'igem2024.yaml')
with open(catalog_path, 'r') as f:
return yaml.safe_load(f)

Copilot uses AI. Check for mistakes.
Comment on lines 18 to 30
return yaml.load(f, Loader=yaml.FullLoader)


def get_openDNA_collections_catalog():
catalog_path = os.path.join(os.path.dirname(__file__), 'openDNA_collections.yaml')
with open(catalog_path, 'r') as f:
return yaml.load(f, Loader=yaml.FullLoader)


def get_iGEM2024_catalog():
catalog_path = os.path.join(os.path.dirname(__file__), 'igem2024.yaml')
with open(catalog_path, 'r') as f:
return yaml.load(f, Loader=yaml.FullLoader)
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

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

Use yaml.safe_load() instead of yaml.load() with FullLoader. The yaml.load() function with FullLoader can execute arbitrary Python code and poses a security risk. yaml.safe_load() is the recommended secure alternative for loading YAML files.

Suggested change
return yaml.load(f, Loader=yaml.FullLoader)
def get_openDNA_collections_catalog():
catalog_path = os.path.join(os.path.dirname(__file__), 'openDNA_collections.yaml')
with open(catalog_path, 'r') as f:
return yaml.load(f, Loader=yaml.FullLoader)
def get_iGEM2024_catalog():
catalog_path = os.path.join(os.path.dirname(__file__), 'igem2024.yaml')
with open(catalog_path, 'r') as f:
return yaml.load(f, Loader=yaml.FullLoader)
return yaml.safe_load(f)
def get_openDNA_collections_catalog():
catalog_path = os.path.join(os.path.dirname(__file__), 'openDNA_collections.yaml')
with open(catalog_path, 'r') as f:
return yaml.safe_load(f)
def get_iGEM2024_catalog():
catalog_path = os.path.join(os.path.dirname(__file__), 'igem2024.yaml')
with open(catalog_path, 'r') as f:
return yaml.safe_load(f)

Copilot uses AI. Check for mistakes.
@manulera manulera merged commit e15020e into master Dec 1, 2025
9 checks passed
@manulera manulera deleted the wip-better-imports2 branch December 1, 2025 10:02
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.

2 participants