Skip to content

Relax version bounds so ScreenPro2 installs on Python 3.10 to 3.13 - #116

Merged
abearab merged 2 commits into
ArcInstitute:mainfrom
zettalabs-nz:relax-version-bounds
Nov 28, 2026
Merged

abearab merged 2 commits into
ArcInstitute:mainfrom
zettalabs-nz:relax-version-bounds

Conversation

@crtag

@crtag crtag commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #114.

Of the six bounds, four turned out to be leftovers and two needed a different form:

Bound Now Why
python >=3.9,<3.12 >=3.10 Only there because pandas 1.x had no 3.12 wheels. The new floor comes from pydeseq2 0.5+; on 3.9, pip keeps picking screenpro2 0.7.3, the current release with the old pins.
pandas <2.0 <3 Results on pandas 2 match. pandas 3 trips getBestTargetByTSS in the collapse_var path (KeyError: 'target'), hence <3 for now.
numpy <2.0 removed Nothing in screenpro uses an API that numpy 2 removed.
matplotlib <3.7 removed A workaround for a scanpy bug fixed in early 2023 (scverse/scanpy#2411).
pyarrow <26 removed Not imported anywhere in screenpro.
pydeseq2 <0.5 >=0.5.2 With anndata 0.12+, 0.4.x crashes inside deseq2(); 0.5.2 has the fix. No upper bound: 3.12+ resolves the newest pydeseq2, while 3.10 and 3.11 land on 0.5.x because 0.6+ requires 3.12.

design_factors is deprecated, so runDESeq passes design="~" + " + ".join(factors) instead, which is the formula pydeseq2 used to build from it. A single factor and a list both work, and the results match the old call exactly on pydeseq2 0.5.2, 0.5.4 and 0.7.0.

Testing: fresh python:3.10 to 3.13 containers (Linux x86_64, no Rust), plain pip. Every version installs and passes pytest tests. Against the current 3.11 install I compared 38 output tables covering FASTQ counts, the CLI guide counter, the README workflow, phenotype scores and DESeq. 3.10 and 3.11 (pydeseq2 0.5.2, 0.5.4) match on all 38: counts exactly, the rest within 4e-12 relative. 3.12 and 3.13 (pydeseq2 0.7.0) match on 35; the other three are DESeq tables from a deliberately hard synthetic set (all-zero guides plus an outlier), where 0.7's new p-value for one low-count guide moves the numbers by up to 0.8 relative, padj included. macOS 3.12 installs from wheels. biobear ships no wheel for macOS 3.10, Windows 3.13 or anything on 3.14, so there pip has to compile it with Rust: with Rust hidden, macOS 3.10 stops at that build, and with Rust available it completes.

Left out on purpose: environment.yml, which still carries the old pins; touching it means a fresh conda solve on CI, so it fits better as its own change.

Possible next steps, roughly in order of payoff:

  1. CI on 3.10 and 3.13 as well, so these bounds keep getting exercised.
  2. A small getBestTargetByTSS change for pandas 3, after which <3 can go.
  3. A Poetry marker for pydeseq2 (>=0.7 on 3.12+, >=0.5.2 below) to keep every 3.12+ install on 0.7; 0.6 and 0.7 changed dispersion fallbacks, p-values and Cook's filtering relative to 0.5.x.
  4. biobear: nothing released since January 2025 and no 3.14 wheel. Keeping it versus moving FASTQ parsing elsewhere is the bigger change you mentioned.
  5. Yanking screenpro2 0.7.0 and earlier, which declare no dependencies and so remain a fallback when resolution fails.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates several project dependencies in pyproject.toml (including Python, pandas, numpy, matplotlib, pyarrow, and pydeseq2) and adapts the DeseqDataSet initialization in screenpro/phenoscore/deseq.py to use the design parameter. The review feedback correctly points out that the new string interpolation for design could fail if the input is already a formula or a list of factors, and provides a robust code suggestion to dynamically construct the formula.

Comment thread screenpro/phenoscore/deseq.py Resolved
@crtag
crtag force-pushed the relax-version-bounds branch from 97b46be to 0baf2b9 Compare November 27, 2026 07:26
@crtag

crtag commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

I adopted Gemini's suggestion on list designs: runDESeq now builds the formula the same way pydeseq2 did from design_factors, so both a single factor and a list like ['batch', 'condition'] work. Tested against the old design_factors call on pydeseq2 0.5.2 and 0.7.0 - identical results for both. I left out the "~"-prefixed case, since design_factors never accepted a formula.

@abearab abearab left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@crtag I would keep pydeseq2 latest version. Benchmarking is still ongoing so it's good to use their latest p-value, etc. :)

@abearab

abearab commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

@crtag I would keep pydeseq2 latest version. Benchmarking is still ongoing so it's good to use their latest p-value, etc. :)

FYI here is the repo where I'm working on benchmarking tasks – https://github.com/FunGI-cap/ScreenPro-Benchmarking

@crtag

crtag commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Done - pydeseq2 now has no upper bound. pydeseq2 0.6+ needs Python 3.12, though, so the ScreenPro-Benchmarking env (Python 3.11) still resolves 0.5.4 and gets 0.5.x p-values; the benchmark needs 3.12+ to run on 0.7. That env also runs pandas 3.0.1, and the pandas<3 bound here would pull it back to 2.x. The only pandas 3 break I found is in getBestTargetByTSS (groupby().apply drops the grouping column, so collapse_var fails with KeyError: 'target'). Shall I add that fix to this PR, along with a marker that keeps 3.12+ on pydeseq2 0.7 even where a resolver would fall back to 0.5.x?

@abearab

abearab commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

There is a similar problem in the docs environment, it keeps failing when I try to build it in ReadTheDocs ... @crtag do you have any thoughts in case the environment files in docs/* need similar updates?

Read the Docs build information
Build id: 36203396
Project: screenpro2
Version: stable
Commit: 50411b22bec19778570c787b10e2099c8b3fddbf
Date: 2026-11-27T05:23:51.214610Z
State: finished
Success: False


[rtd-command-info] start-time: 2026-11-27T05:23:56.157406Z, end-time: 2026-11-27T05:23:58.036606Z, duration: 1, exit-code: 0
git clone --depth 1 https://github.com/ArcInstitute/ScreenPro2 .
Cloning into '.'...

[rtd-command-info] start-time: 2026-11-27T05:23:58.088011Z, end-time: 2026-11-27T05:23:58.454388Z, duration: 0, exit-code: 0
git fetch origin --force --prune --prune-tags --depth 50 50411b22bec19778570c787b10e2099c8b3fddbf
From https://github.com/ArcInstitute/ScreenPro2
 * branch            50411b22bec19778570c787b10e2099c8b3fddbf -> FETCH_HEAD

[rtd-command-info] start-time: 2026-11-27T05:23:58.619563Z, end-time: 2026-11-27T05:23:58.698200Z, duration: 0, exit-code: 0
git checkout --force 50411b22bec19778570c787b10e2099c8b3fddbf
Note: switching to '50411b22bec19778570c787b10e2099c8b3fddbf'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 50411b2 Update OS version in Read the Docs configuration

[rtd-command-info] start-time: 2026-11-27T05:23:58.752574Z, end-time: 2026-11-27T05:23:58.816560Z, duration: 0, exit-code: 0
cat .readthedocs.yaml
version: 2

sphinx:
  configuration: docs/source/conf.py

build:
  os: "ubuntu-lts-latest"
  tools:
    python: "mambaforge-4.10"

conda:
  environment: docs/environment.yaml

[rtd-command-info] start-time: 2026-11-27T05:24:01.630893Z, end-time: 2026-11-27T05:24:18.304833Z, duration: 16, exit-code: 1
asdf install python mambaforge-4.10.3-10
Downloading python-build...
Cloning into '/home/docs/.asdf/plugins/python/pyenv'...
python-build mambaforge-4.10.3-10 /home/docs/.asdf/installs/python/mambaforge-4.10.3-10
Downloading Mambaforge-4.10.3-10-Linux-x86_64.sh...
-> https://github.com/conda-forge/miniforge/releases/download/4.10.3-10/Mambaforge-4.10.3-10-Linux-x86_64.sh
Installing Mambaforge-4.10.3-10-Linux-x86_64...
=> bash Mambaforge-4.10.3-10-Linux-x86_64.sh -f -b -p /home/docs/.asdf/installs/python/mambaforge-4.10.3-10

EnvironmentLocationNotFound: Not a conda environment: /home/docs/checkouts/screenpro2/conda/stable


BUILD FAILED (Ubuntu 26.04 using python-build 2.8.15-20-g26de1804)

Inspect or clean up the working tree at /tmp/python-build.20261127052404.116
Results logged to /tmp/python-build.20261127052404.116.log

Last 10 log lines:
Linking cryptography-36.0.0-py39h95dcef6_0
Linking brotlipy-0.7.0-py39h3811e60_1003
Linking conda-package-handling-1.7.3-py39h3811e60_1
Linking pyopenssl-21.0.0-pyhd8ed1ab_0
Linking urllib3-1.26.7-pyhd8ed1ab_0
Linking requests-2.26.0-pyhd8ed1ab_1
Linking conda-4.10.3-py39hf3d152e_4
Linking mamba-0.19.0-py39hfa8f2c8_0
Transaction finished
installation finished.

@crtag

crtag commented Nov 28, 2026

Copy link
Copy Markdown
Contributor Author

The docs/environment.yaml pins aren't what's failing: the build stops while installing the conda tool, before that file is read. The log is from the stable version, which Read the Docs builds from the highest version tag, v0.7.3 (50411b2). That tag still has mambaforge-4.10 on ubuntu-lts-latest, now Ubuntu 26.04, and the install fails there with the same error as readthedocs/readthedocs.org#13149, where miniforge3 fixed it. Your switch to miniforge3-25.11 on ubuntu-24.04 in 2347611 came two commits after the tag, so stable picks it up at the next release.

Main's config hasn't been built yet: latest tracks master, which became main on GitHub, so it last built in September 2024. Activating the main version under Versions (or setting the default branch to main under Admin > Settings, which moves latest onto it) would show whether it builds; a failed build leaves the current pages up.

The file is stale as well: pandas<2.0 and matplotlib<3.7 are the same leftovers as in pyproject, and python==3.10 means exactly 3.10.0 in conda (python=3.10 gives the newest 3.10). I can send that, together with the root environment.yml, as a separate PR.

@abearab

abearab commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

The docs/environment.yaml pins aren't what's failing: the build stops while installing the conda tool, before that file is read. The log is from the stable version, which Read the Docs builds from the highest version tag, v0.7.3 (50411b2). That tag still has mambaforge-4.10 on ubuntu-lts-latest, now Ubuntu 26.04, and the install fails there with the same error as readthedocs/readthedocs.org#13149, where miniforge3 fixed it. Your switch to miniforge3-25.11 on ubuntu-24.04 in 2347611 came two commits after the tag, so stable picks it up at the next release.

Main's config hasn't been built yet: latest tracks master, which became main on GitHub, so it last built in September 2024. Activating the main version under Versions (or setting the default branch to main under Admin > Settings, which moves latest onto it) would show whether it builds; a failed build leaves the current pages up.

The file is stale as well: pandas<2.0 and matplotlib<3.7 are the same leftovers as in pyproject, and python==3.10 means exactly 3.10.0 in conda (python=3.10 gives the newest 3.10). I can send that, together with the root environment.yml, as a separate PR.

@crtag can you open another PR about this? I'll merge and release a new subvsersion based this PR for now.

@abearab
abearab merged commit bbb8ddd into ArcInstitute:main Nov 28, 2026
1 check passed
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.

pip install on Python 3.12+ still gets 0.7.0 without dependencies

2 participants