mirror of
https://github.com/enpaul/tox-poetry-installer.git
synced 2025-10-28 07:00:43 +00:00
Compare commits
98 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7400d1e3cd | |||
| a7e5020d5f | |||
| 015915adf7 | |||
| a457cb99d2 | |||
| 1004a247b1 | |||
| f1f7a63774 | |||
| 087db95c43 | |||
| bb0db0fa1d | |||
| 6ac16a5c4d | |||
| 7f8d27709a | |||
| 17a2e5af64 | |||
| c05187f2e6 | |||
| 5ccc56956b | |||
| dae91a3a69 | |||
| 2f35d83363 | |||
| bba0c54b70 | |||
| 9d4e6d76fd | |||
| 68af3a1075 | |||
| 6384f289aa | |||
| 1f6550e77c | |||
| c322e68371 | |||
|
|
603cca6fd9 | ||
|
|
1478e35c0b | ||
| 3c0b76a30f | |||
| 99db4c9ec0 | |||
| 7fc322419a | |||
| 5b91918bea | |||
| 44b7238304 | |||
| f2ab91603a | |||
| 5188a30e77 | |||
| 26bbe13722 | |||
| 182fa24214 | |||
| 6b84764d5d | |||
| d5def209f2 | |||
| c4bf9bec24 | |||
| e4139d9875 | |||
| dbbbf8186f | |||
| 915233c529 | |||
| e745c7684a | |||
| 7152e4e94f | |||
| 6d97919138 | |||
| e99cf09caf | |||
| 1a5ba01c2f | |||
| 6d51d166a7 | |||
| bfcf8b14dd | |||
| 1f449c038f | |||
| efdc2f7f26 | |||
| c8d7009200 | |||
| 1e04edef69 | |||
| cddfdba0ae | |||
| a337ed8a97 | |||
| d5f13ccea9 | |||
| 0b13ff508b | |||
| 37cce37e05 | |||
| 4d2c2e6297 | |||
| 17a1ff1bc0 | |||
| fc40c96954 | |||
| ab4fc1197f | |||
| f55f12b447 | |||
| 31e08c9475 | |||
| 9d06dbeba8 | |||
| 5e33af6eb2 | |||
| 06fcd56172 | |||
| af40c5a87b | |||
| 51f4f33481 | |||
| 19828a92f0 | |||
| 17fc1bdef6 | |||
| 4092a0da4b | |||
| 333bbe665f | |||
| 34454e1856 | |||
| 41b6cfdf54 | |||
| 65187eeac2 | |||
| 7f0aeaf539 | |||
| d2779de848 | |||
| 5dc5617000 | |||
| ba5cd94b5e | |||
| a91364efd6 | |||
| e894a25d18 | |||
| 08a6962d3f | |||
| b8ea98b3ad | |||
| ea8bc3887e | |||
| 52c08e9dc5 | |||
| ee5df2f17a | |||
| 46b8fcc2a4 | |||
| 469ce4c905 | |||
| 5b5896191f | |||
| cc54e6243a | |||
| e3b3b19b31 | |||
| 99d6eedff1 | |||
| ff09706648 | |||
| 9ec64cf98f | |||
| 59bf9ad26e | |||
| 366c50ac87 | |||
| 6e535f0f42 | |||
| af66cd6d06 | |||
| f6c8001546 | |||
| b62e13afc7 | |||
| c119e3b9d4 |
65
.github/scripts/setup-env.sh
vendored
65
.github/scripts/setup-env.sh
vendored
@@ -7,66 +7,29 @@
|
|||||||
|
|
||||||
set -e;
|
set -e;
|
||||||
|
|
||||||
# ##### Prereqs #####
|
|
||||||
#
|
|
||||||
# Set global vars for usage in the script, create the cache directory so we can rely
|
|
||||||
# on that existing, then dump some diagnostic info for later reference.
|
|
||||||
#
|
|
||||||
CI_VENV=$HOME/ci;
|
|
||||||
CI_CACHE=$HOME/.cache;
|
CI_CACHE=$HOME/.cache;
|
||||||
CI_CACHE_GET_POETRY="$CI_CACHE/get-poetry.py";
|
POETRY_VERSION=1.1.12;
|
||||||
CI_POETRY=$HOME/.poetry/bin/poetry;
|
|
||||||
CI_VENV_PIP="$CI_VENV/bin/pip";
|
|
||||||
CI_VENV_PIP_VERSION=19.3.1;
|
|
||||||
CI_VENV_TOX="$CI_VENV/bin/tox";
|
|
||||||
|
|
||||||
mkdir --parents "$CI_CACHE";
|
mkdir --parents "$CI_CACHE";
|
||||||
|
|
||||||
command -v python;
|
command -v python;
|
||||||
python --version;
|
python --version;
|
||||||
|
|
||||||
# ##### Install Poetry #####
|
curl --location https://install.python-poetry.org \
|
||||||
#
|
--output "$CI_CACHE/install-poetry.py" \
|
||||||
# Download the poetry install script to the cache directory and then install poetry.
|
|
||||||
# After dump the poetry version for later reference.
|
|
||||||
#
|
|
||||||
curl https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py \
|
|
||||||
--output "$CI_CACHE_GET_POETRY" \
|
|
||||||
--silent \
|
--silent \
|
||||||
--show-error \
|
--show-error;
|
||||||
--location;
|
python "$CI_CACHE/install-poetry.py" \
|
||||||
python "$CI_CACHE_GET_POETRY" --yes 1>/dev/null;
|
--version "$POETRY_VERSION" \
|
||||||
|
--yes;
|
||||||
|
poetry --version --no-ansi;
|
||||||
|
poetry run pip --version;
|
||||||
|
|
||||||
python "$CI_POETRY" --version --no-ansi;
|
poetry install \
|
||||||
|
|
||||||
# ##### Setup Runtime Venv #####
|
|
||||||
#
|
|
||||||
# Create a virtual environment for poetry to use, upgrade pip in that venv to a pinned
|
|
||||||
# version, then install the current project to the venv.
|
|
||||||
#
|
|
||||||
# Note 1: Poetry, Tox, and this project plugin all use pip under the hood for package
|
|
||||||
# installation. This means that even though we are creating up to eight venvs
|
|
||||||
# during a given CI run they all share the same download cache.
|
|
||||||
# Note 2: The "VIRTUAL_ENV=$CI_VENV" prefix on the poetry commands below sets the venv
|
|
||||||
# that poetry will use for operations. There is no CLI flag for poetry that
|
|
||||||
# directs it to use a given environment, but if it finds itself in an existing
|
|
||||||
# environment it will use it and skip environment creation.
|
|
||||||
#
|
|
||||||
python -m venv "$CI_VENV";
|
|
||||||
|
|
||||||
$CI_VENV_PIP install "pip==$CI_VENV_PIP_VERSION" \
|
|
||||||
--upgrade \
|
|
||||||
--quiet;
|
|
||||||
|
|
||||||
VIRTUAL_ENV=$CI_VENV "$CI_POETRY" install \
|
|
||||||
--extras poetry \
|
--extras poetry \
|
||||||
--quiet \
|
--quiet \
|
||||||
--no-ansi \
|
--remove-untracked \
|
||||||
&>/dev/null;
|
--no-ansi;
|
||||||
|
|
||||||
# ##### Print Debug Info #####
|
poetry env info;
|
||||||
#
|
poetry run tox --version;
|
||||||
# Print the pip and tox versions (which will include registered plugins)
|
|
||||||
#
|
|
||||||
$CI_VENV_PIP --version;
|
|
||||||
echo "tox $($CI_VENV_TOX --version)";
|
|
||||||
|
|||||||
44
.github/workflows/ci.yaml
vendored
44
.github/workflows/ci.yaml
vendored
@@ -11,22 +11,24 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python:
|
python:
|
||||||
- version: 3.6
|
- version: "3.6"
|
||||||
toxenv: py36
|
toxenv: py36
|
||||||
- version: 3.7
|
- version: "3.7"
|
||||||
toxenv: py37
|
toxenv: py37
|
||||||
- version: 3.8
|
- version: "3.8"
|
||||||
toxenv: py38
|
toxenv: py38
|
||||||
- version: 3.9
|
- version: "3.9"
|
||||||
toxenv: py39
|
toxenv: py39
|
||||||
|
- version: "3.10"
|
||||||
|
toxenv: py310
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Setup:python${{ matrix.python.version }}
|
- name: Install Python ${{ matrix.python.version }}
|
||||||
uses: actions/setup-python@v1
|
uses: actions/setup-python@v1
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python.version }}
|
python-version: ${{ matrix.python.version }}
|
||||||
- name: Setup:cache
|
- name: Configure Job Cache
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
@@ -37,22 +39,22 @@ jobs:
|
|||||||
# will be invalidated, and thus all packages will be redownloaded, if the
|
# will be invalidated, and thus all packages will be redownloaded, if the
|
||||||
# lockfile is updated
|
# lockfile is updated
|
||||||
key: ${{ runner.os }}-${{ matrix.python.toxenv }}-${{ hashFiles('**/poetry.lock') }}
|
key: ${{ runner.os }}-${{ matrix.python.toxenv }}-${{ hashFiles('**/poetry.lock') }}
|
||||||
- name: Setup:env
|
- name: Configure Path
|
||||||
|
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||||
|
- name: Configure Environment
|
||||||
run: .github/scripts/setup-env.sh
|
run: .github/scripts/setup-env.sh
|
||||||
- name: Run:${{ matrix.python.toxenv }}
|
- name: Run Toxenv ${{ matrix.python.toxenv }}
|
||||||
run: $HOME/ci/bin/tox \
|
run: poetry run tox -e ${{ matrix.python.toxenv }}
|
||||||
-e ${{ matrix.python.toxenv }} \
|
|
||||||
--require-poetry
|
|
||||||
Check:
|
Check:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Setup:python3.8
|
- name: Install Python 3.8
|
||||||
uses: actions/setup-python@v1
|
uses: actions/setup-python@v1
|
||||||
with:
|
with:
|
||||||
python-version: 3.8
|
python-version: 3.8
|
||||||
- name: Setup:cache
|
- name: Configure Job Cache
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
@@ -62,11 +64,13 @@ jobs:
|
|||||||
# Hardcoded 'py38' slug here lets this cache piggyback on the 'py38' cache
|
# Hardcoded 'py38' slug here lets this cache piggyback on the 'py38' cache
|
||||||
# that is generated for the tests above
|
# that is generated for the tests above
|
||||||
key: ${{ runner.os }}-py38-${{ hashFiles('**/poetry.lock') }}
|
key: ${{ runner.os }}-py38-${{ hashFiles('**/poetry.lock') }}
|
||||||
- name: Setup:env
|
- name: Configure Path
|
||||||
|
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||||
|
- name: Configure Environment
|
||||||
run: .github/scripts/setup-env.sh
|
run: .github/scripts/setup-env.sh
|
||||||
- name: Run:static
|
- name: Run Static Analysis Checks
|
||||||
run: $HOME/ci/bin/tox -e static --require-poetry
|
run: poetry run tox -e static
|
||||||
- name: Run:static-tests
|
- name: Run Static Analysis Checks (Tests)
|
||||||
run: $HOME/ci/bin/tox -e static-tests --require-poetry
|
run: poetry run tox -e static-tests
|
||||||
- name: Run:security
|
- name: Run Security Checks
|
||||||
run: $HOME/ci/bin/tox -e security --require-poetry
|
run: poetry run tox -e security
|
||||||
|
|||||||
@@ -13,36 +13,67 @@
|
|||||||
# by the Poetry-managed dependency.
|
# by the Poetry-managed dependency.
|
||||||
#
|
#
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: local
|
||||||
rev: v3.3.0
|
|
||||||
hooks:
|
hooks:
|
||||||
- id: end-of-file-fixer
|
- id: end-of-file-fixer
|
||||||
|
name: end-of-file-fixer
|
||||||
|
entry: end-of-file-fixer
|
||||||
language: system
|
language: system
|
||||||
|
types:
|
||||||
|
- text
|
||||||
|
|
||||||
- id: fix-encoding-pragma
|
- id: fix-encoding-pragma
|
||||||
|
name: fix-encoding-pragma
|
||||||
|
entry: fix-encoding-pragma
|
||||||
|
language: system
|
||||||
args:
|
args:
|
||||||
- "--remove"
|
- "--remove"
|
||||||
|
types:
|
||||||
|
- python
|
||||||
|
|
||||||
|
- id: trailing-whitespace-fixer
|
||||||
|
name: trailing-whitespace-fixer
|
||||||
|
entry: trailing-whitespace-fixer
|
||||||
language: system
|
language: system
|
||||||
- id: trailing-whitespace
|
types:
|
||||||
language: system
|
- text
|
||||||
|
|
||||||
- id: check-merge-conflict
|
- id: check-merge-conflict
|
||||||
|
name: check-merge-conflict
|
||||||
|
entry: check-merge-conflict
|
||||||
language: system
|
language: system
|
||||||
|
types:
|
||||||
|
- text
|
||||||
|
|
||||||
- repo: https://github.com/psf/black
|
|
||||||
rev: 20.8b1
|
|
||||||
hooks:
|
|
||||||
- id: black
|
|
||||||
language: system
|
|
||||||
|
|
||||||
- repo: https://github.com/asottile/blacken-docs
|
|
||||||
rev: v1.8.0
|
|
||||||
hooks:
|
|
||||||
- id: blacken-docs
|
|
||||||
language: system
|
|
||||||
|
|
||||||
- repo: https://github.com/asottile/reorder_python_imports
|
|
||||||
rev: v2.3.6
|
|
||||||
hooks:
|
|
||||||
- id: reorder-python-imports
|
- id: reorder-python-imports
|
||||||
|
name: reorder-python-imports
|
||||||
|
entry: reorder-python-imports
|
||||||
|
language: system
|
||||||
args:
|
args:
|
||||||
- "--unclassifiable-application-module=tox_poetry_installer"
|
- "--unclassifiable-application-module=tox_poetry_installer"
|
||||||
|
types:
|
||||||
|
- python
|
||||||
|
|
||||||
|
- id: black
|
||||||
|
name: black
|
||||||
|
entry: black
|
||||||
language: system
|
language: system
|
||||||
|
types:
|
||||||
|
- python
|
||||||
|
|
||||||
|
- id: blacken-docs
|
||||||
|
name: blacken-docs
|
||||||
|
entry: blacken-docs
|
||||||
|
language: system
|
||||||
|
types:
|
||||||
|
- text
|
||||||
|
|
||||||
|
- id: mdformat
|
||||||
|
name: mdformat
|
||||||
|
entry: mdformat
|
||||||
|
language: system
|
||||||
|
args:
|
||||||
|
- "--number"
|
||||||
|
- "--wrap=90"
|
||||||
|
types:
|
||||||
|
- markdown
|
||||||
|
|||||||
300
CHANGELOG.md
Normal file
300
CHANGELOG.md
Normal file
@@ -0,0 +1,300 @@
|
|||||||
|
# changelog
|
||||||
|
|
||||||
|
See also: [Github Release Page](https://github.com/enpaul/tox-poetry-installer/releases).
|
||||||
|
|
||||||
|
## Version 0.8.3
|
||||||
|
|
||||||
|
View this release on:
|
||||||
|
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.8.3),
|
||||||
|
[PyPI](https://pypi.org/project/tox-poetry-installer/0.8.3/)
|
||||||
|
|
||||||
|
- Add PyPI classifier for Python 3.10 compatibility
|
||||||
|
|
||||||
|
## Version 0.8.2
|
||||||
|
|
||||||
|
View this release on:
|
||||||
|
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.8.2),
|
||||||
|
[PyPI](https://pypi.org/project/tox-poetry-installer/0.8.2/)
|
||||||
|
|
||||||
|
- Improve debug-level logging for package installation, and time how long installing each
|
||||||
|
package takes. Contributed by [Rebecca
|
||||||
|
Turner](https://github.com/9999years).
|
||||||
|
- Fix crash caused by the package-under-test depending on Poetry's unsafe dependencies ([#65](https://github.com/enpaul/tox-poetry-installer/issues/65))
|
||||||
|
|
||||||
|
## Version 0.8.1
|
||||||
|
|
||||||
|
View this release on:
|
||||||
|
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.8.1),
|
||||||
|
[PyPI](https://pypi.org/project/tox-poetry-installer/0.8.1/)
|
||||||
|
|
||||||
|
- Fix unintuitive behavior of the `install_project_deps` option by ensuring the specified
|
||||||
|
value always causes the implied action
|
||||||
|
|
||||||
|
## Version 0.8.0
|
||||||
|
|
||||||
|
View this release on:
|
||||||
|
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.8.0),
|
||||||
|
[PyPI](https://pypi.org/project/tox-poetry-installer/0.8.0/)
|
||||||
|
|
||||||
|
- Add default installation of locked dependencies using thread workers, decreasing
|
||||||
|
environment provisioning times by ~90%
|
||||||
|
- Add runtime option `--parallel-install-threads` to support configuring the number of
|
||||||
|
worker threads for parallel dependency installation
|
||||||
|
- Add configuration option `install_project_deps` to support disabling the install of
|
||||||
|
project dependencies to an environment
|
||||||
|
- Deprecate runtime option `--parallelize-locked-install`
|
||||||
|
|
||||||
|
## Version 0.7.0
|
||||||
|
|
||||||
|
View this release on:
|
||||||
|
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.7.0),
|
||||||
|
[PyPI](https://pypi.org/project/tox-poetry-installer/0.7.0/)
|
||||||
|
|
||||||
|
- Add runtime option `--parallelize-locked-install` to support installing locked
|
||||||
|
dependencies in parallel to speed up test environment creation
|
||||||
|
- Add config option `require_poetry` to allow per-environment control over whether the
|
||||||
|
plugin should force an error
|
||||||
|
- Add unit tests for custom dependency processing and installation
|
||||||
|
- Update internal logging system to reduce code duplication
|
||||||
|
- Update documentation to improve readability
|
||||||
|
- Deprecate runtime option `--require-poetry`
|
||||||
|
|
||||||
|
## Version 0.6.4
|
||||||
|
|
||||||
|
View this release on:
|
||||||
|
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.6.4),
|
||||||
|
[PyPI](https://pypi.org/project/tox-poetry-installer/0.6.4/)
|
||||||
|
|
||||||
|
- Remove custom package compatibility checking logic from transient dependency resolution
|
||||||
|
process
|
||||||
|
- Add integration with Poetry's compatibility
|
||||||
|
[`Marker`](https://github.com/python-poetry/poetry-core/blob/master/poetry/core/version/markers.py)
|
||||||
|
object system for determining package compatibility with the current platform ([#43](https://github.com/enpaul/tox-poetry-installer/issues/43))
|
||||||
|
- Add missing PyPI classifier for Python 3
|
||||||
|
|
||||||
|
## Version 0.6.3
|
||||||
|
|
||||||
|
View this release on:
|
||||||
|
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.6.3),
|
||||||
|
[PyPI](https://pypi.org/project/tox-poetry-installer/0.6.3/)
|
||||||
|
|
||||||
|
- Update required `tox` version from `^3.0` to `^3.8` to avoid compatibility issues
|
||||||
|
- Update logging messages to improve UX
|
||||||
|
- Fix transient dependency packages being installed in a pseudo-random order due to Python
|
||||||
|
sets being unordered ([#41](https://github.com/enpaul/tox-poetry-installer/issues/41))
|
||||||
|
- Fix outdated docstrings
|
||||||
|
|
||||||
|
## Version 0.6.2
|
||||||
|
|
||||||
|
View this release on:
|
||||||
|
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.6.2),
|
||||||
|
[PyPI](https://pypi.org/project/tox-poetry-installer/0.6.2/)
|
||||||
|
|
||||||
|
- Update locked version of `py` to `1.10.0` to address
|
||||||
|
[CVE-2020-29651](https://nvd.nist.gov/vuln/detail/CVE-2020-29651)
|
||||||
|
- Fix dependency identification failing when the package under test is a transient
|
||||||
|
dependency of a locked dependency specified for installation
|
||||||
|
- Fix `AttributeError` being raised while creating the Tox self-provisioned environment when
|
||||||
|
using either the
|
||||||
|
[`minversion`](https://tox.readthedocs.io/en/latest/config.html#conf-minversion) or
|
||||||
|
[`requires`](https://tox.readthedocs.io/en/latest/config.html#conf-requires) Tox config
|
||||||
|
options
|
||||||
|
|
||||||
|
## Version 0.6.1
|
||||||
|
|
||||||
|
View this release on:
|
||||||
|
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.6.1),
|
||||||
|
[PyPI](https://pypi.org/project/tox-poetry-installer/0.6.1/)
|
||||||
|
|
||||||
|
- Update logging around transient dependency processing to improve debugging of dependency
|
||||||
|
installation problems
|
||||||
|
- Fix regression around handling of Poetry's unsafe packages when the unsafe package is a
|
||||||
|
transient dependency ([#33](https://github.com/enpaul/tox-poetry-installer/issues/33))
|
||||||
|
- Fix handling of Poetry's unsafe packages when the unsafe package is a primary (environment
|
||||||
|
or package) dependency
|
||||||
|
|
||||||
|
## Version 0.6.0
|
||||||
|
|
||||||
|
View this release on:
|
||||||
|
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.6.0),
|
||||||
|
[PyPI](https://pypi.org/project/tox-poetry-installer/0.6.0/)
|
||||||
|
|
||||||
|
- Add `poetry` extra to support installing Poetry as a direct dependency of the plugin
|
||||||
|
- Add `--require-poetry` runtime option to force Tox failure if Poetry is not installed
|
||||||
|
- Update logging messages to improve UX around non-verbose messaging
|
||||||
|
- Update error logging to avoid dumping stack traces
|
||||||
|
- Update integration with Tox's `action` object to better manage internal state at runtime
|
||||||
|
- Update documentation to more clearly cover more use cases
|
||||||
|
- Remove `poetry` as a required dependency to support external Poetry installations
|
||||||
|
|
||||||
|
First beta release :tada:
|
||||||
|
|
||||||
|
## Version 0.5.2
|
||||||
|
|
||||||
|
View this release on:
|
||||||
|
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.5.2),
|
||||||
|
[PyPI](https://pypi.org/project/tox-poetry-installer/0.5.2/)
|
||||||
|
|
||||||
|
- Fix always attempting to install dependencies with incompatible python version constraints
|
||||||
|
- Fix always attempting to install dependencies with incompatible python platforms
|
||||||
|
|
||||||
|
## Version 0.5.1
|
||||||
|
|
||||||
|
View this release on:
|
||||||
|
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.5.1),
|
||||||
|
[PyPI](https://pypi.org/project/tox-poetry-installer/0.5.1/)
|
||||||
|
|
||||||
|
- Add CI/Tox tests for Python-3.9
|
||||||
|
- Update dependency processing to reduce duplication during installation
|
||||||
|
- Update minimum python requirement to `3.6.1`
|
||||||
|
- Fix `UnboundLocal` exception when not installing project dependencies
|
||||||
|
|
||||||
|
## Version 0.5.0
|
||||||
|
|
||||||
|
View this release on:
|
||||||
|
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.5.0),
|
||||||
|
[PyPI](https://pypi.org/project/tox-poetry-installer/0.5.0/)
|
||||||
|
|
||||||
|
- Add option `locked_deps` to better support both locked and unlocked dependencies in a
|
||||||
|
single environment
|
||||||
|
- Add blocking functionality when using `require_locked_deps = true` to prevent other hooks
|
||||||
|
from running after this one
|
||||||
|
- Update documentation to include new configuration options and errors
|
||||||
|
- Update documentation to improve future maintainability
|
||||||
|
- Update module structure to move from single-file module to multi-file directory module
|
||||||
|
- Fix `RecursionError` when installing locked dependencies that specify recursive
|
||||||
|
dependencies
|
||||||
|
- Fix always reinstalling all locked dependencies on every run regardless of update status
|
||||||
|
|
||||||
|
## Version 0.4.0
|
||||||
|
|
||||||
|
View this release on:
|
||||||
|
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.4.0),
|
||||||
|
[PyPI](https://pypi.org/project/tox-poetry-installer/0.4.0/)
|
||||||
|
|
||||||
|
- Add `install_dev_deps` configuration option for automatically installing all Poetry
|
||||||
|
dev-dependencies into a Tox testenv
|
||||||
|
|
||||||
|
## Version 0.3.1
|
||||||
|
|
||||||
|
View this release on:
|
||||||
|
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.3.1),
|
||||||
|
[PyPI](https://pypi.org/project/tox-poetry-installer/0.3.1/)
|
||||||
|
|
||||||
|
- Fix error when installing an environment with no extras specified in the configuration
|
||||||
|
- Fix problem where only the dependencies of the sequentially last extra would be installed
|
||||||
|
- Fix regression causing no project dependencies to be installed
|
||||||
|
|
||||||
|
## Version 0.3.0
|
||||||
|
|
||||||
|
View this release on:
|
||||||
|
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.3.0),
|
||||||
|
[PyPI](https://pypi.org/project/tox-poetry-installer/0.3.0/)
|
||||||
|
|
||||||
|
- Add support for the Tox
|
||||||
|
[`extras`](https://tox.readthedocs.io/en/latest/config.html#conf-extras) configuration
|
||||||
|
parameter
|
||||||
|
- Update runtime-skip-conditional checks to improve clarity and ease of future maintenance
|
||||||
|
- Update lockfile parsing to avoid parsing it multiple times for a single testenv
|
||||||
|
- Fix missing `poetry-core` dependency when using Poetry\<1.1.0
|
||||||
|
|
||||||
|
## Version 0.2.4
|
||||||
|
|
||||||
|
View this release on:
|
||||||
|
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.2.4),
|
||||||
|
[PyPI](https://pypi.org/project/tox-poetry-installer/0.2.4/)
|
||||||
|
|
||||||
|
- Fix support for Poetry-1.1 ([#2](https://github.com/enpaul/tox-poetry-installer/issues/2))
|
||||||
|
- Include tests in sdist ([#8](https://github.com/enpaul/tox-poetry-installer/issues/8))
|
||||||
|
|
||||||
|
## Version 0.2.3
|
||||||
|
|
||||||
|
View this release on:
|
||||||
|
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.2.3),
|
||||||
|
[PyPI](https://pypi.org/project/tox-poetry-installer/0.2.3/)
|
||||||
|
|
||||||
|
- Fix usage of the plugin in non-Poetry based projects ([#1](https://github.com/enpaul/tox-poetry-installer/issues/1))
|
||||||
|
- Fix treating dependency names as case sensitive when they shouldn't be ([#7](https://github.com/enpaul/tox-poetry-installer/issues/7))
|
||||||
|
|
||||||
|
## Version 0.2.2
|
||||||
|
|
||||||
|
View this release on:
|
||||||
|
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.2.2),
|
||||||
|
[PyPI](https://pypi.org/project/tox-poetry-installer/0.2.2/)
|
||||||
|
|
||||||
|
- Fix breaking when running Tox in projects that do not use Poetry for their
|
||||||
|
environment/dependency management ([#1](https://github.com/enpaul/tox-poetry-installer/issues/1))
|
||||||
|
|
||||||
|
## Version 0.2.1
|
||||||
|
|
||||||
|
View this release on:
|
||||||
|
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.2.1),
|
||||||
|
[PyPI](https://pypi.org/project/tox-poetry-installer/0.2.1/)
|
||||||
|
|
||||||
|
- Fix duplicate installation of transient environment dependencies
|
||||||
|
- Fix logging error indicating all environments always have zero dependencies
|
||||||
|
- Fix installing main dependencies when `skip_install` is false but `skipdist` is true
|
||||||
|
|
||||||
|
## Version 0.2.0
|
||||||
|
|
||||||
|
View this release on:
|
||||||
|
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.2.0),
|
||||||
|
[PyPI](https://pypi.org/project/tox-poetry-installer/0.2.0/)
|
||||||
|
|
||||||
|
- Add support for per-environment configuration setting `require_locked_deps`
|
||||||
|
- Add support for per-dependency lock requirement setting using `@poetry` suffix
|
||||||
|
- Add support for coexisting locked and unlocked dependencies in a single test environment
|
||||||
|
- Update documentation to include more usage examples
|
||||||
|
- Update documentation to improve clarity around problems and drawbacks
|
||||||
|
- Fix logging messages being inconsistently formatted
|
||||||
|
- Fix raising the same exception for "locked dependency not found" and "locked dependency
|
||||||
|
specifies alternate version" errors
|
||||||
|
- Fix plugin errors not reporting to Tox that they happened
|
||||||
|
- Fix plugin errors not causing Tox to mark the env as failed
|
||||||
|
|
||||||
|
## Version 0.1.3
|
||||||
|
|
||||||
|
View this release on:
|
||||||
|
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.1.3),
|
||||||
|
[PyPI](https://pypi.org/project/tox-poetry-installer/0.1.3/)
|
||||||
|
|
||||||
|
- Fix core functionality of installing dependencies from lockfile for the
|
||||||
|
package-under-development ("dev-package") built by Tox
|
||||||
|
- Fix log messages not being displayed with Tox output
|
||||||
|
- Add additional logging output for diagnostics
|
||||||
|
- Update Poetry requirement to exclude upcoming Poetry-1.1.0 release which will break
|
||||||
|
compatibility
|
||||||
|
|
||||||
|
This is the first release where the core functionality actually works as expected :tada:
|
||||||
|
|
||||||
|
## Version 0.1.2
|
||||||
|
|
||||||
|
View this release on:
|
||||||
|
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.1.2),
|
||||||
|
[PyPI](https://pypi.org/project/tox-poetry-installer/0.1.2/)
|
||||||
|
|
||||||
|
- Test trivial functionality on Python-3.6 and Python-3.7
|
||||||
|
- Fix disagreement between `pyproject.toml` and module metadata on what the current version
|
||||||
|
is
|
||||||
|
- Fix constant named for PEP-440 that should have been named for PEP-508
|
||||||
|
|
||||||
|
## Version 0.1.1
|
||||||
|
|
||||||
|
View this release on:
|
||||||
|
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.1.1),
|
||||||
|
[PyPI](https://pypi.org/project/tox-poetry-installer/0.1.1/)
|
||||||
|
|
||||||
|
- Add/update project documentation
|
||||||
|
- Add static analysis and formatting enforcement automation to toxfile
|
||||||
|
- Add security analysis to toxfile
|
||||||
|
- Fix raising `KeyError` for unlocked dependencies
|
||||||
|
- Fix mishandling of Poetry's "unsafe dependencies"
|
||||||
|
- Lint, blacken, and generally improve code quality
|
||||||
|
|
||||||
|
## Version 0.1.0
|
||||||
|
|
||||||
|
View this release on:
|
||||||
|
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.1.0),
|
||||||
|
|
||||||
|
- Add support for installing Tox environment dependencies using Poetry from the Poetry
|
||||||
|
lockfile
|
||||||
@@ -1,129 +1,115 @@
|
|||||||
|
|
||||||
# Contributor Covenant Code of Conduct
|
# Contributor Covenant Code of Conduct
|
||||||
|
|
||||||
## Our Pledge
|
## Our Pledge
|
||||||
|
|
||||||
We as members, contributors, and leaders pledge to make participation in our
|
We as members, contributors, and leaders pledge to make participation in our community a
|
||||||
community a harassment-free experience for everyone, regardless of age, body
|
harassment-free experience for everyone, regardless of age, body size, visible or
|
||||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
invisible disability, ethnicity, sex characteristics, gender identity and expression,
|
||||||
identity and expression, level of experience, education, socio-economic status,
|
level of experience, education, socio-economic status, nationality, personal appearance,
|
||||||
nationality, personal appearance, race, religion, or sexual identity
|
race, religion, or sexual identity and orientation.
|
||||||
and orientation.
|
|
||||||
|
|
||||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
We pledge to act and interact in ways that contribute to an open, welcoming, diverse,
|
||||||
diverse, inclusive, and healthy community.
|
inclusive, and healthy community.
|
||||||
|
|
||||||
## Our Standards
|
## Our Standards
|
||||||
|
|
||||||
Examples of behavior that contributes to a positive environment for our
|
Examples of behavior that contributes to a positive environment for our community include:
|
||||||
community include:
|
|
||||||
|
|
||||||
* Demonstrating empathy and kindness toward other people
|
- Demonstrating empathy and kindness toward other people
|
||||||
* Being respectful of differing opinions, viewpoints, and experiences
|
- Being respectful of differing opinions, viewpoints, and experiences
|
||||||
* Giving and gracefully accepting constructive feedback
|
- Giving and gracefully accepting constructive feedback
|
||||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
- Accepting responsibility and apologizing to those affected by our mistakes, and learning
|
||||||
and learning from the experience
|
from the experience
|
||||||
* Focusing on what is best not just for us as individuals, but for the
|
- Focusing on what is best not just for us as individuals, but for the overall community
|
||||||
overall community
|
|
||||||
|
|
||||||
Examples of unacceptable behavior include:
|
Examples of unacceptable behavior include:
|
||||||
|
|
||||||
* The use of sexualized language or imagery, and sexual attention or
|
- The use of sexualized language or imagery, and sexual attention or advances of any kind
|
||||||
advances of any kind
|
- Trolling, insulting or derogatory comments, and personal or political attacks
|
||||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
- Public or private harassment
|
||||||
* Public or private harassment
|
- Publishing others' private information, such as a physical or email address, without their
|
||||||
* Publishing others' private information, such as a physical or email
|
explicit permission
|
||||||
address, without their explicit permission
|
- Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||||
* Other conduct which could reasonably be considered inappropriate in a
|
|
||||||
professional setting
|
|
||||||
|
|
||||||
## Enforcement Responsibilities
|
## Enforcement Responsibilities
|
||||||
|
|
||||||
Community leaders are responsible for clarifying and enforcing our standards of
|
Community leaders are responsible for clarifying and enforcing our standards of acceptable
|
||||||
acceptable behavior and will take appropriate and fair corrective action in
|
behavior and will take appropriate and fair corrective action in response to any behavior
|
||||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
that they deem inappropriate, threatening, offensive, or harmful.
|
||||||
or harmful.
|
|
||||||
|
|
||||||
Community leaders have the right and responsibility to remove, edit, or reject
|
Community leaders have the right and responsibility to remove, edit, or reject comments,
|
||||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
commits, code, wiki edits, issues, and other contributions that are not aligned to this
|
||||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
||||||
decisions when appropriate.
|
|
||||||
|
|
||||||
## Scope
|
## Scope
|
||||||
|
|
||||||
This Code of Conduct applies within all community spaces, and also applies when
|
This Code of Conduct applies within all community spaces, and also applies when an
|
||||||
an individual is officially representing the community in public spaces.
|
individual is officially representing the community in public spaces. Examples of
|
||||||
Examples of representing our community include using an official e-mail address,
|
representing our community include using an official e-mail address, posting via an
|
||||||
posting via an official social media account, or acting as an appointed
|
official social media account, or acting as an appointed representative at an online or
|
||||||
representative at an online or offline event.
|
offline event.
|
||||||
|
|
||||||
## Enforcement
|
## Enforcement
|
||||||
|
|
||||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the
|
||||||
reported to the community leaders responsible for enforcement at
|
community leaders responsible for enforcement at \[INSERT CONTACT METHOD\]. All
|
||||||
[INSERT CONTACT METHOD].
|
complaints will be reviewed and investigated promptly and fairly.
|
||||||
All complaints will be reviewed and investigated promptly and fairly.
|
|
||||||
|
|
||||||
All community leaders are obligated to respect the privacy and security of the
|
All community leaders are obligated to respect the privacy and security of the reporter of
|
||||||
reporter of any incident.
|
any incident.
|
||||||
|
|
||||||
## Enforcement Guidelines
|
## Enforcement Guidelines
|
||||||
|
|
||||||
Community leaders will follow these Community Impact Guidelines in determining
|
Community leaders will follow these Community Impact Guidelines in determining the
|
||||||
the consequences for any action they deem in violation of this Code of Conduct:
|
consequences for any action they deem in violation of this Code of Conduct:
|
||||||
|
|
||||||
### 1. Correction
|
### 1. Correction
|
||||||
|
|
||||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||||
unprofessional or unwelcome in the community.
|
unprofessional or unwelcome in the community.
|
||||||
|
|
||||||
**Consequence**: A private, written warning from community leaders, providing
|
**Consequence**: A private, written warning from community leaders, providing clarity
|
||||||
clarity around the nature of the violation and an explanation of why the
|
around the nature of the violation and an explanation of why the behavior was
|
||||||
behavior was inappropriate. A public apology may be requested.
|
inappropriate. A public apology may be requested.
|
||||||
|
|
||||||
### 2. Warning
|
### 2. Warning
|
||||||
|
|
||||||
**Community Impact**: A violation through a single incident or series
|
**Community Impact**: A violation through a single incident or series of actions.
|
||||||
of actions.
|
|
||||||
|
|
||||||
**Consequence**: A warning with consequences for continued behavior. No
|
**Consequence**: A warning with consequences for continued behavior. No interaction with
|
||||||
interaction with the people involved, including unsolicited interaction with
|
the people involved, including unsolicited interaction with those enforcing the Code of
|
||||||
those enforcing the Code of Conduct, for a specified period of time. This
|
Conduct, for a specified period of time. This includes avoiding interactions in community
|
||||||
includes avoiding interactions in community spaces as well as external channels
|
spaces as well as external channels like social media. Violating these terms may lead to a
|
||||||
like social media. Violating these terms may lead to a temporary or
|
temporary or permanent ban.
|
||||||
permanent ban.
|
|
||||||
|
|
||||||
### 3. Temporary Ban
|
### 3. Temporary Ban
|
||||||
|
|
||||||
**Community Impact**: A serious violation of community standards, including
|
**Community Impact**: A serious violation of community standards, including sustained
|
||||||
sustained inappropriate behavior.
|
inappropriate behavior.
|
||||||
|
|
||||||
**Consequence**: A temporary ban from any sort of interaction or public
|
**Consequence**: A temporary ban from any sort of interaction or public communication with
|
||||||
communication with the community for a specified period of time. No public or
|
the community for a specified period of time. No public or private interaction with the
|
||||||
private interaction with the people involved, including unsolicited interaction
|
people involved, including unsolicited interaction with those enforcing the Code of
|
||||||
with those enforcing the Code of Conduct, is allowed during this period.
|
Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
||||||
Violating these terms may lead to a permanent ban.
|
|
||||||
|
|
||||||
### 4. Permanent Ban
|
### 4. Permanent Ban
|
||||||
|
|
||||||
**Community Impact**: Demonstrating a pattern of violation of community
|
**Community Impact**: Demonstrating a pattern of violation of community standards,
|
||||||
standards, including sustained inappropriate behavior, harassment of an
|
including sustained inappropriate behavior, harassment of an individual, or aggression
|
||||||
individual, or aggression toward or disparagement of classes of individuals.
|
toward or disparagement of classes of individuals.
|
||||||
|
|
||||||
**Consequence**: A permanent ban from any sort of public interaction within
|
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
||||||
the community.
|
|
||||||
|
|
||||||
## Attribution
|
## Attribution
|
||||||
|
|
||||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
||||||
version 2.0, available at
|
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
||||||
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
|
||||||
|
|
||||||
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
||||||
enforcement ladder](https://github.com/mozilla/diversity).
|
enforcement ladder](https://github.com/mozilla/diversity).
|
||||||
|
|
||||||
[homepage]: https://www.contributor-covenant.org
|
|
||||||
|
|
||||||
For answers to common questions about this code of conduct, see the FAQ at
|
For answers to common questions about this code of conduct, see the FAQ at
|
||||||
https://www.contributor-covenant.org/faq. Translations are available at
|
https://www.contributor-covenant.org/faq. Translations are available at
|
||||||
https://www.contributor-covenant.org/translations.
|
https://www.contributor-covenant.org/translations.
|
||||||
|
|
||||||
|
[homepage]: https://www.contributor-covenant.org
|
||||||
|
|||||||
22
LICENSE.md
22
LICENSE.md
@@ -1,11 +1,17 @@
|
|||||||
## Copyright 2020 Ethan Paul
|
## Copyright 2020, 2022 Ethan Paul
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||||
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
software and associated documentation files (the "Software"), to deal in the Software
|
||||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||||
and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||||
|
to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of
|
The above copyright notice and this permission notice shall be included in all copies or
|
||||||
the Software.
|
substantial portions of the Software.
|
||||||
|
|
||||||
**THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.**
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||||
|
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
|||||||
6
Makefile
6
Makefile
@@ -32,5 +32,9 @@ source: ## Build Python source distribution package
|
|||||||
test: ## Run the project testsuite(s)
|
test: ## Run the project testsuite(s)
|
||||||
poetry run tox --recreate
|
poetry run tox --recreate
|
||||||
|
|
||||||
publish: wheel source ## Build and upload to pypi (requires $PYPI_API_KEY be set)
|
dev: ## Create the local dev environment
|
||||||
|
poetry install -E poetry
|
||||||
|
poetry run pre-commit install
|
||||||
|
|
||||||
|
publish: test wheel source ## Build and upload to pypi (requires $PYPI_API_KEY be set)
|
||||||
@poetry publish --username __token__ --password $(PYPI_API_KEY)
|
@poetry publish --username __token__ --password $(PYPI_API_KEY)
|
||||||
|
|||||||
713
README.md
713
README.md
@@ -1,126 +1,124 @@
|
|||||||
# tox-poetry-installer
|
# tox-poetry-installer
|
||||||
|
|
||||||
A plugin for [Tox](https://tox.readthedocs.io/en/latest/) that allows test environment
|
A plugin for [Tox](https://tox.readthedocs.io/en/latest/) that lets you install test
|
||||||
dependencies to be installed using [Poetry](https://python-poetry.org/) from its lockfile.
|
environment dependencies from the [Poetry](https://python-poetry.org/) lockfile.
|
||||||
|
|
||||||
|
[](https://github.com/enpaul/tox-poetry-installer/actions)
|
||||||
|
[](https://pypi.org/project/tox-poetry-installer/)
|
||||||
|
[](https://libraries.io/pypi/tox-poetry-installer)
|
||||||
|
[](https://opensource.org/licenses/MIT)
|
||||||
|
[](https://www.python.org)
|
||||||
|
[](https://github.com/psf/black)
|
||||||
|
|
||||||
⚠️ **This project is beta software and is under active development** ⚠️
|
⚠️ **This project is beta software and is under active development** ⚠️
|
||||||
|
|
||||||
[](https://github.com/enpaul/tox-poetry-installer/actions)
|
## Documentation
|
||||||
[](https://pypi.org/project/tox-poetry-installer/)
|
|
||||||
[](https://libraries.io/pypi/tox-poetry-installer)
|
|
||||||
[](https://opensource.org/licenses/MIT)
|
|
||||||
[](https://www.python.org)
|
|
||||||
[](https://github.com/psf/black)
|
|
||||||
|
|
||||||
**Documentation**
|
- [Feature Overview](#feature-overview)
|
||||||
|
- [Using the Plugin](#user-documentation)
|
||||||
|
- [Installing](#installing)
|
||||||
|
- [Quick Start](#quick-start)
|
||||||
|
- [References](#references)
|
||||||
|
- [Config Options](#configuration-options)
|
||||||
|
- [Runtime Options](#runtime-options)
|
||||||
|
- [Errors](#errors)
|
||||||
|
- [Other Notes](#other-notes)
|
||||||
|
- [Unsupported Tox config options](#unsupported-tox-config-options)
|
||||||
|
- [Updating locked dependencies in a testenv](#updating-locked-dependencies-in-a-testenv)
|
||||||
|
- [Installing unsafe dependencies](#installing-unsafe-dependencies)
|
||||||
|
- [Using with an unmanaged Poetry installation](#using-with-an-unmanaged-poetry-installation)
|
||||||
|
- [Developing the Plugin](#developer-documentation)
|
||||||
|
- [Road Map](#road-map)
|
||||||
|
|
||||||
* [Introduction](#introduction)
|
See the
|
||||||
* [Install](#install)
|
[Changelog](https://github.com/enpaul/tox-poetry-installer/blob/devel/CHANGELOG.md) for
|
||||||
* [Quick Start](#quick-start)
|
release history.
|
||||||
* [Why would I use this?](#why-would-i-use-this) (What problems does this solve?)
|
|
||||||
* [Reference](#reference)
|
|
||||||
* [Configuration Options](#configuration-options)
|
|
||||||
* [Command-line Arguments](#command-line-arguments)
|
|
||||||
* [Errors](#errors)
|
|
||||||
* [Advanced Usage](#advanced-usage)
|
|
||||||
* [Developing](#developing)
|
|
||||||
* [Contributing](#contributing)
|
|
||||||
* [Roadmap](#roadmap)
|
|
||||||
* [Path to Beta](#path-to-beta)
|
|
||||||
* [Path to Stable](#path-to-stable)
|
|
||||||
|
|
||||||
Related resources:
|
*See also: [official Tox plugins](https://tox.readthedocs.io/en/latest/plugins.html), [Poetry-Dev-Dependencies Tox plugin](https://github.com/sinoroc/tox-poetry-dev-dependencies), [Poetry Tox plugin](https://github.com/tkukushkin/tox-poetry)*
|
||||||
* [Poetry Python Project Manager](https://python-poetry.org/)
|
|
||||||
* [Tox Automation Project](https://tox.readthedocs.io/en/latest/)
|
|
||||||
* [Other Tox plugins](https://tox.readthedocs.io/en/latest/plugins.html)
|
|
||||||
|
|
||||||
Similar projects:
|
## Feature Overview
|
||||||
* [Poetry Dev-Dependencies Tox Plugin](https://github.com/sinoroc/tox-poetry-dev-dependencies)
|
|
||||||
* [Poetry Tox Plugin](https://github.com/tkukushkin/tox-poetry)
|
|
||||||
|
|
||||||
|
- Manage package versions in exactly one place and with exactly one tool: Poetry.
|
||||||
|
- Ensure CI/CD and other automation tools are using the same package versions that you are
|
||||||
|
in your local development environment.
|
||||||
|
- Add only the packages you need to a Tox test environment, instead of everything in your
|
||||||
|
lockfile.
|
||||||
|
- Directly integrate with Poetry, re-using your existing package indexes and credentials
|
||||||
|
with no additional configuration.
|
||||||
|
- Wherever possible, built-in Tox config options are always respected and their behavior
|
||||||
|
kept consistent.
|
||||||
|
- Extremely configurable. Every feature can be disabled or enabled for any given Tox test
|
||||||
|
environment.
|
||||||
|
- Friendly to other Tox plugins and supports a wide range of environments.
|
||||||
|
|
||||||
## Introduction
|
## User Documentation
|
||||||
|
|
||||||
This is a plugin to unify two great projects in the Python ecosystem: the
|
*This section is for users looking to integrate the plugin with their project or CI system. For information on contributing to the plugin please see the [Developer Docs](#developer-documentation)*
|
||||||
[Tox](https://tox.readthedocs.io/en/latest/) automation project and the
|
|
||||||
[Poetry](https://python-poetry.org) project/dependency manager. Specifically it allows
|
|
||||||
the repeatable dependency resolution and installation tools that Poetry uses to benefit
|
|
||||||
the isolated environments that Tox uses to run automated tests. The motivation to write
|
|
||||||
this plugin came from a need for a single source of truth for the versions of all
|
|
||||||
packages that should be installed to an environment.
|
|
||||||
|
|
||||||
When in use this plugin will allow a Tox environment to install its required
|
### Installing
|
||||||
dependencies using the versions specified in the Poetry lockfile. This eliminates
|
|
||||||
needing to specify package versions in multiple places as well as ensures that the Tox
|
|
||||||
environment has the exact same versions of a given package as the Poetry environment.
|
|
||||||
This reduces (or hopefully eliminates) hard to debug problems caused by subtle
|
|
||||||
differences in the dependency graph of the active development environment (the one managed
|
|
||||||
by Poetry) and the automated test environment(s) created by Tox.
|
|
||||||
|
|
||||||
To learn more about the problems this plugin aims to solve jump ahead to
|
The recommended way to install the plugin is to add it to a project using Poetry:
|
||||||
[What problems does this solve?](#why-would-i-use-this).
|
|
||||||
Otherwise keep reading to get started.
|
|
||||||
|
|
||||||
### Install
|
|
||||||
|
|
||||||
The recommended way to install the plugin is to add it to a project's `pyproject.toml`
|
|
||||||
and lockfile using Poetry:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
poetry add tox-poetry-installer[poetry] --dev
|
poetry add tox-poetry-installer[poetry] --dev
|
||||||
```
|
```
|
||||||
|
|
||||||
**WARNING:** The below installation methods are vulnerable to the
|
> **Note:** Always install the plugin with the `[poetry]` extra, unless you are
|
||||||
[transient dependency issues this plugin aims to avoid](#why-would-i-use-this). It is
|
> [managing the Poetry installation yourself](#externally-managed-poetry-installation).
|
||||||
always recommended to install dependencies using Poetry whenever possible.
|
|
||||||
|
|
||||||
The plugin can also be installed with pip directly, though it is recommended to always
|
Alternatively, it can be installed directly to a virtual environment using Pip, though
|
||||||
install to a virtual environment and pin to a specific version:
|
this is not recommended:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
source my-venv/bi/activate
|
source somevenv/bin/activate
|
||||||
pip install tox-poetry-installer[poetry] == 0.6.0
|
pip install tox-poetry-installer
|
||||||
```
|
```
|
||||||
|
|
||||||
The plugin can also be installed using the Tox
|
Alternatively alternatively, it can be installed using the Tox
|
||||||
[`requires`]((https://tox.readthedocs.io/en/latest/config.html#conf-requires))
|
[`requires`](https://tox.readthedocs.io/en/latest/config.html#conf-requires) option by
|
||||||
configuration option. Note however that dependencies installed via the `requires` option
|
adding the below to `tox.ini`, though this is also not recommended:
|
||||||
are not handled by the plugin and will be installed the same way as a `pip install ...`
|
|
||||||
above. For this reason it is also recommended to always pin to a specific version when
|
|
||||||
using this installation method:
|
|
||||||
|
|
||||||
```ini
|
```ini
|
||||||
# tox.ini
|
requires =
|
||||||
[tox]
|
tox-poetry-installer[poetry] == 0.8.0
|
||||||
requires
|
|
||||||
tox-poetry-installer[poetry] == 0.6.0
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Check that the plugin is registered by checking the Tox version:
|
After installing, check that Tox recognizes the plugin by running
|
||||||
|
`poetry run tox --version`. The command should give output similar to below:
|
||||||
|
|
||||||
```
|
```
|
||||||
~ $: poetry run tox --version
|
|
||||||
3.20.0 imported from .venv/lib64/python3.8/site-packages/tox/__init__.py
|
3.20.0 imported from .venv/lib64/python3.8/site-packages/tox/__init__.py
|
||||||
registered plugins:
|
registered plugins:
|
||||||
tox-poetry-installer-0.6.0 at .venv/lib64/python3.8/site-packages/tox_poetry_installer.py
|
tox-poetry-installer-0.8.0 at .venv/lib64/python3.8/site-packages/tox_poetry_installer/__init__.py
|
||||||
```
|
```
|
||||||
|
|
||||||
**NOTE:** Installing the `tox-poetry-installer[poetry]` extra will add the `poetry`
|
|
||||||
package as a managed environment dependency which can cause problems when the Poetry
|
|
||||||
installation is externally managed (such as in a CI or container environment). See
|
|
||||||
[Advanced Usage](#installing-alongside-an-existing-poetry-installation) for more
|
|
||||||
information on this use case.
|
|
||||||
|
|
||||||
### Quick Start
|
### Quick Start
|
||||||
|
|
||||||
Before making any changes to `tox.ini` the project is already benefiting from having
|
Congratulations! 🎉 Just by installing the plugin your Tox config is already using locked
|
||||||
the plugin installed: all dependencies of the root project package are installed using
|
dependencies: when Tox builds and installs your project package to a test environment,
|
||||||
the Poetry backend to all Tox environments that install the root package without any
|
your project package's dependencies will be installed from the lockfile.
|
||||||
configuration changes.
|
|
||||||
|
|
||||||
To add dependencies from the lockfile to a Tox environment, add the option
|
Now lets update an example `tox.ini` to install the other test environment dependencies
|
||||||
[`locked_deps`](#locked_deps) to the environment configuration and list names of
|
from the lockfile.
|
||||||
dependencies (with no version specifier) under it:
|
|
||||||
|
A `testenv` from the example `tox.ini` we're starting with is below:
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[testenv]
|
||||||
|
description = Some very cool tests
|
||||||
|
deps =
|
||||||
|
black == 20.8b1
|
||||||
|
pylint >=2.4.4,<2.7.0
|
||||||
|
mypy <0.800
|
||||||
|
commands = ...
|
||||||
|
```
|
||||||
|
|
||||||
|
To update the config so that the testenv dependencies are installed from the lockfile, we
|
||||||
|
can replace the built-in
|
||||||
|
[`deps`](https://tox.readthedocs.io/en/latest/config.html#conf-deps) option with the
|
||||||
|
`locked_deps` option provided by the plugin, and then remove the inline version
|
||||||
|
specifiers. With these changes the three testenv dependencies (as well as all of their
|
||||||
|
dependencies) will be installed from the lockfile when the test environment is recreated:
|
||||||
|
|
||||||
```ini
|
```ini
|
||||||
[testenv]
|
[testenv]
|
||||||
@@ -132,125 +130,59 @@ locked_deps =
|
|||||||
commands = ...
|
commands = ...
|
||||||
```
|
```
|
||||||
|
|
||||||
The standard [`deps`](https://tox.readthedocs.io/en/latest/config.html#conf-deps) option
|
We can also add the `require_locked_deps` option to the test environment. This will both
|
||||||
can be used in parallel with the `locked_deps` option to install unlocked dependencies
|
block any other install tools (another plugin or Tox itself) from installing dependencies
|
||||||
(dependencies not in the lockfile) alongside locked dependencies:
|
to the Tox environment and also cause Tox to fail if the test environment also uses the
|
||||||
|
built-in [`deps`](https://tox.readthedocs.io/en/latest/config.html#conf-deps) option:
|
||||||
```ini
|
|
||||||
[testenv]
|
|
||||||
description = Some very cool tests
|
|
||||||
locked_deps =
|
|
||||||
black
|
|
||||||
pylint
|
|
||||||
mypy
|
|
||||||
deps =
|
|
||||||
pytest == 6.1.1
|
|
||||||
pytest-cov >= 2.10, <2.11
|
|
||||||
commands = ...
|
|
||||||
```
|
|
||||||
|
|
||||||
Alternatively, to quickly install all Poetry dev-dependencies to a Tox environment, add the
|
|
||||||
[`install_dev_deps`](#install_dev_deps) option to the environment configuration:
|
|
||||||
|
|
||||||
```ini
|
|
||||||
[testenv]
|
|
||||||
description = Some very cool tests
|
|
||||||
install_dev_deps = true
|
|
||||||
```
|
|
||||||
|
|
||||||
See the [Reference](#reference) section for more details on available
|
|
||||||
configuration options and the [Advanced Usage](#advanced-usage) section for some
|
|
||||||
unusual use cases.
|
|
||||||
|
|
||||||
### Why would I use this?
|
|
||||||
|
|
||||||
**The Problem**
|
|
||||||
|
|
||||||
By default Tox uses Pip to install the [PEP-508](https://www.python.org/dev/peps/pep-0508/)
|
|
||||||
compliant dependencies to a test environment. This plugin extends the default Tox
|
|
||||||
dependency installation behavior to support installing dependencies using a Poetry-based
|
|
||||||
installation method that makes use of the dependency metadata from Poetry's lockfile.
|
|
||||||
|
|
||||||
Environment dependencies for a Tox environment are usually specified in PEP-508 format, like
|
|
||||||
the below example:
|
|
||||||
|
|
||||||
```ini
|
|
||||||
[testenv]
|
|
||||||
description = Some very cool tests
|
|
||||||
deps =
|
|
||||||
foo == 1.2.3
|
|
||||||
bar >=1.3,<2.0
|
|
||||||
baz
|
|
||||||
```
|
|
||||||
|
|
||||||
Let's assume these dependencies are also useful during development, so they can be added to the
|
|
||||||
Poetry environment using this command:
|
|
||||||
|
|
||||||
```
|
|
||||||
poetry add --dev \
|
|
||||||
foo==1.2.3 \
|
|
||||||
bar>=1.3,<2.0 \
|
|
||||||
baz
|
|
||||||
```
|
|
||||||
|
|
||||||
However there is a potential problem that could arise from each of these environment
|
|
||||||
dependencies that would _only_ appear in the Tox environment and not in the Poetry
|
|
||||||
environment in use by a developer:
|
|
||||||
|
|
||||||
* **The `foo` dependency is pinned to a specific version:** let's imagine a security
|
|
||||||
vulnerability is discovered in `foo` and the maintainers release version `1.2.4` to fix
|
|
||||||
it. A developer can run `poetry remove foo` and then `poetry add foo^1.2` to get the new
|
|
||||||
version, but the Tox environment is left unchanged. The development environment, as defined by
|
|
||||||
the lockfile, is now patched against the vulnerability but the Tox environment is not.
|
|
||||||
|
|
||||||
* **The `bar` dependency specifies a dynamic range:** a dynamic range allows a range of
|
|
||||||
versions to be installed, but the lockfile will have an exact version specified so that
|
|
||||||
the Poetry environment is reproducible; this allows versions to be updated with
|
|
||||||
`poetry update` rather than with the `remove` and `add` commands used above. If the
|
|
||||||
maintainers of `bar` release version `1.6.0` then the Tox environment will install it
|
|
||||||
because it is valid for the specified version range. Meanwhile the Poetry environment will
|
|
||||||
continue to install the version from the lockfile until `poetry update bar` explicitly
|
|
||||||
updates it. The development environment is now has a different version of `bar` than the Tox
|
|
||||||
environment.
|
|
||||||
|
|
||||||
* **The `baz` dependency is unpinned:** unpinned dependencies are
|
|
||||||
[generally a bad idea](https://python-poetry.org/docs/faq/#why-are-unbound-version-constraints-a-bad-idea),
|
|
||||||
but here it can cause real problems. Poetry will interpret an unbound dependency using
|
|
||||||
[the carrot requirement](https://python-poetry.org/docs/dependency-specification/#caret-requirements)
|
|
||||||
but Pip (via Tox) will interpret it as a wildcard. If the latest version of `baz` is `1.0.0`
|
|
||||||
then `poetry add baz` will result in a constraint of `baz>=1.0.0,<2.0.0` while the Tox
|
|
||||||
environment will have a constraint of `baz==*`. The Tox environment can now install an
|
|
||||||
incompatible version of `baz` and any errors that causes cannot be replicated using `poetry update`.
|
|
||||||
|
|
||||||
All of these problems can apply not only to the dependencies specified for a Tox environment,
|
|
||||||
but also to the dependencies of those dependencies, those dependencies' dependencies, and so on.
|
|
||||||
|
|
||||||
**The Solution**
|
|
||||||
|
|
||||||
This plugin allows dependencies specified in Tox environment take their version directly from
|
|
||||||
the Poetry lockfile without needing an independent version to be specified in the Tox
|
|
||||||
environment configuration. The modified version of the example environment given below appears
|
|
||||||
less stable than the one presented above because it does not specify any versions for its
|
|
||||||
dependencies:
|
|
||||||
|
|
||||||
```ini
|
```ini
|
||||||
[testenv]
|
[testenv]
|
||||||
description = Some very cool tests
|
description = Some very cool tests
|
||||||
require_locked_deps = true
|
require_locked_deps = true
|
||||||
locked_deps =
|
locked_deps =
|
||||||
foo
|
black
|
||||||
bar
|
pylint
|
||||||
baz
|
mypy
|
||||||
|
commands = ...
|
||||||
```
|
```
|
||||||
|
|
||||||
However with the `tox-poetry-installer` plugin installed Tox will install these
|
> **Note:** Settings configured on the main `testenv` environment are inherited by child
|
||||||
dependencies from the Poetry lockfile so that the version installed to the Tox
|
> test environments (for example, `testenv:foo`). To override this, specify the setting in
|
||||||
environment exactly matches the version Poetry is managing. When `poetry update` updates
|
> the child environment with a different value.
|
||||||
the lockfile with new versions of these dependencies, Tox will automatically install
|
|
||||||
these new versions without needing any changes to the configuration.
|
|
||||||
|
|
||||||
|
Alternatively, we can skip specifying all of our dependencies for a test environment in
|
||||||
|
the Tox config and just install all of our Poetry dev-dependencies automatically:
|
||||||
|
|
||||||
## Reference
|
```ini
|
||||||
|
[testenv]
|
||||||
|
description = Some very cool tests
|
||||||
|
require_locked_deps = true
|
||||||
|
install_dev_deps = true
|
||||||
|
commands = ...
|
||||||
|
```
|
||||||
|
|
||||||
|
> **Note:** Setting `install_dev_deps = true` on an environment that also installs the
|
||||||
|
> project package is functionally equivalent to running `poetry install`.
|
||||||
|
|
||||||
|
Finally, we can also install an unlocked dependency (a dependency which doesn't take its
|
||||||
|
version from the Poetry lockfile) into the test environment alongside the locked ones. We
|
||||||
|
need to remove the `require_locked_deps = true` option, otherwise the environment will
|
||||||
|
error, and then we can add the unlocked dependency using the built-in
|
||||||
|
[`deps`](https://tox.readthedocs.io/en/latest/config.html#conf-deps) option:
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[testenv]
|
||||||
|
description = Some very cool tests
|
||||||
|
deps =
|
||||||
|
pytest >= 5.6.0,<6.0.0
|
||||||
|
locked_deps =
|
||||||
|
black
|
||||||
|
pylint
|
||||||
|
mypy
|
||||||
|
commands = ...
|
||||||
|
```
|
||||||
|
|
||||||
|
## References
|
||||||
|
|
||||||
### Configuration Options
|
### Configuration Options
|
||||||
|
|
||||||
@@ -258,210 +190,137 @@ All options listed below are Tox environment options and can be applied to one o
|
|||||||
environment sections of the `tox.ini` file. They cannot be applied to the global Tox
|
environment sections of the `tox.ini` file. They cannot be applied to the global Tox
|
||||||
configuration section.
|
configuration section.
|
||||||
|
|
||||||
**NOTE:** Environment settings applied to the main `testenv` environment will be
|
> **Note:** Settings configured on the main `testenv` environment are inherited by child
|
||||||
inherited by child environments (i.e. `testenv:foo`) unless they are explicitly
|
> test environments (for example, `testenv:foo`). To override this, specify the setting in
|
||||||
overridden by the child environment's configuration.
|
> the child environment with a different value.
|
||||||
|
|
||||||
#### `locked_deps`
|
| Option | Type | Default | Description |
|
||||||
|
| :--------------------- | :-----: | :-----: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
|
| `locked_deps` | List | `[]` | Names of packages to install to the test environment from the Poetry lockfile. Transient dependencies (packages required by these dependencies) are automatically included. |
|
||||||
|
| `require_locked_deps` | Boolean | False | Whether the plugin should block attempts to install unlocked dependencies to the test environment. If enabled, then the [`tox_testenv_install_deps`](https://tox.readthedocs.io/en/latest/plugins.html#tox.hookspecs.tox_testenv_install_deps) plugin hook will be intercepted and an error will be raised if the test environment has the `deps` option configured. |
|
||||||
|
| `install_dev_deps` | Boolean | False | Whether all of the Poetry dev-dependencies should be installed to the test environment. |
|
||||||
|
| `install_project_deps` | Boolean | True | Whether all of the Poetry primary dependencies for the project package should be installed to the test environment. |
|
||||||
|
| `require_poetry` | Boolean | False | Whether Tox should be forced to fail if the plugin cannot import Poetry locally. If `False` then the plugin will be skipped for the test environment if Poetry cannot be imported. If `True` then the plugin will force the environment to error and the Tox run to fail. |
|
||||||
|
|
||||||
* **Type:** multi-line list
|
### Runtime Options
|
||||||
* **Default:** `[]`
|
|
||||||
|
|
||||||
Names of packages in the Poetry lockfile to install to the Tox environment. All
|
|
||||||
dependencies specified here will be installed to the Tox environment using the details
|
|
||||||
given by the Poetry lockfile.
|
|
||||||
|
|
||||||
#### `require_locked_deps`
|
|
||||||
|
|
||||||
|
|
||||||
* **Type:** boolean
|
|
||||||
* **Default:** `false`
|
|
||||||
|
|
||||||
Whether the environment should allow unlocked dependencies (dependencies not in the
|
|
||||||
Poetry lockfile) to be installed alongside locked dependencies. If `true` then an error
|
|
||||||
will be raised if the environment specifies unlocked dependencies to install and the
|
|
||||||
plugin will block any other plugins from using the
|
|
||||||
[`tox_testenv_install_deps`](https://tox.readthedocs.io/en/latest/plugins.html#tox.hookspecs.tox_testenv_install_deps)
|
|
||||||
hook.
|
|
||||||
|
|
||||||
#### `install_dev_deps`
|
|
||||||
|
|
||||||
* **Type:** boolean
|
|
||||||
* **Default:** `false`
|
|
||||||
|
|
||||||
Whether all Poetry dev-dependencies should be installed to the environment. If `true`
|
|
||||||
then all dependencies specified in the
|
|
||||||
[`dev-dependencies`](https://python-poetry.org/docs/pyproject/#dependencies-and-dev-dependencies)
|
|
||||||
section of `pyproject.toml` will be installed automatically.
|
|
||||||
|
|
||||||
### Command-line Arguments
|
|
||||||
|
|
||||||
All arguments listed below can be passed to the `tox` command to modify runtime behavior
|
All arguments listed below can be passed to the `tox` command to modify runtime behavior
|
||||||
of the plugin.
|
of the plugin.
|
||||||
|
|
||||||
#### `--require-poetry`
|
| Argument | Type | Default | Description |
|
||||||
|
| :--------------------------- | :-----: | :-----: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
|
| `--parallel-install-threads` | Integer | `10` | Number of worker threads to use to install dependencies in parallel. Installing in parallel with more threads can greatly speed up the install process, but can cause race conditions during install. Pass this option with the value `0` to entirely disable parallel installation. |
|
||||||
|
|
||||||
Indicates that Poetry is expected to be available to Tox and, if it is not, then the Tox
|
> **Note:** The `--require-poetry` runtime option is deprecated and will be removed in
|
||||||
run should fail. If provided and the `poetry` package is not installed to the same
|
> version 1.0.0. Please set `require_poetry = true` in `tox.ini` for environments that
|
||||||
environment as the `tox` package then Tox will fail.
|
> should fail if Poetry is not available.
|
||||||
|
|
||||||
**NOTE:** See [Advanced Usage](#installing-alongside-an-existing-poetry-installation)
|
> **Note:** The `--parallelize-locked-install` option is deprecated and will be removed in
|
||||||
for more information.
|
> version 1.0.0. Please use the `--parallel-install-threads` option.
|
||||||
|
|
||||||
### Errors
|
### Errors
|
||||||
|
|
||||||
If the plugin encounters an error while processing a Tox environment then it will mark
|
There are several errors that the plugin can encounter for a test environment when Tox is
|
||||||
the environment as failed and set the environment status to one of the values below:
|
run. If an error is encountered then the status of the test environment that caused the
|
||||||
|
error will be set to one of the "Status" values below to indicate what the error was.
|
||||||
|
|
||||||
**NOTE:** In addition to the reasons noted below, the plugin can encounter errors if the
|
| Status/Name | Cause |
|
||||||
Poetry lockfile is not up-to-date with `pyproject.toml`. To resynchronize the
|
| :------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||||
lockfile with the `pyproject.toml` run one of
|
| `ExtraNotFoundError` | Indicates that the [`extras`](https://tox.readthedocs.io/en/latest/config.html#conf-extras) config option specified an extra that is not configured by Poetry in `pyproject.toml`. |
|
||||||
[`poetry update`](https://python-poetry.org/docs/cli/#update) or
|
| `LockedDepVersionConflictError` | Indicates that an item in the `locked_deps` config option includes a [PEP-508 version specifier](https://www.python.org/dev/peps/pep-0508/#grammar) (ex: `pytest >=6.0, <6.1`). |
|
||||||
[`poetry lock`](https://python-poetry.org/docs/cli/#lock)
|
| `LockedDepNotFoundError` | Indicates that an item specified in the `locked_deps` config option does not match the name of a package in the Poetry lockfile. |
|
||||||
|
| `LockedDepsRequiredError` | Indicates that a test environment with the `require_locked_deps` config option set to `true` also specified unlocked dependencies using the [`deps`](https://tox.readthedocs.io/en/latest/config.html#conf-deps) config option. |
|
||||||
|
| `PoetryNotInstalledError` | Indicates that the `poetry` module could not be imported under the current runtime environment, and the `--require-poetry` flag was provided. |
|
||||||
|
| `RequiresUnsafeDepError` | Indicates that the package-under-test depends on a package that Poetry has classified as unsafe and cannot be installed. |
|
||||||
|
|
||||||
#### Poetry Not Installed Error
|
> **Note:** One or more of these errors can be caused by the `pyproject.toml` being out of
|
||||||
|
> sync with the Poetry lockfile. If this is the case, than a warning will be logged when Tox
|
||||||
|
> is run.
|
||||||
|
|
||||||
* **Status value:** `PoetryNotInstalledError`
|
### Other Notes
|
||||||
* **Cause:** Indicates that the `poetry` module could not be imported from the same
|
|
||||||
environment as the running `tox` module and the runtime flags specified
|
|
||||||
[`--require-poetry`](#--require-poetry).
|
|
||||||
* **Resolution options:**
|
|
||||||
* Install Poetry: ensure that `poetry` is installed to the same environment as `tox`.
|
|
||||||
* Skip running the plugin: remove the `--require-poetry` flag from the runtime options.
|
|
||||||
|
|
||||||
**NOTE:** See [Advanced Usage](#installing-alongside-an-existing-poetry-installation)
|
#### Unsupported Tox config options
|
||||||
for more information.
|
|
||||||
|
|
||||||
#### Locked Dependency Version Conflict Error
|
Below are the built-in Tox config options that are not respected by this plugin. All of
|
||||||
|
these options are made obsolete by the Poetry lockfile: either they aren't needed or their
|
||||||
|
equivalent functionality is instead taken directly from the package details Poetry stores
|
||||||
|
in its lockfile.
|
||||||
|
|
||||||
* **Status value:** `LockedDepVersionConflictError`
|
> **Note:** The unsupported Tox config options will still apply to unlocked dependencies
|
||||||
* **Cause:** Indicates that a dependency specified in the [`locked_deps`](#locked_deps)
|
> being installed with the default Tox installation backend.
|
||||||
configuration option in `tox.ini` includes a
|
|
||||||
[PEP-508 version specifier](https://www.python.org/dev/peps/pep-0508/#grammar)
|
|
||||||
(i.e. `pytest >=6.0, <6.1`).
|
|
||||||
* **Resolution options:**
|
|
||||||
* Use the dependency version from the lockfile: remove any/all version specifiers
|
|
||||||
from the item in the `locked_deps` list in `tox.ini`.
|
|
||||||
* Do not install the dependency: remove the item from the `locked_deps` list in
|
|
||||||
`tox.ini`.
|
|
||||||
|
|
||||||
#### Locked Dependency Not Found Error
|
- [`install_command`](https://tox.readthedocs.io/en/latest/config.html#conf-install_command)
|
||||||
|
- [`pip_pre`](https://tox.readthedocs.io/en/latest/config.html#conf-pip_pre)
|
||||||
|
- [`download`](https://tox.readthedocs.io/en/latest/config.html#conf-download)
|
||||||
|
- [`indexserver`](https://tox.readthedocs.io/en/latest/config.html#conf-indexserver)
|
||||||
|
- [`usedevelop`](https://tox.readthedocs.io/en/latest/config.html#conf-indexserver)
|
||||||
|
|
||||||
* **Status value:** `LockedDepNotFoundError`
|
#### Updating locked dependencies in a testenv
|
||||||
* **Cause:** Indicates that a dependency specified in the [`locked_deps`](#locked_deps)
|
|
||||||
configuration option in `tox.ini` could not be found in the Poetry lockfile.
|
|
||||||
* **Resolution options:**
|
|
||||||
* Add the dependency to the lockfile: run
|
|
||||||
[`poetry add <dependency>`](https://python-poetry.org/docs/cli/#add).
|
|
||||||
* Do not install the dependency: remove the item from the `locked_deps` list in
|
|
||||||
`tox.ini`.
|
|
||||||
|
|
||||||
#### Extra Not Found Error
|
When Poetry updates the version of a package in the lockfile (using either `poetry lock`
|
||||||
|
or `poetry update`) then the plugin will automatically use this new version to install the
|
||||||
|
package to a test environment; there is no need to manually update `tox.ini` after
|
||||||
|
updating the Poetry lockfile.
|
||||||
|
|
||||||
* **Status value:** `ExtraNotFoundError`
|
However, the plugin cannot determine when the lockfile is updated. If a Tox test
|
||||||
* **Cause:** Indicates that the [`extras`](https://tox.readthedocs.io/en/latest/config.html#conf-extras)
|
environment has already been created then it will need to be recreated (using Tox's
|
||||||
configuration option specified a setuptools extra that is not configured by Poetry in
|
built-in
|
||||||
`pyproject.toml`
|
[`--recreate`](https://tox.readthedocs.io/en/latest/example/basic.html#forcing-re-creation-of-virtual-environments)
|
||||||
* **Resolution options:**
|
option) for the new version to be found and installed.
|
||||||
* Configure the extra: add a section for the named extra to the
|
|
||||||
[`extras`](https://python-poetry.org/docs/pyproject/#extras) section of
|
|
||||||
`pyproject.toml` and optionally assign dependencies to the named extra using the
|
|
||||||
[`--optional`](https://python-poetry.org/docs/cli/#options_3) dependency setting.
|
|
||||||
* Remove the extra: remove the item from the `extras` list in `tox.ini`.
|
|
||||||
|
|
||||||
#### Locked Dependencies Required Error
|
> **Note:** To force Tox to always recreate a test environment the
|
||||||
|
> [`recreate`](https://tox.readthedocs.io/en/latest/config.html#conf-recreate) config option
|
||||||
|
> can be set.
|
||||||
|
|
||||||
* **Status value:** `LockedDepsRequiredError`
|
#### Installing unsafe dependencies
|
||||||
* **Cause:** Indicates that an environment with the [`require_locked_deps`](#require_locked_deps)
|
|
||||||
configuration option also specified unlocked dependencies using
|
|
||||||
[`deps`](https://tox.readthedocs.io/en/latest/config.html#conf-deps) option in
|
|
||||||
`tox.ini`.
|
|
||||||
* **Resolution options:**
|
|
||||||
* Remove all unlocked dependencies: remove the `deps` configuration option in
|
|
||||||
`tox.ini`.
|
|
||||||
* Allow unlocked dependencies: remove the `require_locked_deps` configuration option
|
|
||||||
in `tox.ini` or explicitly set `require_locked_deps = false`.
|
|
||||||
|
|
||||||
### Advanced Usage
|
|
||||||
|
|
||||||
#### Unsupported Tox configuration options
|
|
||||||
|
|
||||||
The `tox.ini` configuration options listed below have no effect on the dependencies
|
|
||||||
installed by this plugin the Poetry lockfile. Note that these settings will still be
|
|
||||||
applied by the default Tox installation backend when installing unlocked dependencies
|
|
||||||
using the built-in `deps` option.
|
|
||||||
|
|
||||||
* [`install_command`](https://tox.readthedocs.io/en/latest/config.html#conf-install_command)
|
|
||||||
* [`pip_pre`](https://tox.readthedocs.io/en/latest/config.html#conf-pip_pre)
|
|
||||||
* [`download`](https://tox.readthedocs.io/en/latest/config.html#conf-download)
|
|
||||||
* [`indexserver`](https://tox.readthedocs.io/en/latest/config.html#conf-indexserver)
|
|
||||||
* [`usedevelop`](https://tox.readthedocs.io/en/latest/config.html#conf-indexserver)
|
|
||||||
|
|
||||||
All of these options are obsoleted by using the Poetry backend. If a given package
|
|
||||||
installs successfully using Poetry (using either `poetry add <package>` or
|
|
||||||
`poetry install`) then the required configuration options are already properly set in
|
|
||||||
the Poetry configuration and the plugin will automatically use the same settings when
|
|
||||||
installing the package.
|
|
||||||
|
|
||||||
#### Reinstalling locked dependencies to a Tox environment
|
|
||||||
|
|
||||||
Updating the `poetry.lock` file will not automatically cause Tox to install the updated
|
|
||||||
lockfile specifications to the Tox environments that specify them.
|
|
||||||
|
|
||||||
The Tox environment(s) with updated locked dependencies must be deleted and recreated
|
|
||||||
using the [`--recreate`](https://tox.readthedocs.io/en/latest/config.html#cmdoption-tox-r)
|
|
||||||
runtime flag. Alternatively Tox can be configured to always recreate an environment by
|
|
||||||
setting the [`recreate`](https://tox.readthedocs.io/en/latest/config.html#conf-recreate)
|
|
||||||
option in `tox.ini`.
|
|
||||||
|
|
||||||
#### Installing Poetry's unsafe dependencies
|
|
||||||
|
|
||||||
There are several packages that cannot be installed from the lockfile because they are
|
There are several packages that cannot be installed from the lockfile because they are
|
||||||
excluded by Poetry itself. As a result these packages cannot be installed by this plugin
|
excluded by Poetry itself. As a result these packages cannot be installed by this plugin
|
||||||
either as environment dependencies (passed directly to [`locked_deps`](#locked_deps)) or
|
either as test environment dependencies passed directly to `locked_deps` or as a transient
|
||||||
as transient dependencies (a dependency of a locked dependency).
|
dependency. When one of these packages is encountered by the plugin a warning will be
|
||||||
|
logged to the console and
|
||||||
|
**the unsafe package will not be installed to the test environment**.
|
||||||
|
|
||||||
As of [Poetry-1.1.4](https://github.com/python-poetry/poetry/releases/tag/1.1.4) there
|
This list can be found in the Poetry source code
|
||||||
are four packages classified as "unsafe" by Poetry and excluded from the lockfile:
|
[here](https://github.com/python-poetry/poetry/blob/master/poetry/puzzle/provider.py). As
|
||||||
|
of [Poetry 1.1.6](https://github.com/python-poetry/poetry/releases/tag/1.1.6) there are
|
||||||
|
four packages classified as "unsafe" by Poetry and excluded from the lockfile:
|
||||||
|
|
||||||
* `setuptools`
|
- `setuptools`
|
||||||
* `distribute`
|
- `distribute`
|
||||||
* `pip`
|
- `pip`
|
||||||
* `wheel`
|
- `wheel`
|
||||||
|
|
||||||
When one of these packages is encountered by the plugin a warning will be logged and
|
#### Using with an unmanaged Poetry installation
|
||||||
_**the package will not be installed to the environment**_. If the unsafe package
|
|
||||||
is required for the environment then it will need to be specified as an unlocked
|
|
||||||
dependency using the [`deps`](https://tox.readthedocs.io/en/latest/config.html#conf-deps)
|
|
||||||
configuration option in `tox.ini`, ideally with an exact pinned version.
|
|
||||||
|
|
||||||
* The set of packages excluded from the Poetry lockfile can be found in
|
In CI/CD systems, automation environments, or other Python environments where the loaded
|
||||||
[`poetry.puzzle.provider.Provider.UNSAFE_DEPENDENCIES`](https://github.com/python-poetry/poetry/blob/master/poetry/puzzle/provider.py)
|
site packages are not managed by Poetry, it can be useful to manage the local installation
|
||||||
* There is an ongoing discussion of Poetry's handling of these packages at
|
of Poetry externally. This also helps to avoid problems that can be caused by the
|
||||||
[python-poetry/poetry#1584](https://github.com/python-poetry/poetry/issues/1584)
|
`--no-root`, `--no-dev`, or `--remove-untracked` arguments to the `poetry install` command
|
||||||
|
which, in some situations, can cause Poetry to uninstall itself if Poetry is specified as
|
||||||
|
a dependency of one of the packages it is managing (like this plugin). To support these
|
||||||
|
use cases, this plugin specifies the `poetry` package as an optional dependency that can
|
||||||
|
be installed using a setuptools extra also named `poetry`.
|
||||||
|
|
||||||
#### Installing alongside an existing Poetry installation
|
**Critical Warning: This plugin requires Poetry to function. If the plugin is installed without the `poetry` setuptools extra then Poetry must be installed independently for the plugin to function properly.**
|
||||||
|
|
||||||
The plugin specifies the `poetry` package as an optional dependency to support an
|
To skip installing the `poetry` package as a dependency of `tox-poetry-installer`, do not
|
||||||
externally managed Poetry installation such as in a container or CI environment. This
|
specify the `poetry` extra when adding the plugin:
|
||||||
gives greater flexibility when using Poetry arguments like `--no-root`, `--no-dev`, or
|
|
||||||
`--remove-untracked` which can cause Poetry to uninstall itself if Poetry is specified
|
|
||||||
as a dependency of one of the packages it is managing (like this plugin).
|
|
||||||
|
|
||||||
To have the plugin use the externally-managed Poetry package simply do not install the
|
|
||||||
`poetry` extra when installing this plugin:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Installing Poetry as a dependency with the plugin
|
# Adding the package without the "[poetry]" extra specifier so that
|
||||||
poetry add tox-poetry-installer[poetry]
|
# Poetry is not added as a transient dev-dependency:
|
||||||
|
poetry add tox-poetry-installer --dev
|
||||||
|
|
||||||
# Relying on an externally managed Poetry installation
|
# Adding the package with the "[poetry]" extra specifier, so the Poetry
|
||||||
poetry add tox-poetry-installer
|
# package will be added to the environment and tracked in the lockfile:
|
||||||
|
poetry add tox-poetry-installer[poetry] --dev
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that Poetry is an optional dependency to support this use case _only_: Poetry must
|
Once the plugin is installed- either with or without the Poetry extra- you can validate
|
||||||
be installed to the same environment as Tox for the plugin to function. To check that
|
that the plugin will run correctly with the following command. This command checks that
|
||||||
the local environment has all of the required modules in scope run the below command:
|
all three required components (Tox, Poetry, and the plugin itself) are available in the
|
||||||
|
current Python environment:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python -c '\
|
python -c '\
|
||||||
@@ -471,16 +330,34 @@ python -c '\
|
|||||||
'
|
'
|
||||||
```
|
```
|
||||||
|
|
||||||
**NOTE:** To force Tox to fail if Poetry is not installed, run the `tox` command with
|
> **Note:** To force Tox to fail if Poetry is not installed, add the `require_poetry = true`
|
||||||
the [`--require-poetry`](#--require-poetry) option.
|
> option to the tox `[testenv]` configuration. See the
|
||||||
|
> [Config Options](#configuration-options) for more information.
|
||||||
|
|
||||||
|
## Developer Documentation
|
||||||
|
|
||||||
## Developing
|
All project contributors and participants are expected to adhere to the
|
||||||
|
[Contributor Covenant Code of Conduct, v2](CODE_OF_CONDUCT.md) ([external link](https://www.contributor-covenant.org/version/2/0/code_of_conduct/)).
|
||||||
|
|
||||||
This project requires Poetry version 1.0+ on the development workstation, see
|
The `devel` branch has the latest (and potentially unstable) changes. The stable releases
|
||||||
the [installation instructions here](https://python-poetry.org/docs/#installation).
|
are tracked on [Github](https://github.com/enpaul/tox-poetry-installer/releases),
|
||||||
|
[PyPi](https://pypi.org/project/tox-poetry-installer/#history), and in the
|
||||||
|
[Changelog](CHANGELOG.md).
|
||||||
|
|
||||||
Local environment setup instructions:
|
- To report a bug, request a feature, or ask for assistance, please
|
||||||
|
[open an issue on the Github repository](https://github.com/enpaul/tox-poetry-installer/issues/new).
|
||||||
|
- To report a security concern or code of conduct violation, please contact the project
|
||||||
|
author directly at **me \[at\] enp dot one**.
|
||||||
|
- To submit an update, please
|
||||||
|
[fork the repository](https://docs.github.com/en/enterprise/2.20/user/github/getting-started-with-github/fork-a-repo)
|
||||||
|
and [open a pull request](https://github.com/enpaul/tox-poetry-installer/compare).
|
||||||
|
|
||||||
|
Developing this project requires [Python 3.7+](https://www.python.org/downloads/) and
|
||||||
|
[Poetry 1.0](https://python-poetry.org/docs/#installation) or later. GNU Make can
|
||||||
|
optionally be used to quickly setup a local development environment, but this is not
|
||||||
|
required.
|
||||||
|
|
||||||
|
To setup a local development environment:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Clone the repository...
|
# Clone the repository...
|
||||||
@@ -489,80 +366,66 @@ git clone https://github.com/enpaul/tox-poetry-installer.git
|
|||||||
# ...over SSH
|
# ...over SSH
|
||||||
git clone git@github.com:enpaul/tox-poetry-installer.git
|
git clone git@github.com:enpaul/tox-poetry-installer.git
|
||||||
|
|
||||||
# Create a the local project virtual environment and install dependencies
|
cd tox-poetry-installer/
|
||||||
cd tox-poetry-installer
|
|
||||||
poetry install -E poetry
|
|
||||||
|
|
||||||
# Install pre-commit hooks
|
# Create and configure the local development environment...
|
||||||
|
# ...with make:
|
||||||
|
make dev
|
||||||
|
# ...manually:
|
||||||
|
poetry install -E poetry --remove-untracked
|
||||||
poetry run pre-commit install
|
poetry run pre-commit install
|
||||||
|
|
||||||
# Run tests and static analysis
|
# Run tests and CI locally...
|
||||||
poetry run tox
|
# ...with make:
|
||||||
|
make test
|
||||||
|
# ...manually:
|
||||||
|
poetry run tox --recreate
|
||||||
|
|
||||||
|
# See additional make targets
|
||||||
|
make help
|
||||||
```
|
```
|
||||||
|
|
||||||
**NOTE:** Because the pre-commit hooks require dependencies in the Poetry environment it
|
> **Note:** The pre-commit hooks require dependencies in the Poetry environment to run. To
|
||||||
is recommend to [launch an environment shell](https://python-poetry.org/docs/cli/#shell)
|
> make a commit with the pre-commit hooks, you will need to run `poetry run git commit` or,
|
||||||
when developing the project. Alternatively, many `git` commands will need to be run from
|
> alternatively, [launch an environment shell](https://python-poetry.org/docs/cli/#shell).
|
||||||
outside of the environment shell by prefacing the command with
|
|
||||||
[`poetry run`](https://python-poetry.org/docs/cli/#run).
|
|
||||||
|
|
||||||
|
## Road Map
|
||||||
## Contributing
|
|
||||||
|
|
||||||
All project contributors and participants are expected to adhere to the
|
|
||||||
[Contributor Covenant Code of Conduct, v2](CODE_OF_CONDUCT.md)
|
|
||||||
([external link](https://www.contributor-covenant.org/version/2/0/code_of_conduct/)).
|
|
||||||
|
|
||||||
The `devel` branch has the latest (potentially unstable) changes. The
|
|
||||||
[tagged versions](https://github.com/enpaul/tox-poetry-installer/releases) correspond to the
|
|
||||||
releases on PyPI.
|
|
||||||
|
|
||||||
* To report a bug, request a feature, or ask for assistance, please
|
|
||||||
[open an issue on the Github repository](https://github.com/enpaul/tox-poetry-installer/issues/new).
|
|
||||||
* To report a security concern or code of conduct violation, please contact the project author
|
|
||||||
directly at **me [at] enp dot one**.
|
|
||||||
* To submit an update, please
|
|
||||||
[fork the repository](https://docs.github.com/en/enterprise/2.20/user/github/getting-started-with-github/fork-a-repo)
|
|
||||||
and
|
|
||||||
[open a pull request](https://github.com/enpaul/tox-poetry-installer/compare).
|
|
||||||
|
|
||||||
|
|
||||||
## Roadmap
|
|
||||||
|
|
||||||
This project is under active development and is classified as beta software, ready for
|
This project is under active development and is classified as beta software, ready for
|
||||||
production environments on a provisional basis only.
|
production environments on a provisional basis only.
|
||||||
|
|
||||||
* Beta classification was assigned with [v0.6.0](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.6.0)
|
- Beta classification was assigned with
|
||||||
* Stable classification will be assigned when the test suite covers an acceptable number of
|
[v0.6.0](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.6.0)
|
||||||
|
- Stable classification will be assigned when the test suite covers an acceptable number of
|
||||||
use cases
|
use cases
|
||||||
|
|
||||||
### Path to Beta
|
### Path to Beta
|
||||||
|
|
||||||
- [X] Verify that primary package dependencies (from the `.package` env) are installed
|
- [x] Verify that primary package dependencies (from the `.package` env) are installed
|
||||||
correctly using the Poetry backend.
|
correctly using the Poetry backend.
|
||||||
- [X] Support the [`extras`](https://tox.readthedocs.io/en/latest/config.html#conf-extras)
|
- [x] Support the [`extras`](https://tox.readthedocs.io/en/latest/config.html#conf-extras) Tox
|
||||||
Tox configuration option ([#4](https://github.com/enpaul/tox-poetry-installer/issues/4))
|
configuration option ([#4](https://github.com/enpaul/tox-poetry-installer/issues/4))
|
||||||
- [X] Add per-environment Tox configuration option to fall back to default installation
|
- [x] Add per-environment Tox configuration option to fall back to default installation
|
||||||
backend.
|
backend.
|
||||||
- [ ] ~Add warnings when an unsupported Tox configuration option is detected while using the
|
- [ ] ~Add warnings when an unsupported Tox configuration option is detected while using the
|
||||||
Poetry backend. ([#5](https://github.com/enpaul/tox-poetry-installer/issues/5))~
|
Poetry backend.~ ([#5](https://github.com/enpaul/tox-poetry-installer/issues/5))
|
||||||
- [X] Add trivial tests to ensure the project metadata is consistent between the pyproject.toml
|
- [x] Add trivial tests to ensure the project metadata is consistent between the pyproject.toml
|
||||||
and the module constants.
|
and the module constants.
|
||||||
- [X] Update to use [poetry-core](https://github.com/python-poetry/poetry-core) and
|
- [x] Update to use [poetry-core](https://github.com/python-poetry/poetry-core) and improve
|
||||||
improve robustness of the Tox and Poetry module imports
|
robustness of the Tox and Poetry module imports to avoid potentially breaking API changes
|
||||||
to avoid potentially breaking API changes in upstream packages. ([#2](https://github.com/enpaul/tox-poetry-installer/issues/2))
|
in upstream packages. ([#2](https://github.com/enpaul/tox-poetry-installer/issues/2))
|
||||||
- [ ] ~Find and implement a way to mitigate the [UNSAFE_DEPENDENCIES issue](https://github.com/python-poetry/poetry/issues/1584) in Poetry.
|
- [ ] ~Find and implement a way to mitigate the
|
||||||
([#6](https://github.com/enpaul/tox-poetry-installer/issues/6))~
|
[UNSAFE_DEPENDENCIES issue](https://github.com/python-poetry/poetry/issues/1584) in
|
||||||
- [X] Fix logging to make proper use of Tox's logging reporter infrastructure ([#3](https://github.com/enpaul/tox-poetry-installer/issues/3))
|
Poetry.~ ([#6](https://github.com/enpaul/tox-poetry-installer/issues/6))
|
||||||
- [X] Add configuration option for installing all dev-dependencies to a testenv ([#14](https://github.com/enpaul/tox-poetry-installer/issues/14))
|
- [x] Fix logging to make proper use of Tox's logging reporter infrastructure ([#3](https://github.com/enpaul/tox-poetry-installer/issues/3))
|
||||||
|
- [x] Add configuration option for installing all dev-dependencies to a testenv ([#14](https://github.com/enpaul/tox-poetry-installer/issues/14))
|
||||||
|
|
||||||
### Path to Stable
|
### Path to Stable
|
||||||
|
|
||||||
Everything in Beta plus...
|
Everything in Beta plus...
|
||||||
|
|
||||||
- [ ] Add comprehensive unit tests
|
- [ ] Fully replace dependency on `poetry` with dependency on `poetry-core` ([#2](https://github.com/enpaul/tox-poetry-installer/issues/2))
|
||||||
- [ ] Add tests for each feature version of Tox between 3.0 and 3.20
|
- [x] Add comprehensive unit tests
|
||||||
- [ ] Add tests for Python-3.6, 3.7, 3.8, and 3.9
|
- [ ] ~Add tests for each feature version of Tox between 3.8 and 3.20~
|
||||||
- [X] Add Github Actions based CI
|
- [x] Add tests for Python-3.6, 3.7, 3.8, and 3.9
|
||||||
- [ ] Add CI for CPython, PyPy, and Conda
|
- [x] Add Github Actions based CI
|
||||||
- [ ] Add CI for Linux and Windows
|
|
||||||
|
|||||||
1391
poetry.lock
generated
1391
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,9 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "tox-poetry-installer"
|
name = "tox-poetry-installer"
|
||||||
version = "0.6.1"
|
version = "0.8.3"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
authors = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"]
|
authors = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"]
|
||||||
description = "Tox plugin to install Tox environment dependencies using the Poetry backend and lockfile"
|
description = "A plugin for Tox that lets you install test environment dependencies from the Poetry lockfile"
|
||||||
repository = "https://github.com/enpaul/tox-poetry-installer/"
|
repository = "https://github.com/enpaul/tox-poetry-installer/"
|
||||||
packages = [
|
packages = [
|
||||||
{include = "tox_poetry_installer"},
|
{include = "tox_poetry_installer"},
|
||||||
@@ -22,10 +22,12 @@ classifiers = [
|
|||||||
"License :: OSI Approved :: MIT License",
|
"License :: OSI Approved :: MIT License",
|
||||||
"Natural Language :: English",
|
"Natural Language :: English",
|
||||||
"Operating System :: OS Independent",
|
"Operating System :: OS Independent",
|
||||||
|
"Programming Language :: Python :: 3",
|
||||||
"Programming Language :: Python :: 3.6",
|
"Programming Language :: Python :: 3.6",
|
||||||
"Programming Language :: Python :: 3.7",
|
"Programming Language :: Python :: 3.7",
|
||||||
"Programming Language :: Python :: 3.8",
|
"Programming Language :: Python :: 3.8",
|
||||||
"Programming Language :: Python :: 3.9",
|
"Programming Language :: Python :: 3.9",
|
||||||
|
"Programming Language :: Python :: 3.10",
|
||||||
"Programming Language :: Python :: Implementation :: CPython",
|
"Programming Language :: Python :: Implementation :: CPython",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -39,14 +41,16 @@ poetry = ["poetry"]
|
|||||||
python = "^3.6.1"
|
python = "^3.6.1"
|
||||||
poetry = {version = "^1.0.0", optional = true}
|
poetry = {version = "^1.0.0", optional = true}
|
||||||
poetry-core = "^1.0.0"
|
poetry-core = "^1.0.0"
|
||||||
tox = "^3.0.0"
|
tox = "^3.8.0"
|
||||||
|
|
||||||
[tool.poetry.dev-dependencies]
|
[tool.poetry.dev-dependencies]
|
||||||
bandit = "^1.6.2"
|
bandit = "^1.6.2"
|
||||||
black = { version = "^20.8b1", allow-prereleases = true }
|
black = {version = "^21.12b0", allow-prereleases = true, python = "^3.7"}
|
||||||
blacken-docs = "^1.8.0"
|
blacken-docs = "^1.8.0"
|
||||||
ipython = { version = "^7.18.1", python = "^3.7" }
|
ipython = { version = "^7.18.1", python = "^3.7" }
|
||||||
mypy = "^0.782"
|
mdformat = "^0.6"
|
||||||
|
mdformat-gfm = "^0.2"
|
||||||
|
mypy = "^0.930"
|
||||||
pre-commit = "^2.7.1"
|
pre-commit = "^2.7.1"
|
||||||
pre-commit-hooks = "^3.3.0"
|
pre-commit-hooks = "^3.3.0"
|
||||||
pylint = "^2.4.4"
|
pylint = "^2.4.4"
|
||||||
@@ -56,6 +60,7 @@ reorder-python-imports = "^2.3.5"
|
|||||||
safety = "^1.9.0"
|
safety = "^1.9.0"
|
||||||
toml = "^0.10.1"
|
toml = "^0.10.1"
|
||||||
tox = "^3.20.0"
|
tox = "^3.20.0"
|
||||||
|
types-toml = "^0.10.1"
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core>=1.0.0"]
|
requires = ["poetry-core>=1.0.0"]
|
||||||
|
|||||||
63
tests/fixtures.py
Normal file
63
tests/fixtures.py
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
# pylint: disable=missing-module-docstring, missing-function-docstring, unused-argument, too-few-public-methods
|
||||||
|
import time
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import poetry.factory
|
||||||
|
import poetry.installation.pip_installer
|
||||||
|
import poetry.utils.env
|
||||||
|
import pytest
|
||||||
|
import tox
|
||||||
|
from poetry.core.packages import Package as PoetryPackage
|
||||||
|
|
||||||
|
from tox_poetry_installer import utilities
|
||||||
|
|
||||||
|
|
||||||
|
TEST_PROJECT_PATH = Path(__file__).parent.resolve() / "test-project"
|
||||||
|
|
||||||
|
FAKE_VENV_PATH = Path("nowhere")
|
||||||
|
|
||||||
|
|
||||||
|
class MockVirtualEnv:
|
||||||
|
"""Mock class for the :class:`poetry.utils.env.VirtualEnv` and :class:`tox.venv.VirtualEnv`"""
|
||||||
|
|
||||||
|
class MockTestenvConfig: # pylint: disable=missing-class-docstring
|
||||||
|
envdir = FAKE_VENV_PATH
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
self.envconfig = self.MockTestenvConfig()
|
||||||
|
self.installed = []
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def is_valid_for_marker(*args, **kwargs):
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
class MockPipInstaller:
|
||||||
|
"""Mock class for the :class:`poetry.installation.pip_installer.PipInstaller`"""
|
||||||
|
|
||||||
|
def __init__(self, env: MockVirtualEnv, **kwargs):
|
||||||
|
self.env = env
|
||||||
|
|
||||||
|
def install(self, package: PoetryPackage):
|
||||||
|
self.env.installed.append(package)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def mock_venv(monkeypatch):
|
||||||
|
monkeypatch.setattr(utilities, "convert_virtualenv", lambda venv: venv)
|
||||||
|
monkeypatch.setattr(
|
||||||
|
poetry.installation.pip_installer, "PipInstaller", MockPipInstaller
|
||||||
|
)
|
||||||
|
monkeypatch.setattr(tox.venv, "VirtualEnv", MockVirtualEnv)
|
||||||
|
monkeypatch.setattr(poetry.utils.env, "VirtualEnv", MockVirtualEnv)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(scope="function")
|
||||||
|
def mock_poetry_factory(monkeypatch):
|
||||||
|
pypoetry = poetry.factory.Factory().create_poetry(cwd=TEST_PROJECT_PATH)
|
||||||
|
|
||||||
|
def mock_factory(*args, **kwargs):
|
||||||
|
return pypoetry
|
||||||
|
|
||||||
|
monkeypatch.setattr(poetry.factory.Factory, "create_poetry", mock_factory)
|
||||||
505
tests/test-project/poetry.lock
generated
Normal file
505
tests/test-project/poetry.lock
generated
Normal file
@@ -0,0 +1,505 @@
|
|||||||
|
[[package]]
|
||||||
|
name = "appdirs"
|
||||||
|
version = "1.4.4"
|
||||||
|
description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = "*"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "attrs"
|
||||||
|
version = "20.3.0"
|
||||||
|
description = "Classes Without Boilerplate"
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||||
|
|
||||||
|
[package.extras]
|
||||||
|
dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface", "furo", "sphinx", "pre-commit"]
|
||||||
|
docs = ["furo", "sphinx", "zope.interface"]
|
||||||
|
tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface"]
|
||||||
|
tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six"]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "certifi"
|
||||||
|
version = "2020.12.5"
|
||||||
|
description = "Python package for providing Mozilla's CA Bundle."
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = "*"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "chardet"
|
||||||
|
version = "4.0.0"
|
||||||
|
description = "Universal encoding detector for Python 2 and 3"
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "click"
|
||||||
|
version = "7.1.2"
|
||||||
|
description = "Composable command line interface toolkit"
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "colorama"
|
||||||
|
version = "0.4.4"
|
||||||
|
description = "Cross-platform colored terminal text."
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "distlib"
|
||||||
|
version = "0.3.1"
|
||||||
|
description = "Distribution utilities"
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = "*"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "filelock"
|
||||||
|
version = "3.0.12"
|
||||||
|
description = "A platform independent file lock."
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = "*"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "flask"
|
||||||
|
version = "1.1.2"
|
||||||
|
description = "A simple framework for building complex web applications."
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||||
|
|
||||||
|
[package.dependencies]
|
||||||
|
click = ">=5.1"
|
||||||
|
itsdangerous = ">=0.24"
|
||||||
|
Jinja2 = ">=2.10.1"
|
||||||
|
Werkzeug = ">=0.15"
|
||||||
|
|
||||||
|
[package.extras]
|
||||||
|
dev = ["pytest", "coverage", "tox", "sphinx", "pallets-sphinx-themes", "sphinxcontrib-log-cabinet", "sphinx-issues"]
|
||||||
|
docs = ["sphinx", "pallets-sphinx-themes", "sphinxcontrib-log-cabinet", "sphinx-issues"]
|
||||||
|
dotenv = ["python-dotenv"]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "idna"
|
||||||
|
version = "2.10"
|
||||||
|
description = "Internationalized Domain Names in Applications (IDNA)"
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "importlib-metadata"
|
||||||
|
version = "3.10.1"
|
||||||
|
description = "Read metadata from Python packages"
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=3.6"
|
||||||
|
|
||||||
|
[package.dependencies]
|
||||||
|
typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""}
|
||||||
|
zipp = ">=0.5"
|
||||||
|
|
||||||
|
[package.extras]
|
||||||
|
docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"]
|
||||||
|
testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "packaging", "pep517", "pyfakefs", "flufl.flake8", "pytest-black (>=0.3.7)", "pytest-mypy", "importlib-resources (>=1.3)"]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "importlib-resources"
|
||||||
|
version = "5.1.2"
|
||||||
|
description = "Read resources from Python packages"
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=3.6"
|
||||||
|
|
||||||
|
[package.dependencies]
|
||||||
|
zipp = {version = ">=0.4", markers = "python_version < \"3.8\""}
|
||||||
|
|
||||||
|
[package.extras]
|
||||||
|
docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"]
|
||||||
|
testing = ["pytest (>=4.6)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pytest-cov", "pytest-enabler", "pytest-black (>=0.3.7)", "pytest-mypy"]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "itsdangerous"
|
||||||
|
version = "1.1.0"
|
||||||
|
description = "Various helpers to pass data to untrusted environments and back."
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "jinja2"
|
||||||
|
version = "2.11.3"
|
||||||
|
description = "A very fast and expressive template engine."
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||||
|
|
||||||
|
[package.dependencies]
|
||||||
|
MarkupSafe = ">=0.23"
|
||||||
|
|
||||||
|
[package.extras]
|
||||||
|
i18n = ["Babel (>=0.8)"]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "markupsafe"
|
||||||
|
version = "1.1.1"
|
||||||
|
description = "Safely add untrusted strings to HTML/XML markup."
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "packaging"
|
||||||
|
version = "20.9"
|
||||||
|
description = "Core utilities for Python packages"
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||||
|
|
||||||
|
[package.dependencies]
|
||||||
|
pyparsing = ">=2.0.2"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pluggy"
|
||||||
|
version = "0.13.1"
|
||||||
|
description = "plugin and hook calling mechanisms for python"
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||||
|
|
||||||
|
[package.dependencies]
|
||||||
|
importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""}
|
||||||
|
|
||||||
|
[package.extras]
|
||||||
|
dev = ["pre-commit", "tox"]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "py"
|
||||||
|
version = "1.10.0"
|
||||||
|
description = "library with cross-python path, ini-parsing, io, code, log facilities"
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pyparsing"
|
||||||
|
version = "2.4.7"
|
||||||
|
description = "Python parsing module"
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "python-dateutil"
|
||||||
|
version = "2.8.1"
|
||||||
|
description = "Extensions to the standard Python datetime module"
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7"
|
||||||
|
|
||||||
|
[package.dependencies]
|
||||||
|
six = ">=1.5"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "requests"
|
||||||
|
version = "2.25.1"
|
||||||
|
description = "Python HTTP for Humans."
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||||
|
|
||||||
|
[package.dependencies]
|
||||||
|
certifi = ">=2017.4.17"
|
||||||
|
chardet = ">=3.0.2,<5"
|
||||||
|
idna = ">=2.5,<3"
|
||||||
|
urllib3 = ">=1.21.1,<1.27"
|
||||||
|
|
||||||
|
[package.extras]
|
||||||
|
security = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)"]
|
||||||
|
socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "six"
|
||||||
|
version = "1.15.0"
|
||||||
|
description = "Python 2 and 3 compatibility utilities"
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "toml"
|
||||||
|
version = "0.10.2"
|
||||||
|
description = "Python Library for Tom's Obvious, Minimal Language"
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tox"
|
||||||
|
version = "3.23.0"
|
||||||
|
description = "tox is a generic virtualenv management and test command line tool"
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7"
|
||||||
|
|
||||||
|
[package.dependencies]
|
||||||
|
colorama = {version = ">=0.4.1", markers = "platform_system == \"Windows\""}
|
||||||
|
filelock = ">=3.0.0"
|
||||||
|
importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""}
|
||||||
|
packaging = ">=14"
|
||||||
|
pluggy = ">=0.12.0"
|
||||||
|
py = ">=1.4.17"
|
||||||
|
six = ">=1.14.0"
|
||||||
|
toml = ">=0.9.4"
|
||||||
|
virtualenv = ">=16.0.0,<20.0.0 || >20.0.0,<20.0.1 || >20.0.1,<20.0.2 || >20.0.2,<20.0.3 || >20.0.3,<20.0.4 || >20.0.4,<20.0.5 || >20.0.5,<20.0.6 || >20.0.6,<20.0.7 || >20.0.7"
|
||||||
|
|
||||||
|
[package.extras]
|
||||||
|
docs = ["pygments-github-lexers (>=0.0.5)", "sphinx (>=2.0.0)", "sphinxcontrib-autoprogram (>=0.1.5)", "towncrier (>=18.5.0)"]
|
||||||
|
testing = ["flaky (>=3.4.0)", "freezegun (>=0.3.11)", "psutil (>=5.6.1)", "pytest (>=4.0.0)", "pytest-cov (>=2.5.1)", "pytest-mock (>=1.10.0)", "pytest-randomly (>=1.0.0)", "pytest-xdist (>=1.22.2)", "pathlib2 (>=2.3.3)"]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "typing-extensions"
|
||||||
|
version = "3.7.4.3"
|
||||||
|
description = "Backported and Experimental Type Hints for Python 3.5+"
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = "*"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "urllib3"
|
||||||
|
version = "1.26.4"
|
||||||
|
description = "HTTP library with thread-safe connection pooling, file post, and more."
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4"
|
||||||
|
|
||||||
|
[package.extras]
|
||||||
|
secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"]
|
||||||
|
socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"]
|
||||||
|
brotli = ["brotlipy (>=0.6.0)"]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "virtualenv"
|
||||||
|
version = "20.4.3"
|
||||||
|
description = "Virtual Python Environment builder"
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7"
|
||||||
|
|
||||||
|
[package.dependencies]
|
||||||
|
appdirs = ">=1.4.3,<2"
|
||||||
|
distlib = ">=0.3.1,<1"
|
||||||
|
filelock = ">=3.0.0,<4"
|
||||||
|
importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""}
|
||||||
|
importlib-resources = {version = ">=1.0", markers = "python_version < \"3.7\""}
|
||||||
|
six = ">=1.9.0,<2"
|
||||||
|
|
||||||
|
[package.extras]
|
||||||
|
docs = ["proselint (>=0.10.2)", "sphinx (>=3)", "sphinx-argparse (>=0.2.5)", "sphinx-rtd-theme (>=0.4.3)", "towncrier (>=19.9.0rc1)"]
|
||||||
|
testing = ["coverage (>=4)", "coverage-enable-subprocess (>=1)", "flaky (>=3)", "pytest (>=4)", "pytest-env (>=0.6.2)", "pytest-freezegun (>=0.4.1)", "pytest-mock (>=2)", "pytest-randomly (>=1)", "pytest-timeout (>=1)", "packaging (>=20.0)", "xonsh (>=0.9.16)"]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "werkzeug"
|
||||||
|
version = "1.0.1"
|
||||||
|
description = "The comprehensive WSGI web application library."
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||||
|
|
||||||
|
[package.extras]
|
||||||
|
dev = ["pytest", "pytest-timeout", "coverage", "tox", "sphinx", "pallets-sphinx-themes", "sphinx-issues"]
|
||||||
|
watchdog = ["watchdog"]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zipp"
|
||||||
|
version = "3.4.1"
|
||||||
|
description = "Backport of pathlib-compatible object wrapper for zip files"
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=3.6"
|
||||||
|
|
||||||
|
[package.extras]
|
||||||
|
docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"]
|
||||||
|
testing = ["pytest (>=4.6)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pytest-cov", "pytest-enabler", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy"]
|
||||||
|
|
||||||
|
[metadata]
|
||||||
|
lock-version = "1.1"
|
||||||
|
python-versions = "^3.6.1"
|
||||||
|
content-hash = "af9db950cd722e7dc52b691fb58abc1e22ab48b34ddfe4c5258b3c755a3892fa"
|
||||||
|
|
||||||
|
[metadata.files]
|
||||||
|
appdirs = [
|
||||||
|
{file = "appdirs-1.4.4-py2.py3-none-any.whl", hash = "sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"},
|
||||||
|
{file = "appdirs-1.4.4.tar.gz", hash = "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41"},
|
||||||
|
]
|
||||||
|
attrs = [
|
||||||
|
{file = "attrs-20.3.0-py2.py3-none-any.whl", hash = "sha256:31b2eced602aa8423c2aea9c76a724617ed67cf9513173fd3a4f03e3a929c7e6"},
|
||||||
|
{file = "attrs-20.3.0.tar.gz", hash = "sha256:832aa3cde19744e49938b91fea06d69ecb9e649c93ba974535d08ad92164f700"},
|
||||||
|
]
|
||||||
|
certifi = [
|
||||||
|
{file = "certifi-2020.12.5-py2.py3-none-any.whl", hash = "sha256:719a74fb9e33b9bd44cc7f3a8d94bc35e4049deebe19ba7d8e108280cfd59830"},
|
||||||
|
{file = "certifi-2020.12.5.tar.gz", hash = "sha256:1a4995114262bffbc2413b159f2a1a480c969de6e6eb13ee966d470af86af59c"},
|
||||||
|
]
|
||||||
|
chardet = [
|
||||||
|
{file = "chardet-4.0.0-py2.py3-none-any.whl", hash = "sha256:f864054d66fd9118f2e67044ac8981a54775ec5b67aed0441892edb553d21da5"},
|
||||||
|
{file = "chardet-4.0.0.tar.gz", hash = "sha256:0d6f53a15db4120f2b08c94f11e7d93d2c911ee118b6b30a04ec3ee8310179fa"},
|
||||||
|
]
|
||||||
|
click = [
|
||||||
|
{file = "click-7.1.2-py2.py3-none-any.whl", hash = "sha256:dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc"},
|
||||||
|
{file = "click-7.1.2.tar.gz", hash = "sha256:d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a"},
|
||||||
|
]
|
||||||
|
colorama = [
|
||||||
|
{file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"},
|
||||||
|
{file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"},
|
||||||
|
]
|
||||||
|
distlib = [
|
||||||
|
{file = "distlib-0.3.1-py2.py3-none-any.whl", hash = "sha256:8c09de2c67b3e7deef7184574fc060ab8a793e7adbb183d942c389c8b13c52fb"},
|
||||||
|
{file = "distlib-0.3.1.zip", hash = "sha256:edf6116872c863e1aa9d5bb7cb5e05a022c519a4594dc703843343a9ddd9bff1"},
|
||||||
|
]
|
||||||
|
filelock = [
|
||||||
|
{file = "filelock-3.0.12-py3-none-any.whl", hash = "sha256:929b7d63ec5b7d6b71b0fa5ac14e030b3f70b75747cef1b10da9b879fef15836"},
|
||||||
|
{file = "filelock-3.0.12.tar.gz", hash = "sha256:18d82244ee114f543149c66a6e0c14e9c4f8a1044b5cdaadd0f82159d6a6ff59"},
|
||||||
|
]
|
||||||
|
flask = [
|
||||||
|
{file = "Flask-1.1.2-py2.py3-none-any.whl", hash = "sha256:8a4fdd8936eba2512e9c85df320a37e694c93945b33ef33c89946a340a238557"},
|
||||||
|
{file = "Flask-1.1.2.tar.gz", hash = "sha256:4efa1ae2d7c9865af48986de8aeb8504bf32c7f3d6fdc9353d34b21f4b127060"},
|
||||||
|
]
|
||||||
|
idna = [
|
||||||
|
{file = "idna-2.10-py2.py3-none-any.whl", hash = "sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"},
|
||||||
|
{file = "idna-2.10.tar.gz", hash = "sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6"},
|
||||||
|
]
|
||||||
|
importlib-metadata = [
|
||||||
|
{file = "importlib_metadata-3.10.1-py3-none-any.whl", hash = "sha256:2ec0faae539743ae6aaa84b49a169670a465f7f5d64e6add98388cc29fd1f2f6"},
|
||||||
|
{file = "importlib_metadata-3.10.1.tar.gz", hash = "sha256:c9356b657de65c53744046fa8f7358afe0714a1af7d570c00c3835c2d724a7c1"},
|
||||||
|
]
|
||||||
|
importlib-resources = [
|
||||||
|
{file = "importlib_resources-5.1.2-py3-none-any.whl", hash = "sha256:ebab3efe74d83b04d6bf5cd9a17f0c5c93e60fb60f30c90f56265fce4682a469"},
|
||||||
|
{file = "importlib_resources-5.1.2.tar.gz", hash = "sha256:642586fc4740bd1cad7690f836b3321309402b20b332529f25617ff18e8e1370"},
|
||||||
|
]
|
||||||
|
itsdangerous = [
|
||||||
|
{file = "itsdangerous-1.1.0-py2.py3-none-any.whl", hash = "sha256:b12271b2047cb23eeb98c8b5622e2e5c5e9abd9784a153e9d8ef9cb4dd09d749"},
|
||||||
|
{file = "itsdangerous-1.1.0.tar.gz", hash = "sha256:321b033d07f2a4136d3ec762eac9f16a10ccd60f53c0c91af90217ace7ba1f19"},
|
||||||
|
]
|
||||||
|
jinja2 = [
|
||||||
|
{file = "Jinja2-2.11.3-py2.py3-none-any.whl", hash = "sha256:03e47ad063331dd6a3f04a43eddca8a966a26ba0c5b7207a9a9e4e08f1b29419"},
|
||||||
|
{file = "Jinja2-2.11.3.tar.gz", hash = "sha256:a6d58433de0ae800347cab1fa3043cebbabe8baa9d29e668f1c768cb87a333c6"},
|
||||||
|
]
|
||||||
|
markupsafe = [
|
||||||
|
{file = "MarkupSafe-1.1.1-cp27-cp27m-macosx_10_6_intel.whl", hash = "sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:500d4957e52ddc3351cabf489e79c91c17f6e0899158447047588650b5e69183"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp27-cp27m-win32.whl", hash = "sha256:b2051432115498d3562c084a49bba65d97cf251f5a331c64a12ee7e04dacc51b"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp27-cp27m-win_amd64.whl", hash = "sha256:98c7086708b163d425c67c7a91bad6e466bb99d797aa64f965e9d25c12111a5e"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:43a55c2930bbc139570ac2452adf3d70cdbb3cfe5912c71cdce1c2c6bbd9c5d1"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp34-cp34m-macosx_10_6_intel.whl", hash = "sha256:1027c282dad077d0bae18be6794e6b6b8c91d58ed8a8d89a89d59693b9131db5"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp34-cp34m-manylinux1_i686.whl", hash = "sha256:62fe6c95e3ec8a7fad637b7f3d372c15ec1caa01ab47926cfdf7a75b40e0eac1"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp34-cp34m-manylinux1_x86_64.whl", hash = "sha256:88e5fcfb52ee7b911e8bb6d6aa2fd21fbecc674eadd44118a9cc3863f938e735"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp34-cp34m-win32.whl", hash = "sha256:ade5e387d2ad0d7ebf59146cc00c8044acbd863725f887353a10df825fc8ae21"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp34-cp34m-win_amd64.whl", hash = "sha256:09c4b7f37d6c648cb13f9230d847adf22f8171b1ccc4d5682398e77f40309235"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp35-cp35m-macosx_10_6_intel.whl", hash = "sha256:79855e1c5b8da654cf486b830bd42c06e8780cea587384cf6545b7d9ac013a0b"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:c8716a48d94b06bb3b2524c2b77e055fb313aeb4ea620c8dd03a105574ba704f"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:7c1699dfe0cf8ff607dbdcc1e9b9af1755371f92a68f706051cc8c37d447c905"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp35-cp35m-win32.whl", hash = "sha256:6dd73240d2af64df90aa7c4e7481e23825ea70af4b4922f8ede5b9e35f78a3b1"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp35-cp35m-win_amd64.whl", hash = "sha256:9add70b36c5666a2ed02b43b335fe19002ee5235efd4b8a89bfcf9005bebac0d"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp36-cp36m-macosx_10_6_intel.whl", hash = "sha256:24982cc2533820871eba85ba648cd53d8623687ff11cbb805be4ff7b4c971aff"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:d53bc011414228441014aa71dbec320c66468c1030aae3a6e29778a3382d96e5"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:717ba8fe3ae9cc0006d7c451f0bb265ee07739daf76355d06366154ee68d221e"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:3b8a6499709d29c2e2399569d96719a1b21dcd94410a586a18526b143ec8470f"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:84dee80c15f1b560d55bcfe6d47b27d070b4681c699c572af2e3c7cc90a3b8e0"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:b1dba4527182c95a0db8b6060cc98ac49b9e2f5e64320e2b56e47cb2831978c7"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp36-cp36m-win32.whl", hash = "sha256:535f6fc4d397c1563d08b88e485c3496cf5784e927af890fb3c3aac7f933ec66"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp36-cp36m-win_amd64.whl", hash = "sha256:b1282f8c00509d99fef04d8ba936b156d419be841854fe901d8ae224c59f0be5"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp37-cp37m-macosx_10_6_intel.whl", hash = "sha256:8defac2f2ccd6805ebf65f5eeb132adcf2ab57aa11fdf4c0dd5169a004710e7d"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:bf5aa3cbcfdf57fa2ee9cd1822c862ef23037f5c832ad09cfea57fa846dec193"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:46c99d2de99945ec5cb54f23c8cd5689f6d7177305ebff350a58ce5f8de1669e"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:ba59edeaa2fc6114428f1637ffff42da1e311e29382d81b339c1817d37ec93c6"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:6fffc775d90dcc9aed1b89219549b329a9250d918fd0b8fa8d93d154918422e1"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:a6a744282b7718a2a62d2ed9d993cad6f5f585605ad352c11de459f4108df0a1"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:195d7d2c4fbb0ee8139a6cf67194f3973a6b3042d742ebe0a9ed36d8b6f0c07f"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp37-cp37m-win32.whl", hash = "sha256:b00c1de48212e4cc9603895652c5c410df699856a2853135b3967591e4beebc2"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp37-cp37m-win_amd64.whl", hash = "sha256:9bf40443012702a1d2070043cb6291650a0841ece432556f784f004937f0f32c"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:6788b695d50a51edb699cb55e35487e430fa21f1ed838122d722e0ff0ac5ba15"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:cdb132fc825c38e1aeec2c8aa9338310d29d337bebbd7baa06889d09a60a1fa2"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:13d3144e1e340870b25e7b10b98d779608c02016d5184cfb9927a9f10c689f42"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:acf08ac40292838b3cbbb06cfe9b2cb9ec78fce8baca31ddb87aaac2e2dc3bc2"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:d9be0ba6c527163cbed5e0857c451fcd092ce83947944d6c14bc95441203f032"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:caabedc8323f1e93231b52fc32bdcde6db817623d33e100708d9a68e1f53b26b"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp38-cp38-win32.whl", hash = "sha256:596510de112c685489095da617b5bcbbac7dd6384aeebeda4df6025d0256a81b"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp38-cp38-win_amd64.whl", hash = "sha256:e8313f01ba26fbbe36c7be1966a7b7424942f670f38e666995b88d012765b9be"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:d73a845f227b0bfe8a7455ee623525ee656a9e2e749e4742706d80a6065d5e2c"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp39-cp39-manylinux1_i686.whl", hash = "sha256:98bae9582248d6cf62321dcb52aaf5d9adf0bad3b40582925ef7c7f0ed85fceb"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:2beec1e0de6924ea551859edb9e7679da6e4870d32cb766240ce17e0a0ba2014"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:7fed13866cf14bba33e7176717346713881f56d9d2bcebab207f7a036f41b850"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:6f1e273a344928347c1290119b493a1f0303c52f5a5eae5f16d74f48c15d4a85"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:feb7b34d6325451ef96bc0e36e1a6c0c1c64bc1fbec4b854f4529e51887b1621"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp39-cp39-win32.whl", hash = "sha256:22c178a091fc6630d0d045bdb5992d2dfe14e3259760e713c490da5323866c39"},
|
||||||
|
{file = "MarkupSafe-1.1.1-cp39-cp39-win_amd64.whl", hash = "sha256:b7d644ddb4dbd407d31ffb699f1d140bc35478da613b441c582aeb7c43838dd8"},
|
||||||
|
{file = "MarkupSafe-1.1.1.tar.gz", hash = "sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b"},
|
||||||
|
]
|
||||||
|
packaging = [
|
||||||
|
{file = "packaging-20.9-py2.py3-none-any.whl", hash = "sha256:67714da7f7bc052e064859c05c595155bd1ee9f69f76557e21f051443c20947a"},
|
||||||
|
{file = "packaging-20.9.tar.gz", hash = "sha256:5b327ac1320dc863dca72f4514ecc086f31186744b84a230374cc1fd776feae5"},
|
||||||
|
]
|
||||||
|
pluggy = [
|
||||||
|
{file = "pluggy-0.13.1-py2.py3-none-any.whl", hash = "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"},
|
||||||
|
{file = "pluggy-0.13.1.tar.gz", hash = "sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0"},
|
||||||
|
]
|
||||||
|
py = [
|
||||||
|
{file = "py-1.10.0-py2.py3-none-any.whl", hash = "sha256:3b80836aa6d1feeaa108e046da6423ab8f6ceda6468545ae8d02d9d58d18818a"},
|
||||||
|
{file = "py-1.10.0.tar.gz", hash = "sha256:21b81bda15b66ef5e1a777a21c4dcd9c20ad3efd0b3f817e7a809035269e1bd3"},
|
||||||
|
]
|
||||||
|
pyparsing = [
|
||||||
|
{file = "pyparsing-2.4.7-py2.py3-none-any.whl", hash = "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"},
|
||||||
|
{file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"},
|
||||||
|
]
|
||||||
|
python-dateutil = [
|
||||||
|
{file = "python-dateutil-2.8.1.tar.gz", hash = "sha256:73ebfe9dbf22e832286dafa60473e4cd239f8592f699aa5adaf10050e6e1823c"},
|
||||||
|
{file = "python_dateutil-2.8.1-py2.py3-none-any.whl", hash = "sha256:75bb3f31ea686f1197762692a9ee6a7550b59fc6ca3a1f4b5d7e32fb98e2da2a"},
|
||||||
|
]
|
||||||
|
requests = [
|
||||||
|
{file = "requests-2.25.1-py2.py3-none-any.whl", hash = "sha256:c210084e36a42ae6b9219e00e48287def368a26d03a048ddad7bfee44f75871e"},
|
||||||
|
{file = "requests-2.25.1.tar.gz", hash = "sha256:27973dd4a904a4f13b263a19c866c13b92a39ed1c964655f025f3f8d3d75b804"},
|
||||||
|
]
|
||||||
|
six = [
|
||||||
|
{file = "six-1.15.0-py2.py3-none-any.whl", hash = "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"},
|
||||||
|
{file = "six-1.15.0.tar.gz", hash = "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259"},
|
||||||
|
]
|
||||||
|
toml = [
|
||||||
|
{file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"},
|
||||||
|
{file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"},
|
||||||
|
]
|
||||||
|
tox = [
|
||||||
|
{file = "tox-3.23.0-py2.py3-none-any.whl", hash = "sha256:e007673f3595cede9b17a7c4962389e4305d4a3682a6c5a4159a1453b4f326aa"},
|
||||||
|
{file = "tox-3.23.0.tar.gz", hash = "sha256:05a4dbd5e4d3d8269b72b55600f0b0303e2eb47ad5c6fe76d3576f4c58d93661"},
|
||||||
|
]
|
||||||
|
typing-extensions = [
|
||||||
|
{file = "typing_extensions-3.7.4.3-py2-none-any.whl", hash = "sha256:dafc7639cde7f1b6e1acc0f457842a83e722ccca8eef5270af2d74792619a89f"},
|
||||||
|
{file = "typing_extensions-3.7.4.3-py3-none-any.whl", hash = "sha256:7cb407020f00f7bfc3cb3e7881628838e69d8f3fcab2f64742a5e76b2f841918"},
|
||||||
|
{file = "typing_extensions-3.7.4.3.tar.gz", hash = "sha256:99d4073b617d30288f569d3f13d2bd7548c3a7e4c8de87db09a9d29bb3a4a60c"},
|
||||||
|
]
|
||||||
|
urllib3 = [
|
||||||
|
{file = "urllib3-1.26.4-py2.py3-none-any.whl", hash = "sha256:2f4da4594db7e1e110a944bb1b551fdf4e6c136ad42e4234131391e21eb5b0df"},
|
||||||
|
{file = "urllib3-1.26.4.tar.gz", hash = "sha256:e7b021f7241115872f92f43c6508082facffbd1c048e3c6e2bb9c2a157e28937"},
|
||||||
|
]
|
||||||
|
virtualenv = [
|
||||||
|
{file = "virtualenv-20.4.3-py2.py3-none-any.whl", hash = "sha256:83f95875d382c7abafe06bd2a4cdd1b363e1bb77e02f155ebe8ac082a916b37c"},
|
||||||
|
{file = "virtualenv-20.4.3.tar.gz", hash = "sha256:49ec4eb4c224c6f7dd81bb6d0a28a09ecae5894f4e593c89b0db0885f565a107"},
|
||||||
|
]
|
||||||
|
werkzeug = [
|
||||||
|
{file = "Werkzeug-1.0.1-py2.py3-none-any.whl", hash = "sha256:2de2a5db0baeae7b2d2664949077c2ac63fbd16d98da0ff71837f7d1dea3fd43"},
|
||||||
|
{file = "Werkzeug-1.0.1.tar.gz", hash = "sha256:6c80b1e5ad3665290ea39320b91e1be1e0d5f60652b964a3070216de83d2e47c"},
|
||||||
|
]
|
||||||
|
zipp = [
|
||||||
|
{file = "zipp-3.4.1-py3-none-any.whl", hash = "sha256:51cb66cc54621609dd593d1787f286ee42a5c0adbb4b29abea5a63edc3e03098"},
|
||||||
|
{file = "zipp-3.4.1.tar.gz", hash = "sha256:3607921face881ba3e026887d8150cca609d517579abe052ac81fc5aeffdbd76"},
|
||||||
|
]
|
||||||
19
tests/test-project/pyproject.toml
Normal file
19
tests/test-project/pyproject.toml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
[tool.poetry]
|
||||||
|
name = "test-project"
|
||||||
|
version = "0.0.0"
|
||||||
|
license = "MIT"
|
||||||
|
authors = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"]
|
||||||
|
description = "A fake project for testing"
|
||||||
|
|
||||||
|
[tool.poetry.dependencies]
|
||||||
|
python = "^3.6.1"
|
||||||
|
requests = "^2.25.1"
|
||||||
|
tox = "^3.23.0"
|
||||||
|
python-dateutil = "^2.8.1"
|
||||||
|
Flask = "^1.1.2"
|
||||||
|
toml = "^0.10.2"
|
||||||
|
attrs = "^20.3.0"
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["poetry-core>=1.0.0"]
|
||||||
|
build-backend = "poetry.core.masonry.api"
|
||||||
0
tests/test-project/test_project/__init__.py
Normal file
0
tests/test-project/test_project/__init__.py
Normal file
59
tests/test_installer.py
Normal file
59
tests/test_installer.py
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
# pylint: disable=missing-module-docstring, redefined-outer-name, unused-argument, wrong-import-order, unused-import
|
||||||
|
import time
|
||||||
|
|
||||||
|
import tox.venv
|
||||||
|
from poetry.factory import Factory
|
||||||
|
|
||||||
|
from .fixtures import mock_poetry_factory
|
||||||
|
from .fixtures import mock_venv
|
||||||
|
from tox_poetry_installer import datatypes
|
||||||
|
from tox_poetry_installer import installer
|
||||||
|
|
||||||
|
|
||||||
|
def test_deduplication(mock_venv, mock_poetry_factory):
|
||||||
|
"""Test that the installer does not install duplicate dependencies"""
|
||||||
|
poetry = Factory().create_poetry(None)
|
||||||
|
packages: datatypes.PackageMap = {
|
||||||
|
item.name: item for item in poetry.locker.locked_repository(False).packages
|
||||||
|
}
|
||||||
|
|
||||||
|
venv = tox.venv.VirtualEnv()
|
||||||
|
to_install = [packages["toml"], packages["toml"]]
|
||||||
|
|
||||||
|
installer.install(poetry, venv, to_install)
|
||||||
|
|
||||||
|
assert len(set(to_install)) == len(venv.installed) # pylint: disable=no-member
|
||||||
|
|
||||||
|
|
||||||
|
def test_parallelization(mock_venv, mock_poetry_factory):
|
||||||
|
"""Test that behavior is consistent between parallel and non-parallel usage"""
|
||||||
|
poetry = Factory().create_poetry(None)
|
||||||
|
packages: datatypes.PackageMap = {
|
||||||
|
item.name: item for item in poetry.locker.locked_repository(False).packages
|
||||||
|
}
|
||||||
|
|
||||||
|
to_install = [
|
||||||
|
packages["toml"],
|
||||||
|
packages["toml"],
|
||||||
|
packages["tox"],
|
||||||
|
packages["requests"],
|
||||||
|
packages["python-dateutil"],
|
||||||
|
packages["attrs"],
|
||||||
|
]
|
||||||
|
|
||||||
|
venv_sequential = tox.venv.VirtualEnv()
|
||||||
|
start_sequential = time.time()
|
||||||
|
installer.install(poetry, venv_sequential, to_install, 0)
|
||||||
|
sequential = time.time() - start_sequential
|
||||||
|
|
||||||
|
venv_parallel = tox.venv.VirtualEnv()
|
||||||
|
start_parallel = time.time()
|
||||||
|
installer.install(poetry, venv_parallel, to_install, 5)
|
||||||
|
parallel = time.time() - start_parallel
|
||||||
|
|
||||||
|
# The mock delay during package install is static (one second) so these values should all
|
||||||
|
# be within microseconds of each other
|
||||||
|
assert parallel < sequential
|
||||||
|
assert round(parallel * 5) == round(sequential)
|
||||||
|
assert round(sequential) == len(set(to_install))
|
||||||
|
assert round(parallel * 5) == len(set(to_install))
|
||||||
82
tests/test_transients.py
Normal file
82
tests/test_transients.py
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
# pylint: disable=missing-module-docstring, redefined-outer-name, unused-argument, wrong-import-order, unused-import
|
||||||
|
import poetry.factory
|
||||||
|
import poetry.utils.env
|
||||||
|
import pytest
|
||||||
|
from poetry.puzzle.provider import Provider
|
||||||
|
|
||||||
|
from .fixtures import mock_poetry_factory
|
||||||
|
from .fixtures import mock_venv
|
||||||
|
from tox_poetry_installer import constants
|
||||||
|
from tox_poetry_installer import datatypes
|
||||||
|
from tox_poetry_installer import exceptions
|
||||||
|
from tox_poetry_installer import utilities
|
||||||
|
|
||||||
|
|
||||||
|
def test_exclude_unsafe():
|
||||||
|
"""Test that the unsafe packages are properly excluded
|
||||||
|
|
||||||
|
Also ensure that the internal constant matches the value from Poetry
|
||||||
|
"""
|
||||||
|
assert Provider.UNSAFE_PACKAGES == constants.UNSAFE_PACKAGES
|
||||||
|
|
||||||
|
for dep in constants.UNSAFE_PACKAGES:
|
||||||
|
assert not utilities.identify_transients(dep, {}, None)
|
||||||
|
|
||||||
|
|
||||||
|
def test_allow_missing():
|
||||||
|
"""Test that the ``allow_missing`` parameter works as expected"""
|
||||||
|
with pytest.raises(exceptions.LockedDepNotFoundError):
|
||||||
|
utilities.identify_transients("luke-skywalker", {}, None)
|
||||||
|
|
||||||
|
assert not utilities.identify_transients(
|
||||||
|
"darth-vader", {}, None, allow_missing=["darth-vader"]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_exclude_pep508():
|
||||||
|
"""Test that dependencies specified in PEP508 format are properly excluded"""
|
||||||
|
for version in [
|
||||||
|
"foo==1.0",
|
||||||
|
"foo==1",
|
||||||
|
"foo>2.0.0",
|
||||||
|
"foo<=9.3.4.7.8",
|
||||||
|
"foo>999,<=4.6",
|
||||||
|
"foo>1234 || foo<2021.01.01",
|
||||||
|
"foo!=7",
|
||||||
|
"foo~=0.8",
|
||||||
|
"foo!=9,==7",
|
||||||
|
"=>foo",
|
||||||
|
]:
|
||||||
|
with pytest.raises(exceptions.LockedDepVersionConflictError):
|
||||||
|
utilities.identify_transients(version, {}, None)
|
||||||
|
|
||||||
|
|
||||||
|
def test_functional(mock_poetry_factory, mock_venv):
|
||||||
|
"""Integration tests for the :func:`identify_transients` function
|
||||||
|
|
||||||
|
Trivially test that it resolves dependencies properly and that the parent package
|
||||||
|
is always the last in the returned list.
|
||||||
|
"""
|
||||||
|
pypoetry = poetry.factory.Factory().create_poetry(None)
|
||||||
|
packages: datatypes.PackageMap = {
|
||||||
|
item.name: item for item in pypoetry.locker.locked_repository(False).packages
|
||||||
|
}
|
||||||
|
venv = poetry.utils.env.VirtualEnv() # pylint: disable=no-value-for-parameter
|
||||||
|
|
||||||
|
requests_requires = [
|
||||||
|
packages["certifi"],
|
||||||
|
packages["chardet"],
|
||||||
|
packages["idna"],
|
||||||
|
packages["urllib3"],
|
||||||
|
packages["requests"],
|
||||||
|
]
|
||||||
|
|
||||||
|
transients = utilities.identify_transients("requests", packages, venv)
|
||||||
|
|
||||||
|
assert all((item in requests_requires) for item in transients)
|
||||||
|
assert all((item in transients) for item in requests_requires)
|
||||||
|
|
||||||
|
for package in [packages["requests"], packages["tox"], packages["flask"]]:
|
||||||
|
transients = utilities.identify_transients(package, packages, venv)
|
||||||
|
assert transients[-1] == package
|
||||||
|
assert len(transients) == len(set(transients))
|
||||||
65
tox.ini
65
tox.ini
@@ -1,11 +1,12 @@
|
|||||||
[tox]
|
[tox]
|
||||||
envlist = py36, py37, py38, py39, static, static-tests, security
|
envlist = py36, py37, py38, py39, py310, static, static-tests, security
|
||||||
isolated_build = true
|
isolated_build = true
|
||||||
skip_missing_interpreters = true
|
skip_missing_interpreters = true
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
description = Run the tests
|
description = Run the tests
|
||||||
require_locked_deps = true
|
require_locked_deps = true
|
||||||
|
require_poetry = true
|
||||||
extras =
|
extras =
|
||||||
poetry
|
poetry
|
||||||
locked_deps =
|
locked_deps =
|
||||||
@@ -13,52 +14,76 @@ locked_deps =
|
|||||||
pytest-cov
|
pytest-cov
|
||||||
toml
|
toml
|
||||||
commands =
|
commands =
|
||||||
pytest --cov {envsitepackagesdir}/tox_poetry_installer --cov-config {toxinidir}/.coveragerc --cov-report term-missing tests/
|
pytest {toxinidir}/tests/ \
|
||||||
|
--cov {toxinidir}/tox_poetry_installer \
|
||||||
|
--cov-config {toxinidir}/.coveragerc \
|
||||||
|
--cov-report term-missing
|
||||||
|
|
||||||
[testenv:static]
|
[testenv:static]
|
||||||
description = Static formatting and quality enforcement
|
description = Static formatting and quality enforcement
|
||||||
basepython = python3.8
|
basepython = python3.8
|
||||||
platform = linux
|
platform = linux
|
||||||
ignore_errors = true
|
ignore_errors = true
|
||||||
require_locked_deps = true
|
|
||||||
locked_deps =
|
locked_deps =
|
||||||
pre-commit
|
|
||||||
pre-commit-hooks
|
|
||||||
black
|
black
|
||||||
blacken-docs
|
blacken-docs
|
||||||
reorder-python-imports
|
mdformat
|
||||||
pylint
|
mdformat-gfm
|
||||||
mypy
|
mypy
|
||||||
|
reorder-python-imports
|
||||||
|
pre-commit
|
||||||
|
pre-commit-hooks
|
||||||
|
pylint
|
||||||
|
types-toml
|
||||||
commands =
|
commands =
|
||||||
pre-commit run --all-files
|
pre-commit run \
|
||||||
pylint --rcfile {toxinidir}/.pylintrc {toxinidir}/tox_poetry_installer/
|
--all-files
|
||||||
mypy --ignore-missing-imports --no-strict-optional {toxinidir}/tox_poetry_installer/
|
pylint {toxinidir}/tox_poetry_installer/ \
|
||||||
|
--rcfile {toxinidir}/.pylintrc
|
||||||
|
mypy {toxinidir}/tox_poetry_installer/ \
|
||||||
|
--ignore-missing-imports \
|
||||||
|
--no-strict-optional
|
||||||
|
|
||||||
[testenv:static-tests]
|
[testenv:static-tests]
|
||||||
description = Static formatting and quality enforcement for the tests
|
description = Static formatting and quality enforcement for the tests
|
||||||
basepython = python3.8
|
basepython = python3.8
|
||||||
platform = linux
|
platform = linux
|
||||||
ingore_errors = true
|
ignore_errors = true
|
||||||
require_locked_deps = true
|
|
||||||
locked_deps =
|
locked_deps =
|
||||||
pylint
|
pylint
|
||||||
|
pytest
|
||||||
mypy
|
mypy
|
||||||
|
types-toml
|
||||||
commands =
|
commands =
|
||||||
pylint --rcfile {toxinidir}/.pylintrc {toxinidir}/tests/
|
pylint {toxinidir}/tests/ \
|
||||||
mypy --ignore-missing-imports --no-strict-optional {toxinidir}/tests/
|
--rcfile {toxinidir}/.pylintrc
|
||||||
|
mypy {toxinidir}/tests/ \
|
||||||
|
--ignore-missing-imports \
|
||||||
|
--no-strict-optional
|
||||||
|
|
||||||
[testenv:security]
|
[testenv:security]
|
||||||
description = Security checks
|
description = Security checks
|
||||||
basepython = python3.8
|
basepython = python3.8
|
||||||
platform = linux
|
platform = linux
|
||||||
ingore_errors = true
|
ignore_errors = true
|
||||||
require_locked_deps = true
|
skip_install = true
|
||||||
locked_deps =
|
locked_deps =
|
||||||
bandit
|
bandit
|
||||||
safety
|
safety
|
||||||
poetry
|
poetry
|
||||||
commands =
|
commands =
|
||||||
bandit --recursive --quiet {toxinidir}/tox_poetry_installer/
|
bandit {toxinidir}/tox_poetry_installer/ \
|
||||||
bandit --recursive --quiet --skip B101 {toxinidir}/tests/
|
--recursive \
|
||||||
poetry export --format requirements.txt --output {envtmpdir}/requirements.txt --without-hashes --dev
|
--quiet
|
||||||
safety check --bare --file {envtmpdir}/requirements.txt
|
bandit {toxinidir}/tests/ \
|
||||||
|
--recursive \
|
||||||
|
--quiet \
|
||||||
|
--skip B101
|
||||||
|
poetry export \
|
||||||
|
--format requirements.txt \
|
||||||
|
--output {envtmpdir}/requirements.txt \
|
||||||
|
--without-hashes \
|
||||||
|
--dev
|
||||||
|
safety check \
|
||||||
|
--file {envtmpdir}/requirements.txt \
|
||||||
|
--json
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# pylint: disable=missing-docstring
|
# pylint: disable=missing-docstring
|
||||||
__title__ = "tox-poetry-installer"
|
__title__ = "tox-poetry-installer"
|
||||||
__summary__ = "Tox plugin to install Tox environment dependencies using the Poetry backend and lockfile"
|
__summary__ = "A plugin for Tox that lets you install test environment dependencies from the Poetry lockfile"
|
||||||
__version__ = "0.6.1"
|
__version__ = "0.8.3"
|
||||||
__url__ = "https://github.com/enpaul/tox-poetry-installer/"
|
__url__ = "https://github.com/enpaul/tox-poetry-installer/"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__authors__ = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"]
|
__authors__ = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"]
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ try:
|
|||||||
from poetry.installation.pip_installer import PipInstaller
|
from poetry.installation.pip_installer import PipInstaller
|
||||||
from poetry.io.null_io import NullIO
|
from poetry.io.null_io import NullIO
|
||||||
from poetry.poetry import Poetry
|
from poetry.poetry import Poetry
|
||||||
from poetry.puzzle.provider import Provider
|
|
||||||
from poetry.utils.env import VirtualEnv
|
from poetry.utils.env import VirtualEnv
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise exceptions.PoetryNotInstalledError(
|
raise exceptions.PoetryNotInstalledError(
|
||||||
|
|||||||
@@ -5,11 +5,9 @@ in this module.
|
|||||||
|
|
||||||
All constants should be type hinted.
|
All constants should be type hinted.
|
||||||
"""
|
"""
|
||||||
import sys
|
from typing import Set
|
||||||
from typing import Tuple
|
from typing import Tuple
|
||||||
|
|
||||||
from poetry.core.semver.version import Version
|
|
||||||
|
|
||||||
from tox_poetry_installer import __about__
|
from tox_poetry_installer import __about__
|
||||||
|
|
||||||
|
|
||||||
@@ -19,13 +17,10 @@ PEP508_VERSION_DELIMITERS: Tuple[str, ...] = ("~=", "==", "!=", ">", "<")
|
|||||||
|
|
||||||
# Prefix all reporter messages should include to indicate that they came from this module in the
|
# Prefix all reporter messages should include to indicate that they came from this module in the
|
||||||
# console output.
|
# console output.
|
||||||
REPORTER_PREFIX: str = f"[{__about__.__title__}]:"
|
REPORTER_PREFIX: str = f"{__about__.__title__}:"
|
||||||
|
|
||||||
|
# Internal list of packages that poetry has deemed unsafe and are excluded from the lockfile
|
||||||
|
UNSAFE_PACKAGES: Set[str] = {"distribute", "pip", "setuptools", "wheel"}
|
||||||
|
|
||||||
# Semver compatible version of the current python platform version. Used for checking
|
# Number of threads to use for installing dependencies by default
|
||||||
# whether a package is compatible with the current python system version
|
DEFAULT_INSTALL_THREADS: int = 10
|
||||||
PLATFORM_VERSION: Version = Version(
|
|
||||||
major=sys.version_info.major,
|
|
||||||
minor=sys.version_info.minor,
|
|
||||||
patch=sys.version_info.micro,
|
|
||||||
)
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ All exceptions should inherit from the common base exception :exc:`ToxPoetryInst
|
|||||||
+-- LockedDepNotFoundError
|
+-- LockedDepNotFoundError
|
||||||
+-- ExtraNotFoundError
|
+-- ExtraNotFoundError
|
||||||
+-- LockedDepsRequiredError
|
+-- LockedDepsRequiredError
|
||||||
|
+-- RequiresUnsafeDepError
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -41,3 +42,7 @@ class ExtraNotFoundError(ToxPoetryInstallerException):
|
|||||||
|
|
||||||
class LockedDepsRequiredError(ToxPoetryInstallerException):
|
class LockedDepsRequiredError(ToxPoetryInstallerException):
|
||||||
"""Environment cannot specify unlocked dependencies when locked dependencies are required"""
|
"""Environment cannot specify unlocked dependencies when locked dependencies are required"""
|
||||||
|
|
||||||
|
|
||||||
|
class RequiresUnsafeDepError(ToxPoetryInstallerException):
|
||||||
|
"""Package under test depends on an unsafe dependency and cannot be installed"""
|
||||||
|
|||||||
@@ -4,12 +4,9 @@ All implementations of tox hooks are defined here, as well as any single-use hel
|
|||||||
specifically related to implementing the hooks (to keep the size/readability of the hook functions
|
specifically related to implementing the hooks (to keep the size/readability of the hook functions
|
||||||
themselves manageable).
|
themselves manageable).
|
||||||
"""
|
"""
|
||||||
from typing import List
|
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from poetry.core.packages import Package as PoetryPackage
|
import tox
|
||||||
from tox import hookimpl
|
|
||||||
from tox import reporter
|
|
||||||
from tox.action import Action as ToxAction
|
from tox.action import Action as ToxAction
|
||||||
from tox.config import Parser as ToxParser
|
from tox.config import Parser as ToxParser
|
||||||
from tox.venv import VirtualEnv as ToxVirtualEnv
|
from tox.venv import VirtualEnv as ToxVirtualEnv
|
||||||
@@ -17,11 +14,73 @@ from tox.venv import VirtualEnv as ToxVirtualEnv
|
|||||||
from tox_poetry_installer import __about__
|
from tox_poetry_installer import __about__
|
||||||
from tox_poetry_installer import constants
|
from tox_poetry_installer import constants
|
||||||
from tox_poetry_installer import exceptions
|
from tox_poetry_installer import exceptions
|
||||||
|
from tox_poetry_installer import installer
|
||||||
|
from tox_poetry_installer import logger
|
||||||
from tox_poetry_installer import utilities
|
from tox_poetry_installer import utilities
|
||||||
from tox_poetry_installer.datatypes import PackageMap
|
from tox_poetry_installer.datatypes import PackageMap
|
||||||
|
|
||||||
|
|
||||||
@hookimpl
|
def _postprocess_install_project_deps(
|
||||||
|
testenv_config, value: Optional[str] # pylint: disable=unused-argument
|
||||||
|
) -> Optional[bool]:
|
||||||
|
"""An awful hack to patch on three-state boolean logic to a config parameter
|
||||||
|
|
||||||
|
.. warning: This logic should 100% be removed in the next feature release. It's here to work
|
||||||
|
around a bad design for now but should not persist.
|
||||||
|
|
||||||
|
The bug filed in `#61`_ is caused by a combination of poor design and attempted cleverness. The
|
||||||
|
name of the ``install_project_deps`` config option implies that it has ultimate control over
|
||||||
|
whether the project dependencies are installed to the testenv, but this is not actually correct.
|
||||||
|
What it actually allows the user to do is force the project dependencies to not be installed to
|
||||||
|
an environment that would otherwise install them. This was intended behavior, however the
|
||||||
|
intention was wrong.
|
||||||
|
|
||||||
|
.. _`#61`: https://github.com/enpaul/tox-poetry-installer/issues/61
|
||||||
|
|
||||||
|
In an effort to be clever the plugin automatically skips installing project dependencies when
|
||||||
|
the project package is not installed to the testenv (``skip_install = true``) or if packaging
|
||||||
|
as a whole is disabled (``skipsdist = true``). The intention of this behavior is to install only
|
||||||
|
the expected dependencies to a testenv and no more. However, this conflicts with the
|
||||||
|
``install_project_deps`` config option, which cannot override this behavior because it defaults
|
||||||
|
to ``True``. In effect, ``install_project_deps = true`` in fact means "automatically
|
||||||
|
determine whether to install project dependencies" and ``install_project_deps = false`` means
|
||||||
|
"never install the project dependencies". This is not ideal and unintuitive.
|
||||||
|
|
||||||
|
To avoid having to make a breaking change this workaround has been added to support three-state
|
||||||
|
logic between ``True``, ``False``, and ``None``. The ``install_project_deps`` option is now
|
||||||
|
parsed by Tox as a string with a default value of ``None``. If the value is not ``None`` then
|
||||||
|
this post processing function will try to convert it to a boolean the same way that Tox's
|
||||||
|
`SectionReader.getbool()`_ method does, raising an error to mimic the default behavior if it
|
||||||
|
can't.
|
||||||
|
|
||||||
|
.. _`SectionReader.getbool()`: https://github.com/tox-dev/tox/blob/f8459218ee5ab5753321b3eb989b7beee5b391ad/src/tox/config/__init__.py#L1724
|
||||||
|
|
||||||
|
The three states for the ``install_project_deps`` setting are:
|
||||||
|
* ``None`` - User did not configure the setting, package dependency installation is
|
||||||
|
determined automatically
|
||||||
|
* ``True`` - User configured the setting to ``True``, package dependencies will be installed
|
||||||
|
* ``False`` - User configured the setting to ``False``, package dependencies will not be
|
||||||
|
installed
|
||||||
|
|
||||||
|
This config option should be deprecated with the 1.0.0 release and instead an option like
|
||||||
|
``always_install_project_deps`` should be added which overrides the default determination and
|
||||||
|
just installs the project dependencies. The counterpart (``never_install_project_deps``)
|
||||||
|
shouldn't be needed, since I don't think there's a real use case for that.
|
||||||
|
"""
|
||||||
|
if value is None:
|
||||||
|
return value
|
||||||
|
|
||||||
|
if value.lower() == "true":
|
||||||
|
return True
|
||||||
|
if value.lower() == "false":
|
||||||
|
return False
|
||||||
|
|
||||||
|
raise tox.exception.ConfigError(
|
||||||
|
f"install_project_deps: boolean value '{value}' needs to be 'True' or 'False'"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@tox.hookimpl
|
||||||
def tox_addoption(parser: ToxParser):
|
def tox_addoption(parser: ToxParser):
|
||||||
"""Add required configuration options to the tox INI file
|
"""Add required configuration options to the tox INI file
|
||||||
|
|
||||||
@@ -33,7 +92,23 @@ def tox_addoption(parser: ToxParser):
|
|||||||
"--require-poetry",
|
"--require-poetry",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
dest="require_poetry",
|
dest="require_poetry",
|
||||||
help="Trigger a failure if Poetry is not available to Tox",
|
help="(deprecated) Trigger a failure if Poetry is not available to Tox",
|
||||||
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"--parallelize-locked-install",
|
||||||
|
type=int,
|
||||||
|
dest="parallelize_locked_install",
|
||||||
|
default=None,
|
||||||
|
help="(deprecated) Number of worker threads to use for installing dependencies from the Poetry lockfile in parallel",
|
||||||
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"--parallel-install-threads",
|
||||||
|
type=int,
|
||||||
|
dest="parallel_install_threads",
|
||||||
|
default=constants.DEFAULT_INSTALL_THREADS,
|
||||||
|
help="Number of locked dependencies to install simultaneously; set to 0 to disable parallel installation",
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_testenv_attribute(
|
parser.add_testenv_attribute(
|
||||||
@@ -43,6 +118,14 @@ def tox_addoption(parser: ToxParser):
|
|||||||
help="Automatically install all Poetry development dependencies to the environment",
|
help="Automatically install all Poetry development dependencies to the environment",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
parser.add_testenv_attribute(
|
||||||
|
name="install_project_deps",
|
||||||
|
type="string",
|
||||||
|
default=None,
|
||||||
|
help="Automatically install all Poetry primary dependencies to the environment",
|
||||||
|
postprocess=_postprocess_install_project_deps,
|
||||||
|
)
|
||||||
|
|
||||||
parser.add_testenv_attribute(
|
parser.add_testenv_attribute(
|
||||||
name="require_locked_deps",
|
name="require_locked_deps",
|
||||||
type="bool",
|
type="bool",
|
||||||
@@ -50,6 +133,13 @@ def tox_addoption(parser: ToxParser):
|
|||||||
help="Require all dependencies in the environment be installed using the Poetry lockfile",
|
help="Require all dependencies in the environment be installed using the Poetry lockfile",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
parser.add_testenv_attribute(
|
||||||
|
name="require_poetry",
|
||||||
|
type="bool",
|
||||||
|
default=False,
|
||||||
|
help="Trigger a failure if Poetry is not available to Tox",
|
||||||
|
)
|
||||||
|
|
||||||
parser.add_testenv_attribute(
|
parser.add_testenv_attribute(
|
||||||
name="locked_deps",
|
name="locked_deps",
|
||||||
type="line-list",
|
type="line-list",
|
||||||
@@ -57,7 +147,7 @@ def tox_addoption(parser: ToxParser):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@hookimpl
|
@tox.hookimpl
|
||||||
def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction) -> Optional[bool]:
|
def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction) -> Optional[bool]:
|
||||||
"""Install the dependencies for the current environment
|
"""Install the dependencies for the current environment
|
||||||
|
|
||||||
@@ -72,19 +162,23 @@ def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction) -> Optional
|
|||||||
try:
|
try:
|
||||||
poetry = utilities.check_preconditions(venv, action)
|
poetry = utilities.check_preconditions(venv, action)
|
||||||
except exceptions.SkipEnvironment as err:
|
except exceptions.SkipEnvironment as err:
|
||||||
if (
|
if isinstance(err, exceptions.PoetryNotInstalledError) and (
|
||||||
isinstance(err, exceptions.PoetryNotInstalledError)
|
venv.envconfig.config.option.require_poetry or venv.envconfig.require_poetry
|
||||||
and venv.envconfig.config.option.require_poetry
|
|
||||||
):
|
):
|
||||||
venv.status = err.__class__.__name__
|
venv.status = err.__class__.__name__
|
||||||
reporter.error(str(err))
|
logger.error(str(err))
|
||||||
return False
|
return False
|
||||||
reporter.verbosity1(str(err))
|
logger.info(str(err))
|
||||||
return None
|
return None
|
||||||
|
|
||||||
reporter.verbosity1(
|
logger.info(f"Loaded project pyproject.toml from {poetry.file}")
|
||||||
f"{constants.REPORTER_PREFIX} Loaded project pyproject.toml from {poetry.file}"
|
|
||||||
)
|
virtualenv = utilities.convert_virtualenv(venv)
|
||||||
|
|
||||||
|
if not poetry.locker.is_fresh():
|
||||||
|
logger.warning(
|
||||||
|
f"The Poetry lock file is not up to date with the latest changes in {poetry.file}"
|
||||||
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if venv.envconfig.require_locked_deps and venv.envconfig.deps:
|
if venv.envconfig.require_locked_deps and venv.envconfig.deps:
|
||||||
@@ -92,57 +186,78 @@ def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction) -> Optional
|
|||||||
f"Unlocked dependencies '{venv.envconfig.deps}' specified for environment '{venv.name}' which requires locked dependencies"
|
f"Unlocked dependencies '{venv.envconfig.deps}' specified for environment '{venv.name}' which requires locked dependencies"
|
||||||
)
|
)
|
||||||
|
|
||||||
package_map: PackageMap = {
|
packages: PackageMap = {
|
||||||
package.name: package
|
package.name: package
|
||||||
for package in poetry.locker.locked_repository(True).packages
|
for package in poetry.locker.locked_repository(True).packages
|
||||||
}
|
}
|
||||||
|
|
||||||
if venv.envconfig.install_dev_deps:
|
if venv.envconfig.install_dev_deps:
|
||||||
dev_deps: List[PoetryPackage] = [
|
dev_deps = utilities.find_dev_deps(packages, virtualenv, poetry)
|
||||||
dep
|
logger.info(
|
||||||
for dep in package_map.values()
|
f"Identified {len(dev_deps)} development dependencies to install to env"
|
||||||
if dep not in poetry.locker.locked_repository(False).packages
|
)
|
||||||
]
|
|
||||||
else:
|
else:
|
||||||
dev_deps = []
|
dev_deps = []
|
||||||
|
logger.info("Env does not install development dependencies, skipping")
|
||||||
|
|
||||||
reporter.verbosity1(
|
env_deps = utilities.find_additional_deps(
|
||||||
f"{constants.REPORTER_PREFIX} Identified {len(dev_deps)} development dependencies to install to env"
|
packages, virtualenv, poetry, venv.envconfig.locked_deps
|
||||||
)
|
)
|
||||||
|
|
||||||
env_deps: List[PoetryPackage] = []
|
logger.info(
|
||||||
for dep in venv.envconfig.locked_deps:
|
f"Identified {len(env_deps)} environment dependencies to install to env"
|
||||||
env_deps += utilities.find_transients(package_map, dep.lower())
|
|
||||||
reporter.verbosity1(
|
|
||||||
f"{constants.REPORTER_PREFIX} Identified {len(env_deps)} environment dependencies to install to env"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if not venv.envconfig.skip_install and not venv.envconfig.config.skipsdist:
|
install_project_deps = (
|
||||||
project_deps: List[PoetryPackage] = utilities.find_project_dependencies(
|
venv.envconfig.install_project_deps
|
||||||
venv, poetry, package_map
|
if venv.envconfig.install_project_deps is not None
|
||||||
|
else (
|
||||||
|
not venv.envconfig.skip_install and not venv.envconfig.config.skipsdist
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
if install_project_deps:
|
||||||
|
project_deps = utilities.find_project_deps(
|
||||||
|
packages, virtualenv, poetry, venv.envconfig.extras
|
||||||
|
)
|
||||||
|
logger.info(
|
||||||
|
f"Identified {len(project_deps)} project dependencies to install to env"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
project_deps = []
|
project_deps = []
|
||||||
reporter.verbosity1(
|
logger.info("Env does not install project package dependencies, skipping")
|
||||||
f"{constants.REPORTER_PREFIX} Skipping installation of project dependencies, env does not install project package"
|
|
||||||
)
|
|
||||||
reporter.verbosity1(
|
|
||||||
f"{constants.REPORTER_PREFIX} Identified {len(project_deps)} project dependencies to install to env"
|
|
||||||
)
|
|
||||||
except exceptions.ToxPoetryInstallerException as err:
|
except exceptions.ToxPoetryInstallerException as err:
|
||||||
venv.status = err.__class__.__name__
|
venv.status = err.__class__.__name__
|
||||||
reporter.error(f"{constants.REPORTER_PREFIX} {err}")
|
logger.error(str(err))
|
||||||
return False
|
return False
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
venv.status = "InternalError"
|
venv.status = "InternalError"
|
||||||
reporter.error(f"{constants.REPORTER_PREFIX} Internal plugin error: {err}")
|
logger.error(f"Internal plugin error: {err}")
|
||||||
raise err
|
raise err
|
||||||
|
|
||||||
dependencies = list(set(dev_deps + env_deps + project_deps))
|
dependencies = dev_deps + env_deps + project_deps
|
||||||
|
if (
|
||||||
|
venv.envconfig.config.option.parallel_install_threads
|
||||||
|
!= constants.DEFAULT_INSTALL_THREADS
|
||||||
|
):
|
||||||
|
parallel_threads = venv.envconfig.config.option.parallel_install_threads
|
||||||
|
else:
|
||||||
|
parallel_threads = (
|
||||||
|
venv.envconfig.config.option.parallelize_locked_install
|
||||||
|
if venv.envconfig.config.option.parallelize_locked_install is not None
|
||||||
|
else constants.DEFAULT_INSTALL_THREADS
|
||||||
|
)
|
||||||
|
log_parallel = f" (using {parallel_threads} threads)" if parallel_threads else ""
|
||||||
|
|
||||||
action.setactivity(
|
action.setactivity(
|
||||||
__about__.__title__,
|
__about__.__title__,
|
||||||
f"Installing {len(dependencies)} dependencies from Poetry lock file",
|
f"Installing {len(dependencies)} dependencies from Poetry lock file{log_parallel}",
|
||||||
|
)
|
||||||
|
installer.install(
|
||||||
|
poetry,
|
||||||
|
venv,
|
||||||
|
dependencies,
|
||||||
|
parallel_threads,
|
||||||
)
|
)
|
||||||
utilities.install_to_venv(poetry, venv, dependencies)
|
|
||||||
|
|
||||||
return venv.envconfig.require_locked_deps or None
|
return venv.envconfig.require_locked_deps or None
|
||||||
|
|||||||
81
tox_poetry_installer/installer.py
Normal file
81
tox_poetry_installer/installer.py
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
"""Funcationality for performing virtualenv installation"""
|
||||||
|
# Silence this one globally to support the internal function imports for the proxied poetry module.
|
||||||
|
# See the docstring in 'tox_poetry_installer._poetry' for more context.
|
||||||
|
# pylint: disable=import-outside-toplevel
|
||||||
|
import concurrent.futures
|
||||||
|
import contextlib
|
||||||
|
import typing
|
||||||
|
from datetime import datetime
|
||||||
|
from typing import Sequence
|
||||||
|
from typing import Set
|
||||||
|
|
||||||
|
from poetry.core.packages import Package as PoetryPackage
|
||||||
|
from tox.venv import VirtualEnv as ToxVirtualEnv
|
||||||
|
|
||||||
|
from tox_poetry_installer import logger
|
||||||
|
from tox_poetry_installer import utilities
|
||||||
|
|
||||||
|
if typing.TYPE_CHECKING:
|
||||||
|
from tox_poetry_installer import _poetry
|
||||||
|
|
||||||
|
|
||||||
|
def install(
|
||||||
|
poetry: "_poetry.Poetry",
|
||||||
|
venv: ToxVirtualEnv,
|
||||||
|
packages: Sequence[PoetryPackage],
|
||||||
|
parallels: int = 0,
|
||||||
|
):
|
||||||
|
"""Install a bunch of packages to a virtualenv
|
||||||
|
|
||||||
|
:param poetry: Poetry object the packages were sourced from
|
||||||
|
:param venv: Tox virtual environment to install the packages to
|
||||||
|
:param packages: List of packages to install to the virtual environment
|
||||||
|
:param parallels: Number of parallel processes to use for installing dependency packages, or
|
||||||
|
``None`` to disable parallelization.
|
||||||
|
"""
|
||||||
|
from tox_poetry_installer import _poetry
|
||||||
|
|
||||||
|
logger.info(
|
||||||
|
f"Installing {len(packages)} packages to environment at {venv.envconfig.envdir}"
|
||||||
|
)
|
||||||
|
|
||||||
|
pip = _poetry.PipInstaller(
|
||||||
|
env=utilities.convert_virtualenv(venv),
|
||||||
|
io=_poetry.NullIO(),
|
||||||
|
pool=poetry.pool,
|
||||||
|
)
|
||||||
|
|
||||||
|
installed: Set[PoetryPackage] = set()
|
||||||
|
|
||||||
|
def logged_install(dependency: PoetryPackage) -> None:
|
||||||
|
start = datetime.now()
|
||||||
|
logger.debug(f"Installing {dependency}")
|
||||||
|
pip.install(dependency)
|
||||||
|
end = datetime.now()
|
||||||
|
logger.debug(f"Finished installing {dependency} in {end - start}")
|
||||||
|
|
||||||
|
@contextlib.contextmanager
|
||||||
|
def _optional_parallelize():
|
||||||
|
"""A bit of cheat, really
|
||||||
|
|
||||||
|
A context manager that exposes a common interface for the caller that optionally
|
||||||
|
enables/disables the usage of the parallel thread pooler depending on the value of
|
||||||
|
the ``parallels`` parameter.
|
||||||
|
"""
|
||||||
|
if parallels > 0:
|
||||||
|
with concurrent.futures.ThreadPoolExecutor(
|
||||||
|
max_workers=parallels
|
||||||
|
) as executor:
|
||||||
|
yield executor.submit
|
||||||
|
else:
|
||||||
|
yield lambda func, arg: func(arg)
|
||||||
|
|
||||||
|
with _optional_parallelize() as executor:
|
||||||
|
for dependency in packages:
|
||||||
|
if dependency not in installed:
|
||||||
|
installed.add(dependency)
|
||||||
|
logger.debug(f"Queuing {dependency}")
|
||||||
|
executor(logged_install, dependency)
|
||||||
|
else:
|
||||||
|
logger.debug(f"Skipping {dependency}, already installed")
|
||||||
|
logger.debug("Waiting for installs to finish...")
|
||||||
29
tox_poetry_installer/logger.py
Normal file
29
tox_poetry_installer/logger.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
"""Logging wrappers to reduce duplication elsewhere
|
||||||
|
|
||||||
|
Calling ``tox.reporter.something()`` and having to format a string with the prefix
|
||||||
|
gets really old fast, but more importantly it also makes the flow of the main code
|
||||||
|
more difficult to follow because of the added complexity.
|
||||||
|
"""
|
||||||
|
import tox
|
||||||
|
|
||||||
|
from tox_poetry_installer import constants
|
||||||
|
|
||||||
|
|
||||||
|
def error(message: str):
|
||||||
|
"""Wrapper around :func:`tox.reporter.error`"""
|
||||||
|
tox.reporter.error(f"{constants.REPORTER_PREFIX} {message}")
|
||||||
|
|
||||||
|
|
||||||
|
def warning(message: str):
|
||||||
|
"""Wrapper around :func:`tox.reporter.warning`"""
|
||||||
|
tox.reporter.warning(f"{constants.REPORTER_PREFIX} {message}")
|
||||||
|
|
||||||
|
|
||||||
|
def info(message: str):
|
||||||
|
"""Wrapper around :func:`tox.reporter.verbosity1`"""
|
||||||
|
tox.reporter.verbosity1(f"{constants.REPORTER_PREFIX} {message}")
|
||||||
|
|
||||||
|
|
||||||
|
def debug(message: str):
|
||||||
|
"""Wrapper around :func:`tox.reporter.verbosity2`"""
|
||||||
|
tox.reporter.verbosity2(f"{constants.REPORTER_PREFIX} {message}")
|
||||||
@@ -2,137 +2,39 @@
|
|||||||
# Silence this one globally to support the internal function imports for the proxied poetry module.
|
# Silence this one globally to support the internal function imports for the proxied poetry module.
|
||||||
# See the docstring in 'tox_poetry_installer._poetry' for more context.
|
# See the docstring in 'tox_poetry_installer._poetry' for more context.
|
||||||
# pylint: disable=import-outside-toplevel
|
# pylint: disable=import-outside-toplevel
|
||||||
import sys
|
|
||||||
import typing
|
import typing
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List
|
from typing import List
|
||||||
from typing import Sequence
|
from typing import Sequence
|
||||||
from typing import Set
|
from typing import Set
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
from poetry.core.packages import Dependency as PoetryDependency
|
||||||
from poetry.core.packages import Package as PoetryPackage
|
from poetry.core.packages import Package as PoetryPackage
|
||||||
from tox import reporter
|
|
||||||
from tox.action import Action as ToxAction
|
from tox.action import Action as ToxAction
|
||||||
from tox.venv import VirtualEnv as ToxVirtualEnv
|
from tox.venv import VirtualEnv as ToxVirtualEnv
|
||||||
|
|
||||||
from tox_poetry_installer import constants
|
from tox_poetry_installer import constants
|
||||||
from tox_poetry_installer import exceptions
|
from tox_poetry_installer import exceptions
|
||||||
|
from tox_poetry_installer import logger
|
||||||
from tox_poetry_installer.datatypes import PackageMap
|
from tox_poetry_installer.datatypes import PackageMap
|
||||||
|
|
||||||
if typing.TYPE_CHECKING:
|
if typing.TYPE_CHECKING:
|
||||||
from tox_poetry_installer import _poetry
|
from tox_poetry_installer import _poetry
|
||||||
|
|
||||||
|
|
||||||
def install_to_venv(
|
|
||||||
poetry: "_poetry.Poetry", venv: ToxVirtualEnv, packages: Sequence[PoetryPackage]
|
|
||||||
):
|
|
||||||
"""Install a bunch of packages to a virtualenv
|
|
||||||
|
|
||||||
:param poetry: Poetry object the packages were sourced from
|
|
||||||
:param venv: Tox virtual environment to install the packages to
|
|
||||||
:param packages: List of packages to install to the virtual environment
|
|
||||||
"""
|
|
||||||
from tox_poetry_installer import _poetry
|
|
||||||
|
|
||||||
reporter.verbosity1(
|
|
||||||
f"{constants.REPORTER_PREFIX} Installing {len(packages)} packages to environment at {venv.envconfig.envdir}"
|
|
||||||
)
|
|
||||||
|
|
||||||
installer = _poetry.PipInstaller(
|
|
||||||
env=_poetry.VirtualEnv(path=Path(venv.envconfig.envdir)),
|
|
||||||
io=_poetry.NullIO(),
|
|
||||||
pool=poetry.pool,
|
|
||||||
)
|
|
||||||
|
|
||||||
for dependency in packages:
|
|
||||||
reporter.verbosity1(f"{constants.REPORTER_PREFIX} Installing {dependency}")
|
|
||||||
installer.install(dependency)
|
|
||||||
|
|
||||||
|
|
||||||
def find_transients(packages: PackageMap, dependency_name: str) -> Set[PoetryPackage]:
|
|
||||||
"""Using a poetry object identify all dependencies of a specific dependency
|
|
||||||
|
|
||||||
:param poetry: Populated poetry object which can be used to build a populated locked
|
|
||||||
repository object.
|
|
||||||
:param dependency_name: Bare name (without version) of the dependency to fetch the transient
|
|
||||||
dependencies of.
|
|
||||||
:returns: List of packages that need to be installed for the requested dependency.
|
|
||||||
|
|
||||||
.. note:: The package corresponding to the dependency named by ``dependency_name`` is included
|
|
||||||
in the list of returned packages.
|
|
||||||
"""
|
|
||||||
from tox_poetry_installer import _poetry
|
|
||||||
|
|
||||||
def find_deps_of_deps(name: str, searched: Set[str]) -> PackageMap:
|
|
||||||
searched.add(name)
|
|
||||||
|
|
||||||
if name in _poetry.Provider.UNSAFE_PACKAGES:
|
|
||||||
reporter.warning(
|
|
||||||
f"{constants.REPORTER_PREFIX} Installing package '{name}' using Poetry is not supported and will be skipped"
|
|
||||||
)
|
|
||||||
reporter.verbosity2(
|
|
||||||
f"{constants.REPORTER_PREFIX} Skip {name}: designated unsafe by Poetry"
|
|
||||||
)
|
|
||||||
return dict()
|
|
||||||
|
|
||||||
transients: PackageMap = {}
|
|
||||||
package = packages[name]
|
|
||||||
|
|
||||||
if not package.python_constraint.allows(constants.PLATFORM_VERSION):
|
|
||||||
reporter.verbosity2(
|
|
||||||
f"{constants.REPORTER_PREFIX} Skip {package}: incompatible Python requirement '{package.python_constraint}' for current version '{constants.PLATFORM_VERSION}'"
|
|
||||||
)
|
|
||||||
elif package.platform is not None and package.platform != sys.platform:
|
|
||||||
reporter.verbosity2(
|
|
||||||
f"{constants.REPORTER_PREFIX} Skip {package}: incompatible platform requirement '{package.platform}' for current platform '{sys.platform}'"
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
reporter.verbosity2(
|
|
||||||
f"{constants.REPORTER_PREFIX} Including {package} for installation"
|
|
||||||
)
|
|
||||||
transients[name] = package
|
|
||||||
for index, dep in enumerate(package.requires):
|
|
||||||
reporter.verbosity2(
|
|
||||||
f"{constants.REPORTER_PREFIX} Processing dependency {index + 1}/{len(package.requires)} for {package}: {dep.name}"
|
|
||||||
)
|
|
||||||
if dep.name not in searched:
|
|
||||||
transients.update(find_deps_of_deps(dep.name, searched))
|
|
||||||
else:
|
|
||||||
reporter.verbosity2(
|
|
||||||
f"{constants.REPORTER_PREFIX} Package with name '{dep.name}' has already been processed, skipping"
|
|
||||||
)
|
|
||||||
|
|
||||||
return transients
|
|
||||||
|
|
||||||
searched: Set[str] = set()
|
|
||||||
|
|
||||||
try:
|
|
||||||
transients: PackageMap = find_deps_of_deps(
|
|
||||||
packages[dependency_name].name, searched
|
|
||||||
)
|
|
||||||
except KeyError:
|
|
||||||
if dependency_name in _poetry.Provider.UNSAFE_PACKAGES:
|
|
||||||
reporter.warning(
|
|
||||||
f"{constants.REPORTER_PREFIX} Installing package '{dependency_name}' using Poetry is not supported and will be skipped"
|
|
||||||
)
|
|
||||||
return set()
|
|
||||||
|
|
||||||
if any(
|
|
||||||
delimiter in dependency_name
|
|
||||||
for delimiter in constants.PEP508_VERSION_DELIMITERS
|
|
||||||
):
|
|
||||||
raise exceptions.LockedDepVersionConflictError(
|
|
||||||
f"Locked dependency '{dependency_name}' cannot include version specifier"
|
|
||||||
) from None
|
|
||||||
|
|
||||||
raise exceptions.LockedDepNotFoundError(
|
|
||||||
f"No version of locked dependency '{dependency_name}' found in the project lockfile"
|
|
||||||
) from None
|
|
||||||
|
|
||||||
return set(transients.values())
|
|
||||||
|
|
||||||
|
|
||||||
def check_preconditions(venv: ToxVirtualEnv, action: ToxAction) -> "_poetry.Poetry":
|
def check_preconditions(venv: ToxVirtualEnv, action: ToxAction) -> "_poetry.Poetry":
|
||||||
"""Check that the local project environment meets expectations"""
|
"""Check that the local project environment meets expectations"""
|
||||||
|
# Skip running the plugin for the provisioning environment. The provisioned environment,
|
||||||
|
# for alternative Tox versions and/or the ``requires`` meta dependencies is specially
|
||||||
|
# handled by Tox and is out of scope for this plugin. Since one of the ways to install this
|
||||||
|
# plugin in the first place is via the Tox provisioning environment, it quickly becomes a
|
||||||
|
# chicken-and-egg problem.
|
||||||
|
if action.name == venv.envconfig.config.provision_tox_env:
|
||||||
|
raise exceptions.SkipEnvironment(
|
||||||
|
f"Skipping Tox provisioning env '{action.name}'"
|
||||||
|
)
|
||||||
|
|
||||||
# Skip running the plugin for the packaging environment. PEP-517 front ends can handle
|
# Skip running the plugin for the packaging environment. PEP-517 front ends can handle
|
||||||
# that better than we can, so let them do their thing. More to the point: if you're having
|
# that better than we can, so let them do their thing. More to the point: if you're having
|
||||||
# problems in the packaging env that this plugin would solve, god help you.
|
# problems in the packaging env that this plugin would solve, god help you.
|
||||||
@@ -141,6 +43,19 @@ def check_preconditions(venv: ToxVirtualEnv, action: ToxAction) -> "_poetry.Poet
|
|||||||
f"Skipping isolated packaging build env '{action.name}'"
|
f"Skipping isolated packaging build env '{action.name}'"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if venv.envconfig.config.option.require_poetry:
|
||||||
|
logger.warning(
|
||||||
|
"DEPRECATION: The '--require-poetry' runtime option is deprecated and will be "
|
||||||
|
"removed in version 1.0.0. Please update test environments that require Poetry to "
|
||||||
|
"set the 'require_poetry = true' option in tox.ini"
|
||||||
|
)
|
||||||
|
|
||||||
|
if venv.envconfig.config.option.parallelize_locked_install is not None:
|
||||||
|
logger.warning(
|
||||||
|
"DEPRECATION: The '--parallelize-locked-install' option is deprecated and will "
|
||||||
|
"be removed in version 1.0.0. Please use the '--parallel-install-threads' option."
|
||||||
|
)
|
||||||
|
|
||||||
from tox_poetry_installer import _poetry
|
from tox_poetry_installer import _poetry
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -156,40 +71,170 @@ def check_preconditions(venv: ToxVirtualEnv, action: ToxAction) -> "_poetry.Poet
|
|||||||
) from None
|
) from None
|
||||||
|
|
||||||
|
|
||||||
def find_project_dependencies(
|
def convert_virtualenv(venv: ToxVirtualEnv) -> "_poetry.VirtualEnv":
|
||||||
venv: ToxVirtualEnv, poetry: "_poetry.Poetry", packages: PackageMap
|
"""Convert a Tox venv to a Poetry venv
|
||||||
|
|
||||||
|
:param venv: Tox ``VirtualEnv`` object representing a tox virtual environment
|
||||||
|
:returns: Poetry ``VirtualEnv`` object representing a poetry virtual environment
|
||||||
|
"""
|
||||||
|
from tox_poetry_installer import _poetry
|
||||||
|
|
||||||
|
return _poetry.VirtualEnv(path=Path(venv.envconfig.envdir))
|
||||||
|
|
||||||
|
|
||||||
|
def identify_transients(
|
||||||
|
dep: Union[PoetryDependency, str],
|
||||||
|
packages: PackageMap,
|
||||||
|
venv: "_poetry.VirtualEnv",
|
||||||
|
allow_missing: Sequence[str] = (),
|
||||||
) -> List[PoetryPackage]:
|
) -> List[PoetryPackage]:
|
||||||
"""Install the dependencies of the project package
|
"""Using a pool of packages, identify all transient dependencies of a given package name
|
||||||
|
|
||||||
Install all primary dependencies of the project package.
|
:param dep: Either the Poetry dependency or the dependency's bare package name to recursively
|
||||||
|
identify the transient dependencies of
|
||||||
|
:param packages: All packages from the lockfile to use for identifying dependency relationships.
|
||||||
|
:param venv: Poetry virtual environment to use for package compatibility checks
|
||||||
|
:param allow_missing: Sequence of package names to allow to be missing from the lockfile. Any
|
||||||
|
packages that are not found in the lockfile but their name appears in this
|
||||||
|
list will be silently skipped from installation.
|
||||||
|
:returns: List of packages that need to be installed for the requested dependency.
|
||||||
|
|
||||||
:param venv: Tox virtual environment to install the packages to
|
.. note:: The package corresponding to the dependency specified by the ``dep`` parameter will
|
||||||
:param poetry: Poetry object the packages were sourced from
|
be included in the returned list of packages.
|
||||||
:param packages: Mapping of package names to the corresponding package object
|
"""
|
||||||
|
transients: List[PoetryPackage] = []
|
||||||
|
searched: Set[str] = set()
|
||||||
|
|
||||||
|
def _deps_of_dep(transient: PoetryDependency):
|
||||||
|
searched.add(transient.name)
|
||||||
|
|
||||||
|
if venv.is_valid_for_marker(transient.marker):
|
||||||
|
for requirement in packages[transient.name].requires:
|
||||||
|
if requirement.name not in searched:
|
||||||
|
_deps_of_dep(requirement)
|
||||||
|
logger.debug(f"Including {transient} for installation")
|
||||||
|
transients.append(packages[transient.name])
|
||||||
|
else:
|
||||||
|
logger.debug(f"Skipping {transient}: package requires {transient.marker}")
|
||||||
|
|
||||||
|
try:
|
||||||
|
if isinstance(dep, str):
|
||||||
|
dep = packages[dep].to_dependency()
|
||||||
|
|
||||||
|
_deps_of_dep(dep)
|
||||||
|
except KeyError as err:
|
||||||
|
dep_name = err.args[0]
|
||||||
|
|
||||||
|
if dep_name in constants.UNSAFE_PACKAGES:
|
||||||
|
logger.warning(
|
||||||
|
f"Installing package '{dep_name}' using Poetry is not supported and will be skipped"
|
||||||
|
)
|
||||||
|
logger.debug(f"Skipping {dep_name}: designated unsafe by Poetry")
|
||||||
|
return []
|
||||||
|
|
||||||
|
if dep_name in allow_missing:
|
||||||
|
logger.debug(f"Skipping {dep_name}: package is allowed to be unlocked")
|
||||||
|
return []
|
||||||
|
|
||||||
|
if any(
|
||||||
|
delimiter in dep_name for delimiter in constants.PEP508_VERSION_DELIMITERS
|
||||||
|
):
|
||||||
|
raise exceptions.LockedDepVersionConflictError(
|
||||||
|
f"Locked dependency '{dep_name}' cannot include version specifier"
|
||||||
|
) from None
|
||||||
|
|
||||||
|
raise exceptions.LockedDepNotFoundError(
|
||||||
|
f"No version of locked dependency '{dep_name}' found in the project lockfile"
|
||||||
|
) from None
|
||||||
|
|
||||||
|
return transients
|
||||||
|
|
||||||
|
|
||||||
|
def find_project_deps(
|
||||||
|
packages: PackageMap,
|
||||||
|
venv: "_poetry.VirtualEnv",
|
||||||
|
poetry: "_poetry.Poetry",
|
||||||
|
extras: Sequence[str] = (),
|
||||||
|
) -> List[PoetryPackage]:
|
||||||
|
"""Find the root project dependencies
|
||||||
|
|
||||||
|
Recursively identify the dependencies of the root project package
|
||||||
|
|
||||||
|
:param packages: Mapping of all locked package names to their corresponding package object
|
||||||
|
:param venv: Poetry virtual environment to use for package compatibility checks
|
||||||
|
:param poetry: Poetry object for the current project
|
||||||
|
:param extras: Sequence of extra names to include the dependencies of
|
||||||
"""
|
"""
|
||||||
|
|
||||||
base_dependencies: List[PoetryPackage] = [
|
if any(dep.name in constants.UNSAFE_PACKAGES for dep in poetry.package.requires):
|
||||||
|
raise exceptions.RequiresUnsafeDepError(
|
||||||
|
f"Project package requires one or more unsafe dependencies ({', '.join(constants.UNSAFE_PACKAGES)}) which cannot be installed with Poetry"
|
||||||
|
)
|
||||||
|
|
||||||
|
base_deps: List[PoetryPackage] = [
|
||||||
packages[item.name]
|
packages[item.name]
|
||||||
for item in poetry.package.requires
|
for item in poetry.package.requires
|
||||||
if not item.is_optional()
|
if not item.is_optional()
|
||||||
]
|
]
|
||||||
|
|
||||||
extra_dependencies: List[PoetryPackage] = []
|
extra_deps: List[PoetryPackage] = []
|
||||||
for extra in venv.envconfig.extras:
|
for extra in extras:
|
||||||
reporter.verbosity1(
|
logger.info(f"Processing project extra '{extra}'")
|
||||||
f"{constants.REPORTER_PREFIX} Processing project extra '{extra}'"
|
|
||||||
)
|
|
||||||
try:
|
try:
|
||||||
extra_dependencies += [
|
extra_deps += [packages[item.name] for item in poetry.package.extras[extra]]
|
||||||
packages[item.name] for item in poetry.package.extras[extra]
|
|
||||||
]
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise exceptions.ExtraNotFoundError(
|
raise exceptions.ExtraNotFoundError(
|
||||||
f"Environment '{venv.name}' specifies project extra '{extra}' which was not found in the lockfile"
|
f"Environment specifies project extra '{extra}' which was not found in the lockfile"
|
||||||
) from None
|
) from None
|
||||||
|
|
||||||
dependencies: List[PoetryPackage] = []
|
dependencies: List[PoetryPackage] = []
|
||||||
for dep in base_dependencies + extra_dependencies:
|
for dep in base_deps + extra_deps:
|
||||||
dependencies += find_transients(packages, dep.name.lower())
|
dependencies += identify_transients(
|
||||||
|
dep.name.lower(), packages, venv, allow_missing=[poetry.package.name]
|
||||||
|
)
|
||||||
|
|
||||||
return dependencies
|
return dependencies
|
||||||
|
|
||||||
|
|
||||||
|
def find_additional_deps(
|
||||||
|
packages: PackageMap,
|
||||||
|
venv: "_poetry.VirtualEnv",
|
||||||
|
poetry: "_poetry.Poetry",
|
||||||
|
dep_names: Sequence[str],
|
||||||
|
) -> List[PoetryPackage]:
|
||||||
|
"""Find additional dependencies
|
||||||
|
|
||||||
|
Recursively identify the dependencies of an arbitrary list of package names
|
||||||
|
|
||||||
|
:param packages: Mapping of all locked package names to their corresponding package object
|
||||||
|
:param venv: Poetry virtual environment to use for package compatibility checks
|
||||||
|
:param poetry: Poetry object for the current project
|
||||||
|
:param dep_names: Sequence of additional dependency names to recursively find the transient
|
||||||
|
dependencies for
|
||||||
|
"""
|
||||||
|
deps: List[PoetryPackage] = []
|
||||||
|
for dep_name in dep_names:
|
||||||
|
deps += identify_transients(
|
||||||
|
dep_name.lower(), packages, venv, allow_missing=[poetry.package.name]
|
||||||
|
)
|
||||||
|
|
||||||
|
return deps
|
||||||
|
|
||||||
|
|
||||||
|
def find_dev_deps(
|
||||||
|
packages: PackageMap, venv: "_poetry.VirtualEnv", poetry: "_poetry.Poetry"
|
||||||
|
) -> List[PoetryPackage]:
|
||||||
|
"""Find the dev dependencies
|
||||||
|
|
||||||
|
Recursively identify the Poetry dev dependencies
|
||||||
|
|
||||||
|
:param packages: Mapping of all locked package names to their corresponding package object
|
||||||
|
:param venv: Poetry virtual environment to use for package compatibility checks
|
||||||
|
:param poetry: Poetry object for the current project
|
||||||
|
"""
|
||||||
|
return find_additional_deps(
|
||||||
|
packages,
|
||||||
|
venv,
|
||||||
|
poetry,
|
||||||
|
poetry.pyproject.data["tool"]["poetry"].get("dev-dependencies", {}).keys(),
|
||||||
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user