Skip to content

Commit

Permalink
fix: Migrate away from deprecated pulp API (#2610)
Browse files Browse the repository at this point in the history
### Description

The latest update of pulp 2.8.0 removed deprecated API calls still used
by snakemake.
This PR updates the calls to their modern equivalents, as well as
constrains the pulp version to the moment these got introduced (v2.3.1).

Fixes the issues described in #2607 and #2606.

### QC
<!-- Make sure that you can tick the boxes below. -->

* [x] The PR contains a test case for the changes or the changes are
already covered by an existing test case.
* [x] The documentation (`docs/`) is updated to reflect the changes or
this is not necessary (e.g. if the change does neither modify the
language nor the behavior or functionalities of Snakemake).

---------

Co-authored-by: Johannes Köster <johannes.koester@uni-due.de>
  • Loading branch information
ebete and johanneskoester committed Jan 12, 2024
1 parent 880b264 commit fb26640
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ install_requires =
nbformat
packaging
psutil
pulp >=2.0
pulp >=2.3.1,<2.9 # pulp introduced a breaking change from 2.7 to 2.8. Hence we should always pin to the minor version.
pyyaml
requests
reretry
Expand Down
2 changes: 1 addition & 1 deletion snakemake/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ def get_argument_parser(profiles=None):
try:
import pulp

lp_solvers = pulp.list_solvers(onlyAvailable=True)
lp_solvers = pulp.listSolvers(onlyAvailable=True)
except ImportError:
# Dummy list for the case that pulp is not available
# This only happened when building docs.
Expand Down
2 changes: 1 addition & 1 deletion snakemake/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ def _solve_ilp(self, prob):
)
try:
solver = (
pulp.get_solver(self.workflow.scheduling_settings.ilp_solver)
pulp.getSolver(self.workflow.scheduling_settings.ilp_solver)
if self.workflow.scheduling_settings.ilp_solver
else pulp.apis.LpSolverDefault
)
Expand Down
2 changes: 1 addition & 1 deletion test-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ dependencies:
- jsonschema
- pandas
- gitpython
- pulp >=2.0
- pulp >=2.3.1
- environment-modules
- nbformat
- toposort >=1.10
Expand Down

0 comments on commit fb26640

Please sign in to comment.