Skip to content

make alphamap optional and update installation instructions#121

Merged
mschwoer merged 3 commits intomainfrom
make-alphamap-optional
Jan 30, 2026
Merged

make alphamap optional and update installation instructions#121
mschwoer merged 3 commits intomainfrom
make-alphamap-optional

Conversation

@mschwoer
Copy link
Contributor

Motivation: have slimmer dependencies for alphapeptools

@mschwoer mschwoer requested a review from Copilot January 27, 2026 13:43
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 PR makes the alphamap dependency optional for alphaquant to reduce the default dependency footprint. Users can now install alphaquant without alphamap and only add it when needed for sequence visualization features.

Changes:

  • Removed alphamap from core requirements and created separate optional dependency groups
  • Added runtime import guards and helpful error messages when alphamap functionality is accessed without the package installed
  • Updated CI/CD workflows to include the alphamap extra in test installations

Reviewed changes

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

Show a summary per file
File Description
requirements/requirements_loose.txt Removed alphamap from core dependencies
requirements/requirements_alphamap_loose.txt Created new optional dependency file for unpinned alphamap
requirements/requirements_alphamap.txt Created new optional dependency file for pinned alphamap version
requirements/requirements.txt Removed alphamap from pinned core dependencies
pyproject.toml Added alphamap and alphamap-stable optional dependency groups
alphaquant/ui/dashboard_parts_plots_proteoforms.py Added ImportError handling for missing alphamap with installation instructions
alphaquant/plotting/fcviz.py Added conditional import with HAS_ALPHAMAP flag and ImportError guard
alphaquant/plotting/alphamapviz.py Added conditional imports, warning, and ImportError guards for both visualizer classes
README.md Added installation instructions for alphamap optional extras
.github/workflows/run_example_nbs.yml Added alphamap to CI test installation
.github/workflows/install_and_unit_tests_multiple_platforms.yml Added alphamap to CI test installations
.github/workflows/install_and_unit_tests.yml Added alphamap to CI test installation
.github/workflows/e2e_tests_quick_multiple_platforms.yml Added alphamap to CI test installations
.github/workflows/e2e_tests_quick.yml Added alphamap to CI test installation

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

Comment on lines +206 to 211
if not HAS_ALPHAMAP:
raise ImportError(
"alphamap is required for get_pyteomics_fasta. "
"Install it with: pip install \"alphaquant[alphamap]\""
)
return alphamap.organisms_data.import_fasta(organism)
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

The indentation level suggests this is inside a function body, but Python typically uses 4 spaces per level. This line appears to be indented with 8 spaces when it should likely be 4 spaces to align with the function definition at line 205.

Suggested change
if not HAS_ALPHAMAP:
raise ImportError(
"alphamap is required for get_pyteomics_fasta. "
"Install it with: pip install \"alphaquant[alphamap]\""
)
return alphamap.organisms_data.import_fasta(organism)
if not HAS_ALPHAMAP:
raise ImportError(
"alphamap is required for get_pyteomics_fasta. "
"Install it with: pip install \"alphaquant[alphamap]\""
)
return alphamap.organisms_data.import_fasta(organism)

Copilot uses AI. Check for mistakes.
HAS_ALPHAMAP = True
except ModuleNotFoundError:
warnings.warn(
"Dependency 'alphamap' not installed. If you want to use its functionality, install alphaquant with the 'alphamap' extra."
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

The warning message should include installation instructions for consistency with the ImportError messages used elsewhere in the codebase. Consider changing to: "Dependency 'alphamap' not installed. Install it with: pip install \"alphaquant[alphamap]\""

Suggested change
"Dependency 'alphamap' not installed. If you want to use its functionality, install alphaquant with the 'alphamap' extra."
"Dependency 'alphamap' not installed. Install it with: pip install \"alphaquant[alphamap]\""

Copilot uses AI. Check for mistakes.
@mschwoer mschwoer force-pushed the make-alphamap-optional branch from b204f52 to bc514f5 Compare January 28, 2026 10:49
@mschwoer mschwoer requested a review from ammarcsj January 28, 2026 11:14
Copy link
Member

@ammarcsj ammarcsj left a comment

Choose a reason for hiding this comment

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

Hey, thx for looking into this. The sequence visualisation is an essential feature in case the GUI is installed, so if we take alphamap out for the default pip install, my intuition is that we should recommend the pip install with alphamap and fixed dependencies as the recommended way of pip installing alphaquant and GUI (marked it below)

Did you by any chance check wether the gui works with this new way of handling dependencies?

if you want to add the GUI to your environment, you can install it with the following command:

```bash
pip install "alphaquant[stable,gui-stable]"
Copy link
Member

Choose a reason for hiding this comment

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

I think we should then add the alphamap dependency also to this example call and say that they can leave it away if they don't need it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey,
thanks for pointing out that this is a gui-only feature. I could also just move the alphamap dependency to the gui extra then (thus simplifying installation workflow)?

Also, I did check, the gui works without alphamap installed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(merged the two extras, much simpler now :-) )

Copy link
Member

Choose a reason for hiding this comment

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

thx!!

Base automatically changed from make-dask-optional to main January 28, 2026 16:21
@mschwoer mschwoer merged commit 90917e3 into main Jan 30, 2026
4 checks passed
@mschwoer mschwoer deleted the make-alphamap-optional branch January 30, 2026 10:57
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