Skip to content

Requirements check: allow extras in fixed versions (package[extra1,extra2]==version) - #9

Merged
IvanHCenalmor merged 1 commit into
mainfrom
claude/requirements-extras
Nov 17, 2026
Merged

IvanHCenalmor merged 1 commit into
mainfrom
claude/requirements-extras

Conversation

@IvanHCenalmor

Copy link
Copy Markdown
Collaborator

Problem

Uploading a notebook whose requirements.yaml lists colabfold[alphafold,openmm]==1.6.3 failed with:

Dependency 'colabfold[alphafold,openmm]==1.6.3' is not in the correct format. Only fixed versions with 'package==version' are allowed.

The pattern in validate_requirements (^[a-zA-Z0-9_.-]+==[a-zA-Z0-9_.-]+$) has no room for extras. Extras only choose optional parts of the same package, so the version stays fixed. The template's requirements merge already handles them, both the current one and the one in CellMigrationLab/LabConstrictor#55.

Changes

  • requirements_format.py (new): the accepted format, package==version or package[extra1,extra2]==version. It lives outside app.py, which builds the Streamlit page on import, so tests can check it, like placeholders.py.
  • app.py: validate_requirements uses it, and the error message names both forms. Only those lines change, and the file keeps its CR LF line endings.
  • tests/test_requirements_format.py: fixed versions with and without extras are accepted (including colabfold[alphafold, openmm]). Ranges, wildcards (==2.*), platform markers, Git URLs, unpinned names and malformed extras ([], [a,], an unclosed [) are still refused.

The policy is unchanged: only fixed versions are accepted.

Verified

  • The new tests, test_placeholders and test_app_manifest pass locally. test_manifest_form needs Streamlit, which CI installs.
  • pip's parser (packaging.requirements.Requirement) reads colabfold[alphafold,openmm]==1.6.3 as colabfold, extras alphafold and openmm, version ==1.6.3.
  • Both the template's current merge_requirements.py and the one in Template 0.1.31: no silent change of a notebook's package versions, no lost work when a notebook is updated LabConstrictor#55 write the line to requirements.txt unchanged. The 0.1.31 one also combines the extras that two notebooks ask for.
  • Not tested: an upload through the deployed form. Streamlit Cloud redeploys from main after the merge.

🤖 Generated with Claude Code

…tra2]==version)

The form refused 'colabfold[alphafold,openmm]==1.6.3': its pattern had no room for extras. Extras choose optional
parts of the same package and keep its version fixed, and the template's requirements merge already handles them.

- requirements_format.py (new): the accepted format, outside app.py so it can be tested without Streamlit.
- app.py: validate_requirements uses it; the error names both forms.
- tests/test_requirements_format.py: fixed versions with and without extras are accepted; ranges, wildcards,
  markers, URLs and malformed extras are still refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@IvanHCenalmor
IvanHCenalmor merged commit 52aa1b5 into main Nov 17, 2026
1 check passed
@IvanHCenalmor
IvanHCenalmor deleted the claude/requirements-extras branch November 17, 2026 18:41
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.

1 participant