Skip to content

Commit

Permalink
revert back to older pip resolver as per pypa/pip#9187 (flake8, pylin…
Browse files Browse the repository at this point in the history
…t, astroid, pycodestyle never resolve in endless retry loop)
  • Loading branch information
fmigneault committed Sep 17, 2021
1 parent 219fe26 commit e27ca78
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 17 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ Bug Fixes
It is temporarily addressed by reducing requirements of `Twitcher`
(see `bird-house/twitcher#108 <https://github.com/bird-house/twitcher/pull/108>`_) and referencing its associated
release ``v0.5.6`` in the ``Docker.adapter``, which downgrades needed packages when extending it with `Magpie`.
* Use ``pip`` legacy and faster resolver as per
`pypa/pip#9187 (comment) <https://github.com/pypa/pip/issues/9187#issuecomment-853091201>`_
since current one is endlessly failing to resolve development packages (linting tools from ``check`` targets).

`3.15.0 <https://github.com/Ouranosinc/Magpie/tree/3.15.0>`_ (2021-08-11)
------------------------------------------------------------------------------------
Expand Down
37 changes: 28 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,31 @@ PIP_USE_FEATURE := `python -c '\
import pip; \
from distutils.version import LooseVersion; \
print(LooseVersion(pip.__version__) < LooseVersion("21.0"))'`
ifeq ($(findstring "--use-feature=2020-resolver", "$(PIP_XARGS)"),)
ifeq ($(findstring "--use-feature=2020-resolver",$(PIP_XARGS)),)
# feature not specified, but needed
ifeq ("$(PIP_USE_FEATURE)", "True")
PIP_XARGS := --use-feature=2020-resolver $(PIP_XARGS)
else
# use faster legacy resolver
ifeq ($(subst "--use-deprecated=legacy-resolver",,$(PIP_XARGS)),)
PIP_XARGS := --use-deprecated=legacy-resolver $(PIP_XARGS)
endif
ifeq ($(findstring "--use-feature=fast-deps",$(PIP_XARGS)),)
PIP_XARGS := --use-feature=fast-deps $(PIP_XARGS)
endif
endif
else
# feature was specified, but should not (not required anymore, default behavior)
ifeq ("$(PIP_USE_FEATURE)", "True")
PIP_XARGS := $(subst "--use-feature=2020-resolver",,"$(PIP_XARGS)")
PIP_XARGS := $(subst "--use-feature=2020-resolver",,$(PIP_XARGS))
else
# use faster legacy resolver
ifeq $(subst "--use-deprecated=legacy-resolver",,$(PIP_XARGS))
PIP_XARGS := --use-deprecated=legacy-resolver $(PIP_XARGS)
endif
ifeq ($(findstring "--use-feature=fast-deps",$(PIP_XARGS)),)
PIP_XARGS := --use-feature=fast-deps $(PIP_XARGS)
endif
endif
endif

Expand Down Expand Up @@ -325,18 +341,21 @@ install: install-all ## alias for 'install-all' target
.PHONY: install-all
install-all: install-sys install-pkg install-dev install-docs ## install every dependency and package definition

.PHONY: install-xargs
install-xargs:
@echo "Using PIP_XARGS: $(PIP_XARGS)"

# note: don't use PIP_XARGS for install system package as it could be upgrade of pip that doesn't yet have those options
.PHONY: install-sys
install-sys: clean conda-env ## install system dependencies and required installers/runners
install-sys: clean conda-env install-xargs ## install system dependencies and required installers/runners
@echo "Installing system dependencies..."
@bash -c '$(CONDA_CMD) pip install --upgrade -r "$(APP_ROOT)/requirements-sys.txt"'
@bash -c '$(CONDA_CMD) pip install $(PIP_XARGS) gunicorn'

.PHONY: install-pkg
install-pkg: install-sys ## install the package to the active Python's site-packages
install-pkg: install-sys install-xargs ## install the package to the active Python's site-packages
@echo "Installing Magpie..."
@bash -c '$(CONDA_CMD) python setup.py install_egg_info'
@bash -c '$(CONDA_CMD) pip install $(PIP_XARGS) --upgrade -e "$(APP_ROOT)" --no-cache'
@bash -c '$(CONDA_CMD) pip install $(PIP_XARGS) --upgrade -e "$(APP_ROOT)" '
# TODO: remove when merged
# --- ensure fix is applied
@bash -c '$(CONDA_CMD) \
Expand All @@ -345,17 +364,17 @@ install-pkg: install-sys ## install the package to the active Python's site-pack
# ---

.PHONY: install-req
install-req: conda-env ## install package base requirements without installing main package
install-req: conda-env install-xargs ## install package base requirements without installing main package
@bash -c '$(CONDA_CMD) pip install $(PIP_XARGS) -r "$(APP_ROOT)/requirements.txt"'
@echo "Successfully installed base requirements."

.PHONY: install-docs
install-docs: conda-env ## install package requirements for documentation generation
install-docs: conda-env install-xargs ## install package requirements for documentation generation
@bash -c '$(CONDA_CMD) pip install $(PIP_XARGS) -r "$(APP_ROOT)/requirements-doc.txt"'
@echo "Successfully installed docs requirements."

.PHONY: install-dev
install-dev: conda-env ## install package requirements for development and testing
install-dev: conda-env install-xargs ## install package requirements for development and testing
@bash -c '$(CONDA_CMD) pip install $(PIP_XARGS) -r "$(APP_ROOT)/requirements-dev.txt"'
@echo "Successfully installed dev requirements."

Expand Down
20 changes: 12 additions & 8 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
-r requirements-doc.txt
autopep8
autopep8; python_version < "3"
autopep8>=1.5.4; python_version >= "3.6"
backports.tempfile; python_version < "3"
bandit==1.6.2
bump2version
codacy-coverage
bump2version==1.0.0
codacy-coverage>=1.3.11
coverage==5.5; python_version < "3"
coverage; python_version >= "3"
doc8
coverage==5.5,<5.6; python_version >= "3"
doc8; python_version < "3.6"
doc8>=0.8; python_version >= "3.6"
docformatter==1.4
flake8
flake8; python_version < "3.6"
flake8>=3.8.3,<3.9; python_version >= "3.6"
isort; python_version < "3.6"
isort>5; python_version >= "3.6"
mock
isort>5.5; python_version >= "3.6"
mock; python_version < "3.6"
mock>4; python_version >= "3.6"
pylint<2.7; python_version < "3.6" # pyup: ignore
# skip pylint 2.7.3 (issue https://github.com/PyCQA/pylint/issues/4265)
pylint>=2.7,!=2.7.3,<2.8; python_version >= "3.6"
Expand Down

0 comments on commit e27ca78

Please sign in to comment.