Compare commits

...

329 Commits
0.1.0 ... devel

Author SHA1 Message Date
536fd6536b
Merge pull request #98 from enpaul/enp/refactor
Overhaul for stable
2024-08-20 14:09:42 -04:00
bbb075a1de
Expand single character iteration variable 2024-08-20 14:06:51 -04:00
198287a633
Standardize import structure
Standardize on "import module" format rather than "from module import foo" format
Remove _poetry stub module since we directly depend on the poetry package now
Fix conflicts between modules and parameters both named 'poetry'
Fixes #92
2024-08-20 14:06:51 -04:00
4b38b00f81
Update mypy to 1.11
Fix typing errors
2024-08-20 13:14:22 -04:00
863f88d63c
Fix linting errors for pylint 3 2024-08-20 13:02:12 -04:00
d816678975
Update dev dependencies to latest versions 2024-08-16 14:47:06 -04:00
552f2080f5
Remove python 3.7 support, add python 3.12 2024-08-16 14:47:06 -04:00
ddbf442a30
Update to isort and black 24 2024-08-16 14:27:46 -04:00
13cfb8616c
Replace reorder-python-imports with isort
See here for indept explanation: https://github.com/psf/black/issues/4175
See here (and related) for the attitude: https://github.com/asottile/reorder-python-imports/issues/366
2024-08-16 14:26:51 -04:00
df343396a4
Remove safety dependency vulnerability scanner
I went back and fourth on this, but ultimately decided that it's more trouble
than it's worth. Between false positives, deeply nested packages raising
vulnerabilities, and the brittleness of the poetry-plugin-export that the
tooling relies on, it causes more headaches than it avoids. A future PR will
enable dependabot tooling that will open PRs to automatically fix this problem
so I don't have to deal with it anymore (hopefully)
2024-08-16 13:26:12 -04:00
f66e59ab85
Pin all development dependencies to python^3.10 2024-08-16 12:50:51 -04:00
f37463d172
Fix linting errors
Remove unused imports
Disable redundant errors
Add notes for why errors are disabled
2024-08-16 11:06:31 -04:00
6837a64121
Add handling of error when poetry.lock does not exist
Fixes #81
2024-08-16 11:06:31 -04:00
506aae0ccd
Replace optional [poetry] extra with explicit poetry dependencies
Fixes #79
2024-08-16 11:06:31 -04:00
5c4d861230
Consolidate all package handling logic into hook module
This creates a large module to sort through, but the hope is that it
avoids the need to constantly hop around without rhyme or reason to
find the piece of logic you're looking for. The module structure is
mapped to functionality rather than an arbitrary concept of reducing
line number.
2024-08-15 13:55:36 -04:00
f3ae242cf7
Add import exception to Poetry import error message
Fixes #96
2024-08-15 13:55:19 -04:00
57787c6206
Reorganize hooks into dedicated submodule
Fixes #93
2024-08-15 13:55:18 -04:00
661072a69f
Remove unsafe dependency check
Fixes #97
2024-08-15 13:55:17 -04:00
0a46b2d876
Remove deprecated --require-poetry runtime option 2024-08-13 12:48:58 -04:00
c06cdfe8c2
Update transient dependencies 2024-08-13 12:44:45 -04:00
e875008bff
Merge pull request #95 from enpaul/enp/docs
Prep for 1.0 beta release
2023-08-02 11:32:46 -04:00
ef3cf00e6b
Update changelog for 1.0.0b1 2023-08-02 11:29:28 -04:00
230d3cffd9
Bump version to 1.0.0b1 2023-08-02 11:29:28 -04:00
873e1a719c
Remove deprecated option notes from documentation 2023-08-02 11:29:28 -04:00
f6dab542d0
Merge pull request #94 from enpaul/enp/security
Update cryptography to mitigate CVE-2023-2650
2023-08-02 11:18:26 -04:00
7f004fd7e2
Update cryptography to mitigate CVE-2023-2650 2023-08-02 11:14:31 -04:00
76cc63e685
Merge pull request #80 from oshmoun/tox4
Make plugin compatible with tox v4 and poetry 1.5+
2023-08-02 11:08:35 -04:00
Obeida Shamoun
9efcea762e
hooks: only check for require_poetry in env config 2023-07-06 14:33:29 +02:00
Obeida Shamoun
fe95ff5ca1
hooks: remove obsolete install_project_deps ternary 2023-07-06 14:32:26 +02:00
Obeida Shamoun
6991f29b4d
hooks: remove commented code 2023-07-06 14:31:03 +02:00
Obeida Shamoun
2b8936267e
remove unneeded tox_add_core_config hook 2023-06-24 01:56:54 +02:00
Obeida Shamoun
3f99f3476c
poetry.lock: update vulnerable requests package 2023-06-24 01:44:48 +02:00
Obeida Shamoun
46a7619c4f
hooks: add log message before calling install() 2023-06-24 01:44:48 +02:00
Obeida Shamoun
c81215bc3b
implement tox_add_option hook 2023-06-24 01:44:47 +02:00
Obeida Shamoun
0693ce4706
restrict poetry and tox versions to latest versions 2023-06-24 01:44:47 +02:00
Obeida Shamoun
a489fe2c53
Move away from soon-to-be-removed PipInstaller 2023-06-24 01:44:47 +02:00
Obeida Shamoun
a94933e7ef
[WIP] Make plugin compatible with tox v4 2023-06-24 01:44:47 +02:00
c55ba474c7
Add parallel flag to makefile test target 2023-05-19 14:31:39 -04:00
2b75f74996
Merge pull request #90 from enpaul/enp/block-1.5
Block compatibility with Poetry-1.5 until plugin is updated
2023-05-19 14:25:54 -04:00
449381ca09
Update mdformat to mitigate CVE-2023-26303
Update markdown format with new version of mdformat
2023-05-19 14:21:17 -04:00
bb44db0f9d
Update changelog for 0.10.3 2023-05-19 14:08:35 -04:00
afaf025485
Bump version to 0.10.3 2023-05-19 13:56:45 -04:00
c984abbc2f
Update poetry requirement to remove compatibility with ^1.5 2023-05-19 13:56:00 -04:00
cee49ff6c0
Update changelog for 0.10.2 2023-03-29 19:29:20 -04:00
11a478bd4e
Bump version to 0.10.2 2023-03-29 19:25:29 -04:00
5e26a4e0de
Update documentation
Add link to official poetry docs on tox integration
Add emojis to notes/warnings to improve ease of comprehension
Update docs with new poetry command syntax
Remove link to deprecated tox-poetry plugin
Remove docs on unsafe dependencies
2023-03-29 19:24:47 -04:00
c6c35636cd
Merge pull request #87 from chriskuehl/raise-exceptions-from-install
Ensure exceptions which occur during install are propagated
2023-03-29 19:04:12 -04:00
Chris Kuehl
bc75c57126
Fix pylint errors 2023-03-29 17:53:14 -05:00
Chris Kuehl
7e5bc30b93
Try inline import in tests to avoid disrupting fixture monkeypatching 2023-03-29 17:53:06 -05:00
Chris Kuehl
593f260278
Ensure exceptions which occur during install are propagated 2023-03-29 17:52:51 -05:00
779dd8c56f
Update changelog for 0.10.1 2023-03-01 17:03:38 -05:00
3399bbecc2
Bump version to 0.10.1 2023-03-01 16:56:12 -05:00
dd61f8c40f
Fix markdown formatting error in docs 2023-03-01 16:55:39 -05:00
447475ebe0
Merge pull request #85 from enpaul/enp/ci
Fix CI
2023-03-01 16:52:09 -05:00
d711a17596
Update dependencies to fix security flags 2023-03-01 16:43:09 -05:00
4f69c8b3b2
Add explicit virtualenv dep to work around issue in poetry-export
Poetry-export is used in CI so this bug blocks CI operation without the workaround
suggested in this issue: https://github.com/python-poetry/poetry-plugin-export/issues/176
2023-03-01 16:39:05 -05:00
bd102605b6
Merge pull request #84 from enpaul/enp/py311
Add official support for Python 3.11
2023-02-24 18:12:29 -05:00
469cb251cf
Add official support for Python 3.11
Add pypi classifier for py3.11
Update CI to test py3.11
2023-02-24 17:49:31 -05:00
41ac5423f9
Merge pull request #83 from enpaul/enp/poetry1.3
Update dependencies to include compatibility with Poetry 1.3
2023-02-24 17:44:12 -05:00
3388553ee0
Update actions CI to use poetry 1.3.2 2023-02-24 17:02:54 -05:00
52f34cb317
Update dependencies to include compatibility with Poetry 1.3
Fixes #78
2023-02-24 16:58:14 -05:00
4c609770f1
Update to use new poetry 1.2+ command syntax 2022-10-06 15:16:35 -04:00
d5650f0562
Merge pull request #77 from enpaul/enp/0.10.0
Prepare for 0.10 release
2022-10-06 13:24:33 -04:00
4261d45218
Update documentation for new config options 2022-10-06 13:09:32 -04:00
d0842456cb
Update changelog for 0.10.0 2022-10-06 13:09:32 -04:00
b631a962b2
Deprecate install_dev_deps config option 2022-10-06 13:09:28 -04:00
453b575159
Bump version to 0.10.0 2022-10-06 13:09:19 -04:00
50e1aaddcd
Merge pull request #76 from oshmoun/devel
Add option to allow installing deps from custom Poetry groups
2022-10-03 16:41:24 -04:00
Obeida Shamoun
d0efbd06b3
Add option to allow installing deps from custom Poetry groups 2022-10-01 20:25:41 +02:00
c435f1af69
Add --sync option to dev env install command in makefile target 2022-09-07 15:59:19 -04:00
817ae28a23
Update docs for 0.9 release 2022-09-07 15:45:55 -04:00
12c4ec62f2
Merge pull request #70 from Callek/callek/poetry-1.2.0b2
Basic changes to support poetry 1.2.0, no longer support Poetry 1.1.x
2022-09-07 15:44:29 -04:00
Justin Wood
73ddd43284
Change version to 0.9, address some review nits and use poetry 1.2 rather than pre-release. 2022-09-07 15:11:19 -04:00
Justin Wood
a181da95b3
Bump to poetry 1.2.0b3 2022-09-07 12:05:48 -04:00
Justin Wood
e8ce2f391b
Improve CI Workflow.
Bump action versions, use poetry 1.2.0b2, Use py310 for static tests, Use better naming for python tests.
2022-09-07 12:05:48 -04:00
Justin Wood
c8fd6e4fc0
Use py3.10 for security check too. 2022-09-07 12:05:48 -04:00
Justin Wood
22012d4452
Dedupe packages (with set()) earlier to improve logging and very slightly improve speed. 2022-09-07 12:05:48 -04:00
Justin Wood
17d0272089
Support [tool.poetry.group.dev.dependencies] as the newer alternative to [tool.poetry.dev-dependencies] 2022-09-07 12:05:47 -04:00
Justin Wood
b54bf44dc5
Basic changes to support poetry 1.2.0b2, no longer support Poetry 1.1.x 2022-09-07 12:05:44 -04:00
17885b50f7
Merge pull request #75 from enpaul/enp/bugfix
Fix poetry dependency spec to <1.2 for last 0.8 release
2022-09-06 16:36:49 -04:00
72c719c26c
Update changelog with version 0.8.5 2022-09-06 16:29:00 -04:00
5f30656683
Fix poetry dependency spec to <1.2 for last 0.8 release
Update pylint to >2.13 to fix security warning
2022-09-06 15:20:57 -04:00
b3a5e869ac
Fix docs recommending deprecated cli flag 2022-05-21 12:57:36 -04:00
afc94a5e01
Update changelog with 0.8.4 2022-04-25 19:36:05 -04:00
a9d29aea9f
Merge pull request #69 from enpaul/enp/py2
Fix ignoring multiple exclusive compatible package versions
2022-04-25 19:33:27 -04:00
45e33b7d27
Fix tests to use new packagemap type and data structure 2022-04-25 19:28:04 -04:00
ff3e1603d2
Bump patch version 2022-04-25 19:28:03 -04:00
fb65fa812e
Update dependency identification to account for multiple platforms
Fix an issue where packages that had two or more exclusive ranges for different python
versions would only be represented by the sequentially last version to appear in the
lockfile, causing compatibility issues with the older versions of that package.

Fixes #68
2022-04-25 19:28:03 -04:00
f08a18728e
Update lockfile 2022-04-07 00:03:23 -04:00
07027181ce
Remove default options from pylintrc 2022-01-08 23:48:05 -05:00
7400d1e3cd
Update copyright for the new year 2022-01-05 02:20:46 -05:00
a7e5020d5f
Update changelog with 0.8.3 2022-01-05 02:20:17 -05:00
015915adf7
Bump patch version for 3.10 classifier 2022-01-05 02:18:53 -05:00
a457cb99d2
Merge pull request #67 from enpaul/enp/ci
Update CI
2022-01-05 02:17:28 -05:00
1004a247b1
Remove tox version test requirement from stable feature list 2022-01-05 02:12:02 -05:00
f1f7a63774
Add toml typing stubs
Fix typing errors with new version of mypy
2022-01-05 02:12:02 -05:00
087db95c43
Update toxfile
Wrap long lines to improve readability
Update safety command to use --json flag instead of --bare flag
Update security env to skip package install
2022-01-05 02:12:02 -05:00
bb0db0fa1d
Add python 3.10 classifier 2022-01-05 02:12:02 -05:00
6ac16a5c4d
Update CI structure
Use new install-poetry script
Set path to include poetry directory
Use native poetry env management
2022-01-05 02:12:02 -05:00
7f8d27709a
Update black to latest beta 2022-01-05 01:00:34 -05:00
17a2e5af64
Fix usage of installed poetry version in CI 2021-12-04 12:49:15 -05:00
c05187f2e6
Update CI poetry installation to use new install-poetry script 2021-12-04 11:57:29 -05:00
5ccc56956b
Fix misinterpreted 3.10 version string as float 2021-12-04 11:45:16 -05:00
dae91a3a69
Update lockfile 2021-12-04 11:38:30 -05:00
2f35d83363
Add python3.10 to CI tests 2021-12-04 11:34:36 -05:00
bba0c54b70
Fix outdated documentation
Remove reference to deprecated --require-poetry option
Update developer docs to note that py3.7 or later is required
2021-12-04 11:33:24 -05:00
9d4e6d76fd
Update changelog with bugfix for #65 2021-10-28 20:24:20 -04:00
68af3a1075
Update license for new year
Update formatting
2021-10-28 20:21:41 -04:00
6384f289aa
Update docs with new error 2021-10-28 20:21:03 -04:00
1f6550e77c
Fix error when package under test depends directly on unsafe dependencies
Fixes #65
2021-10-28 20:09:56 -04:00
c322e68371
Merge pull request #63 from 9999years/more-install-logging
Add logging for package installation completion
2021-10-28 19:53:20 -04:00
Rebecca Turner
603cca6fd9
Update version to 0.8.2 2021-10-18 16:26:56 -04:00
Rebecca Turner
1478e35c0b
Add logging for package installation completion
Currently, tox-poetry-installer logs when it submits a dependency to the
(possibly-parallel) executor for installation, but not when the
installation is finished; this commit adds a log message when the
installation actually starts (in contrast with when the job is queued)
and a log message when the installation completes, along with the wall
time it took.

Rationale: I've noticed in some cases when running under Python 3.10
packages take much longer to install -- this logging should help
pinpoint culprits.
2021-07-07 15:27:46 -04:00
3c0b76a30f
Update changelog with 0.8.1 2021-06-16 22:47:19 -04:00
99db4c9ec0
Merge pull request #62 from enpaul/enp/61
Add three state boolean logic for install_project_deps config
2021-06-16 22:36:09 -04:00
7fc322419a
Bump patch version 2021-06-16 22:22:52 -04:00
5b91918bea
Update install_project_deps behavior to match docs
Update the functionality of the install_project_deps option to use three
state logic for config value.

Fixes #61
2021-06-16 22:22:08 -04:00
44b7238304
Remove deprecated runtime option from makefile 2021-05-05 22:32:04 -04:00
f2ab91603a
Merge pull request #60 from enpaul/enp/perf
Performance Boost
2021-05-05 22:25:34 -04:00
5188a30e77
Update CI to drop deprecated runtime option 2021-05-05 22:21:48 -04:00
26bbe13722
Update changelog with version 0.8 2021-05-05 22:17:30 -04:00
182fa24214
Add docs for project deps config option 2021-05-05 22:17:30 -04:00
6b84764d5d
Add option to disable installation of project dependencies
Fixes #53
2021-05-05 22:17:30 -04:00
d5def209f2
Bump feature version 2021-05-05 22:17:30 -04:00
c4bf9bec24
Update tests to use new installer value 2021-05-05 22:17:29 -04:00
e4139d9875
Update docs with new runtime option
Fix formatting in example path
2021-05-05 22:17:29 -04:00
dbbbf8186f
Update default setup to use parallelized dep installation
Move deprecation warnings to the precondition function
Deprecate --parallelize-locked-install option
Add --parallel-install-threads option
2021-05-05 22:17:29 -04:00
915233c529
Update makefile to use parallelized install 2021-04-19 23:56:21 -04:00
e745c7684a
Merge pull request #57 from enpaul/enp/meta
Update meta ahead of release
2021-04-19 23:53:32 -04:00
7152e4e94f
Update CI workflow to use parallelized install
Remove deprecated runtime option from CI
2021-04-19 23:48:38 -04:00
6d97919138
Update toxfile to use new config options
Remove unnecessarily duplicated config options
2021-04-19 23:47:32 -04:00
e99cf09caf
Update changelog with v0.7.0 2021-04-19 23:43:38 -04:00
1a5ba01c2f
Standardize package description 2021-04-19 23:39:32 -04:00
6d51d166a7
Bump feature version 2021-04-19 23:38:36 -04:00
bfcf8b14dd
Merge pull request #56 from enpaul/enp/req
Update require_poetry option to be available in the testenv settings
2021-04-19 23:37:11 -04:00
1f449c038f
Update badges 2021-04-19 23:32:26 -04:00
efdc2f7f26
Update documentation with new option details 2021-04-19 23:32:26 -04:00
c8d7009200
Update require_poetry option to be config option rather than runtime
Add deprecation warning for future removal of runtime require_poetry option
2021-04-19 23:32:25 -04:00
1e04edef69
Merge pull request #55 from enpaul/enp/docs
Overhaul documentation to improve readability (again)
2021-04-19 23:12:19 -04:00
cddfdba0ae
Overhaul documentation to improve readability (again) 2021-04-19 23:01:02 -04:00
a337ed8a97
Merge pull request #50 from enpaul/enp/tests
Add initial round of tests
2021-04-16 22:42:08 -04:00
d5f13ccea9
Fix toxfile config errors
Fix invalid path in pytest command causing coverage to fail to report
Fix missing dependency in static tests env
Fix misspelled config argument in static-tests and security envs
2021-04-16 22:35:32 -04:00
0b13ff508b
Fix linting errors and add docs to test functions 2021-04-16 22:35:32 -04:00
37cce37e05
Add tests for the transient dependency identification function 2021-04-16 22:35:32 -04:00
4d2c2e6297
Update unsafe packages set to use internal constant
One less thing that ties us to poetry proper
2021-04-16 22:35:31 -04:00
17a1ff1bc0
Add tests for the venv installation function 2021-04-16 22:34:48 -04:00
fc40c96954
Add test project and initial test fixtures 2021-04-16 22:34:48 -04:00
ab4fc1197f
Merge pull request #49 from enpaul/enp/log
Add internal logging wrapper to reduce copy/paste
2021-04-16 20:16:38 -04:00
f55f12b447
Update plugin modules to use internal logging wrapper 2021-04-16 20:12:27 -04:00
31e08c9475
Add internal logging wrapper to reduce copy/paste 2021-04-16 20:08:58 -04:00
9d06dbeba8
Merge pull request #47 from enpaul/enp/parallel
Add support for parallelizing installs
2021-04-16 18:14:02 -04:00
5e33af6eb2
Add config support for the parallelization functionality 2021-04-16 18:09:12 -04:00
06fcd56172
Add support to the installer for parallizing dependency installs 2021-04-16 18:01:00 -04:00
af40c5a87b
Merge pull request #46 from enpaul/enp/md
Update markdown formatting
2021-04-16 17:53:57 -04:00
51f4f33481
Add precommit hook for enforcing markdown format with mdformat 2021-04-16 02:06:30 -04:00
19828a92f0
Format markdown files with mdformat 2021-04-16 01:57:42 -04:00
17fc1bdef6
Add mdformat dependencies 2021-04-16 01:57:42 -04:00
4092a0da4b
Update changelog with v0.6.4 2021-02-15 22:44:56 -05:00
333bbe665f
Merge pull request #44 from enpaul/enp/resolver
Fix compatibility check failures in the core resolver
2021-02-15 22:36:08 -05:00
34454e1856
Fix function docstrings missing new parameters 2021-02-15 22:32:16 -05:00
41b6cfdf54
Add missing python3 classifier 2021-02-15 22:22:51 -05:00
65187eeac2
Bump patch version 2021-02-15 22:22:51 -05:00
7f0aeaf539
Update core dep resolution functionality to use poetry compat checks
Remove custom package compatibility checks
Add checks using poetry's built in package compatibility checking using markers
Update venv integration to use poetry's venv processing tools
Remove unused constants
2021-02-15 22:22:51 -05:00
d2779de848
Update changelog with v0.6.3 2021-02-10 00:35:55 -05:00
5dc5617000
Update readme badges to be prettier 2021-02-10 00:35:55 -05:00
ba5cd94b5e
Merge pull request #42 from enpaul/enp/bugs
Fix non-deterministic package installation order
2021-02-10 00:19:12 -05:00
a91364efd6
Bump patch version 2021-02-10 00:07:34 -05:00
e894a25d18
Update logging messages to improve UX and output consistency 2021-02-10 00:07:34 -05:00
08a6962d3f
General refactoring
Fix some pseudo-hungarian type notation
Fix out of date docstrings
Fix arbitrary argument ordering in function signatures
Remove interchangable usage of dep/dependency variable naming
Remove interchangable usage of packages/package_map for same data
2021-02-10 00:07:34 -05:00
b8ea98b3ad
Move install function to dedicated submodule
Fix duplicate package installs caused by using list for ordering
2021-02-10 00:07:34 -05:00
ea8bc3887e
Fix non-deterministic dependency order resolution
Unordered sets strike again. By casting a list of packages to a set
to ensure uniqueness the installation of the packages becomes non-deterministic.
This is not great, but it trivially breaks installing packages that require
their dependencies for installation.

Fixes #41
2021-02-10 00:07:33 -05:00
52c08e9dc5
Update import pattern to use tox module namespacing where possible 2021-02-10 00:07:33 -05:00
ee5df2f17a
Update pre-commit config to follow best practices
https://github.com/pre-commit/pre-commit/issues/1790
2021-02-09 20:20:47 -05:00
46b8fcc2a4
Update tox dependency spec from ^3.0 to ^3.8 for compatibility 2021-01-27 21:29:14 -05:00
469ce4c905
Update feature roadmap with latest changes 2021-01-27 18:05:58 -05:00
5b5896191f
Clarify local dev requirements 2021-01-27 18:04:02 -05:00
cc54e6243a
Add dev makefile target for setting up the local dev env 2021-01-27 18:00:24 -05:00
e3b3b19b31
Merge pull request #39 from enpaul/enp/bugfixes
Misc Bugfixes
2021-01-22 19:27:43 -05:00
99d6eedff1
Fix CI running all tox envs instead of targeted envs
Yaml formatting quirks strike again
2021-01-22 19:23:35 -05:00
ff09706648
Update changelog with v0.6.2 2021-01-22 19:18:54 -05:00
9ec64cf98f
Bump patch version 2021-01-22 19:13:42 -05:00
59bf9ad26e
Add precondition check for skipping tox self-provisioned env
Fixes #35
2021-01-22 19:13:42 -05:00
366c50ac87
Update transient dep resolution to always exclude root package name
Fixes #37
2021-01-22 19:13:42 -05:00
6e535f0f42
Merge pull request #38 from enpaul/enp/fix-ci
Fix CI Error
2021-01-22 18:39:07 -05:00
af66cd6d06
Fix changelog URL formatting 2021-01-22 18:28:12 -05:00
f6c8001546
Update py to 1.10+ to address CVE-2020-29651 2021-01-22 17:55:31 -05:00
b62e13afc7
Add link to changelog 2021-01-16 21:39:34 -05:00
c119e3b9d4
Add changelog
Fixes #36
2021-01-16 21:33:28 -05:00
0614913cc5
Merge pull request #34 from enpaul/enp/fix-unsafe
Fix unsafe dependency handling
2020-12-16 20:37:35 -05:00
f116ffefa2
Fix special handling of unsafe dependencies as primary dependencies 2020-12-16 20:31:41 -05:00
2ce97a5349
Bump patch version 2020-12-16 19:16:38 -05:00
e77c859355
Add additional logging to dependency processing functionality
Hopefully this will help with dependency resolution errors in the future
2020-12-16 19:14:03 -05:00
c1d1ac2de1
Update handling of poetrys unsafe dependencies to avoid keyerror
Fixes #33
2020-12-16 19:01:20 -05:00
c5c5261a80
Update transient processing to more narrowly scope error catching 2020-12-16 18:47:27 -05:00
ff344c2b4b
Merge pull request #32 from enpaul/enp/docs
Beta > Alpha
2020-12-05 18:37:24 -05:00
a7d9b25b62
Fix broken links in readme 2020-12-05 18:31:44 -05:00
8356d52c4f
Update project project status from alpha to beta 🎉 2020-12-05 18:31:44 -05:00
1941a103d3
Update contributor, devel, and roadmap documentation 2020-12-05 18:31:44 -05:00
0ad5fb7219
Overhaul basic usage documentation to improve clarity
Add intra document links
Update to document new/updated features
Add badge for downloads per month
Update badge order
2020-12-05 18:30:09 -05:00
ea518d1201
Reorder TOC
Add garbage to email to (hopefully) avoid scraping
2020-12-05 18:30:09 -05:00
03f46d34f3
Rewrite usage reference documentation to improve clarity
Add more details to error documentation
Update error and option documentation to be referenceable via slugs
Add docs for missing --require-poetry option
Add more crosslinks to assit with navigation
2020-12-05 18:30:09 -05:00
88ca772111
Merge pull request #31 from enpaul/enp/force-fail
Add option to support forcing tox failure when Poetry is not available
2020-12-05 15:11:31 -05:00
66c1925679
Add poetry requirement to local CI to ensure proper installation 2020-12-05 15:01:39 -05:00
99edc1c24e
Add runtime option for forcing error if poetry is not found 2020-12-05 15:01:39 -05:00
39439f132a
Merge pull request #30 from enpaul/enp/cleanup
Misc fixes ahead of push to beta classification
2020-12-05 14:19:18 -05:00
52aaeba93c
Overhaul CI to improve resilance and efficiency
Add caching for pip and poetry downloads to reduce runtime
Add pinned pip version
Add poetry installation of local project
Remove bare pip install for local project installation
2020-12-05 14:12:50 -05:00
db761d49c1
Add poetry extra install to tox config to support CI 2020-12-05 12:36:09 -05:00
5a23c05f17
Add internally proxied poetry module to support runtime in non-Poetry envs
Add the _poetry submodule to support importing Poetry internals at runtime rather
than import time. This allows the plugin to be run, and either skipped or errored,
without crashing tox
2020-12-04 22:16:36 -05:00
604e60d567
Bump feature version 2020-12-04 17:57:44 -05:00
872f6b0892
Update poetry dependency to be installed as optional extra
When running 'poetry remove tox-poetry-installer' in the same env as
poetry is installed to, poetry will uninstall itself. This is, obviously,
not ideal.

This change makes poetry an optional dependency so that the plugin can be
installed (and uninstalled) alongside poetry in the same env without
breaking the poetry installation. The intention is that the plugin can be
installed with the 'poetry' extra when being installed to an isolated environment
where poetry is not otherwise available.

This is a mitigation of Issue #2 as an alternative to vendorization of the enitre
poetry project 😬
2020-12-04 17:57:38 -05:00
afad7663f0
Fix clean target not deleting pycache 2020-12-04 17:22:52 -05:00
01635c50c7
Update logging integration to improve standardization
Standardize language in logging messages
Move system version to constants

Fixes #3
2020-12-04 17:22:41 -05:00
bd8124dcbf
Move non-hook function out of hooks submodule 2020-12-04 16:09:40 -05:00
4de5fea0e3
Merge pull request #29 from enpaul/enp/fix-platform
Fix dependency installation on incompatible platforms and with invalid python versions
2020-11-26 15:08:12 -05:00
33119df752
Add missing tests __init__ file
I'm tired of fighting this. Every tool under the sun wants the tests to
be an importable module, which doesn't make much sense to me, but it's
whatever. I'm just adding this because pylint, mypy, and others get
angry when I try to use them on just a directory without globbing
2020-11-26 15:01:59 -05:00
498cb4a3d2
Bump patch version 2020-11-26 14:54:34 -05:00
0a363d1848
Fix platform and py version compatibility errors
Add check for compatible python versions during dependency determination
Add check for compatible python platforms during dependency determination
Add verbosity2 logging messages for dependency determination
2020-11-26 14:54:34 -05:00
429992cff9
Bump patch version 2020-11-26 13:44:33 -05:00
216ee8b095
Fix exception when not installing project dependencies
Fix bug in precommit args
2020-11-26 13:43:33 -05:00
e96f4fb5e5
Add python3.9 tests to CI 2020-11-26 12:59:19 -05:00
eebd16383d
Add python3.9 to test and classifier lists 2020-11-26 12:54:14 -05:00
add4ec62eb
Update python requirement to ^3.6.1
Remove python specifiers from all deps that required >=3.6.1
2020-11-26 12:48:40 -05:00
0c25ca965e
Update pre-commit config to use poetry environment
Add precommit hook for checking for merge conflicts
Add dev dep for blacken-docs
Add dev dep for pre-commit-hooks
Update all precommit hooks to use system language
Update toxfile to use new dev deps
Fix tox vs. precommit conflicts with reorder-python-imports
2020-11-26 12:41:06 -05:00
6a5e955fce
Merge pull request #27 from enpaul/enp/unsafe
Refactor dep processing to improve efficiency of installation
2020-11-14 10:43:03 -05:00
d910b6ee8d
Refactor dep processing to improve efficiency of installation
Assemble single list of dependencies to reduce duplication and reduce installation overhead
2020-11-12 22:14:49 -05:00
e37c166a8b
Misc meta fixups
Fix dumping pypi API key to stdout when using "make publish" target
Fix outdated version in example output of docs
2020-11-12 21:13:55 -05:00
3d6d39eca8
Add note about installation via tox requires config option
Fixes #13
2020-11-12 21:12:38 -05:00
b9b0eba90f
Merge pull request #26 from enpaul/enp/fixups
Minor fixups ahead of 0.5 release
2020-11-12 19:47:09 -05:00
df8312f5ee
Bump feature version 2020-11-12 19:42:43 -05:00
1f102b16cb
Add blocking functionality when using require_locked_deps
When require_locked_deps is true further processing will be blocked because
a non-null value is returned by this function
2020-11-12 19:42:43 -05:00
a7cde7a9ab
Fix missing exception docs 2020-11-12 19:42:43 -05:00
b0bee11272
Merge pull request #25 from enpaul/enp/docs
Update documentation ahead of 0.5 release
2020-11-12 19:42:27 -05:00
accb4c3278
Update drawbacks section with new info 2020-11-12 19:31:31 -05:00
ea183553c4
Rewrite usage examples section into reference section
Fixes #20
2020-11-12 19:31:30 -05:00
5c5536581b
Update quickstart docs with new config option usage with locked_deps 2020-11-12 18:45:02 -05:00
b6ef671e67
Merge pull request #23 from enpaul/enp/faster
Update config handling to support tox's native env change detection
2020-11-12 18:19:21 -05:00
99c10482fc
Update tox config to use new plugin config option 2020-11-12 00:54:27 -05:00
b32a212e82
Restructure config options to support tox's native change detection
Remove custom handling of deps option
Add locked_deps option
Stop modifying the envconfig.deps option at runtime
2020-11-12 00:54:27 -05:00
b6415888d9
Merge pull request #24 from enpaul/enp/fix-ci
Fix automated CI
2020-11-12 00:52:18 -05:00
eba268a127
Update CI to include installation of this plugin
Not sure how I overlooked this
2020-11-12 00:44:12 -05:00
d8d483e849
Update to use poetry-core for PEP517 builds 2020-11-12 00:41:54 -05:00
c14313b7b0
Fix overlooked roadmap step that didn't get checked off 2020-11-12 00:32:22 -05:00
d1f161e0fa
Merge pull request #22 from enpaul/enp/recursive
Fix recursive dependencies causing recursion error
2020-11-12 00:26:22 -05:00
2961b55c9a
Fix recursive dependencies causing recursion error
Rewrite the find_dep_of_deps function to handle recursive dependencies
2020-11-11 23:07:14 -05:00
d4fb7046d8
Merge pull request #21 from enpaul/enp/modsplit
Split single-file module out into directory module
2020-11-11 22:49:30 -05:00
8c4e596316
Update tox automation to work with new module structure 2020-11-11 22:37:09 -05:00
50f6e3d151
Update dependencies to get cryptography security fix 2020-11-11 22:37:09 -05:00
106d1bf6cf
Update metadata tests to load metadata from new location 2020-11-11 22:37:09 -05:00
b57b78d4e2
Add typing stub file 2020-11-11 22:37:08 -05:00
33e81f742a
Split single module file out into directory module 2020-11-11 22:37:08 -05:00
3a262d718c
Merge pull request #19 from enpaul/enp/install-dev-deps
Add config option for installing dev dependencies to testenv
2020-10-29 17:28:39 -04:00
5979ec7a8a
Add documentation for new config option 2020-10-28 16:26:31 -04:00
c7bb3d35ea
Bump feature version 2020-10-24 12:10:07 -04:00
961e6f6acd
Add support for installing all dev dependencies to a testenv 2020-10-24 12:09:42 -04:00
ed039de674
Merge pull request #16 from enpaul/enp/fix
Fix support for extras installation
2020-10-24 11:55:35 -04:00
db0cf6ce0c
Bump patch version 2020-10-24 11:53:38 -04:00
e8d3f4fcac
Fix support for non-single extra dependency installation 2020-10-24 11:53:38 -04:00
653622fd35
Merge pull request #15 from enpaul/enp/housekeeping
Some housekeeping changes
2020-10-23 10:02:45 -04:00
de4c3515ec
Refactor to maintain consistent terminology
With a dozen different "dependency" types, consistent naming is critical
2020-10-23 00:59:43 -04:00
01bfdd74bd
Add missing documentation for internal functions/constants 2020-10-23 00:43:11 -04:00
3e98ec81eb
Update beta roadmap features list 2020-10-22 21:16:32 -04:00
b6534f86d0
Merge pull request #11 from enpaul/enp/extras
Add support for the extras option
2020-10-22 21:10:18 -04:00
74e3ed01c0
Fix handling of nonexistent extras with custom app exception 2020-10-22 21:07:56 -04:00
f944843278
Bump feature version 2020-10-22 21:07:55 -04:00
7c761073b3
Add poetry-core as explicit dependency to support poetry-1.0 2020-10-22 20:47:46 -04:00
6075ea6a3e
Update readme with development progress 2020-10-22 20:47:44 -04:00
fdee2d9a8d
Add support for extras tox configuration option
Install only non-optional project dependencies by default
Install dependencies for extras when specified

Fixes #4
2020-10-22 20:47:19 -04:00
699fb347da
Add links to other poetry tox plugins 2020-10-22 00:06:37 -04:00
a3bfd2687a
Remove obsoleted documentation from readme
Clarify developer poetry requirement
Work on #12
2020-10-22 00:03:19 -04:00
0bf3b16091
Merge pull request #10 from enpaul/enp/core
Support poetry core
2020-10-11 20:15:46 -04:00
979fa58618
Bump patch version 2020-10-11 20:11:42 -04:00
462cc166a9
Include tests in sdist 2020-10-11 20:11:42 -04:00
30160985c1
Update poetry imports to use core module 2020-10-11 20:11:42 -04:00
5d87ffac72
Update poetry requirement to support 1.1+ 2020-10-11 20:11:42 -04:00
6b92189e50
!fixup 2020-10-11 20:10:30 -04:00
0fbc77c2c4
Add CI status badge 2020-10-11 20:08:43 -04:00
7867a7c98b
Merge pull request #9 from enpaul/enp/ci
Add CI for PRs and CD for default branch
2020-10-11 20:03:12 -04:00
7a34c47168
Wrap test checks in bash to avoid globbing errors 2020-10-11 19:41:16 -04:00
4a1dc52755
Fix python version in pre-commit config 2020-10-11 19:41:16 -04:00
1e2156ecdb
Add CI for PRs and CD for default branch 2020-10-11 19:41:16 -04:00
707a73c922
Bump patch version 2020-09-29 19:01:59 -04:00
640dbfe102
Fix implicit case-sensitive locked dependency name handling
Fixes #7
2020-09-29 19:01:52 -04:00
05c5a26cc4
Update non-poetry error handling to be more permissive
Fixes #1
2020-09-29 19:01:43 -04:00
ee6f939b6a
Fix links to roadmap issues 2020-09-29 00:58:04 -04:00
82678e81e8
Add issue links for relevant roadmap items 2020-09-29 00:56:22 -04:00
5411025612
Proofreading and editing fixes
Check spelling more thoroughly
Improve clarity in a few places
Fix grammar mistakes
Fix docs that didn't get updated for the 0.2 overhaul
2020-09-29 00:51:08 -04:00
2e1d5fc922
Bump patch version 2020-09-28 23:26:19 -04:00
b7961bec58
Add support for running in a non-poetry project
Handle the error poetry raises when not in a poetry managed project
  and use that as a sign to skip further usage of the plugin in that
  environment
2020-09-28 23:24:42 -04:00
e28159060d
Add badge links
Add black code format badge
2020-09-27 20:59:41 -04:00
edcef918b3
Rename 'usage' section to 'usage examples' 2020-09-27 19:41:29 -04:00
beba9416be
Add note about root env setting inheritance breaking child envs 2020-09-27 19:38:42 -04:00
18a74fab63
Bump patch version 2020-09-27 15:57:00 -04:00
516515b347
Fix duplicate installation of env dependencies
Fix always logging post-sorted unlocked env dependencies
2020-09-27 15:56:29 -04:00
c9f1f41163
Fix installing package deps when skipdist is true 2020-09-27 15:56:29 -04:00
78efd82c82
Add quickstart section 2020-09-27 14:51:12 -04:00
5476f4ab11
Update example errors with new names, messages, and formatting 2020-09-27 14:45:11 -04:00
a4d1c1e4df
Add missing drawback about poetry unsafe dependencies
Add item to beta specification to fix/mitigate this somehow
2020-09-27 14:45:11 -04:00
fb1ac3b0de
Misc documentation updates
Fix inconsistent env naming in example ini snippets
Fix PS1 in demo commands to make it clearer what they are
Rename 'getting started' section to 'usage'
Add note about main branch and tag usage
2020-09-27 14:44:50 -04:00
c481b7b0bb
Update error handling to improve UX
Add discrete exception for version conflict vs not in lockfile errors
Update to set tox venv to failed when conflict happens
Update tox reporting for errors to use proper level
2020-09-27 14:17:15 -04:00
f20e434f2c
Overhaul usage documentation
Add better installation documentation
Add configuration examples and usage walk through using new design system
Update roadmap with feature changes for 0.2
Clarify drawbacks section with more useful context
2020-09-27 14:02:39 -04:00
10211bc674
Bump feature version 2020-09-26 10:48:10 -04:00
50c008d054
Require locked dependencies for all envs
Gotta dogfood sometime
2020-09-26 10:47:46 -04:00
476f27943e
Fix bug with dependency name modification
Standardize logging messages
2020-09-26 10:47:45 -04:00
8bb9255fc1
Implement new config interface system to expose more options
Default behavior is now to only install project package deps from lockfile
Specific env deps can be locked using @poetry suffix
Entire env can now be forced to use locked deps with require_locked_deps option
2020-09-26 10:46:38 -04:00
66f2c3c768
Bump patch version 2020-09-25 01:04:12 -04:00
fd2637113f
Remove excessive bandit output from security checks 2020-09-25 01:03:31 -04:00
b10e796ca1
Standardize log message usage of 'dev-package' and 'env' terminology 2020-09-25 01:02:30 -04:00
5dfbca4ff6
Update docs to indicate dev package installation support 2020-09-25 00:56:21 -04:00
db09acd8fe
Fix install of dev package dependencies from lockfile
Override default pip behavior by preemptively installing dev package dependencies
Keep support for tox default skip_install config flag
2020-09-25 00:54:45 -04:00
b339e3d6d9
Update poetry requirement to mitigate coming breaking API changes
Poetry 1.1 is due any day and when it does much of the functionality this
  module uses will be moved to poetry-core. Until this module is updated
  to use poetry-core 1.1 will be a breaking change
2020-09-25 00:38:20 -04:00
9db6838d94
Update logging calls to use the tox reporter 2020-09-24 23:56:36 -04:00
166fb7bbfc
Add publish make target to automate upload 2020-09-24 22:00:58 -04:00
0ab70f4c22
Add removal of overlooked temp assets to clean make target
Expand all flags to full version for future reference
2020-09-24 21:58:40 -04:00
31fc3e6bb1
Update toxfile with new environments and test automation
Add proper testenv with pytest command to run (currently trivial) tests
Update static and security envs to use variable for path identification
  * Avoids transversals and errors caused by different working dirs
Add static-tests env for enforcing quality checks on test files
Update security env to include test files
2020-09-24 21:58:39 -04:00
b95ad7a3a0
Update readme with completed trivial test step 2020-09-24 21:58:39 -04:00
4efd05e022
Bump patch version 2020-09-24 21:58:39 -04:00
d87dc0a660
Fix constant named for PEP440 that should be named for PEP508
Update author email to be consistent with pyproject
2020-09-24 21:58:39 -04:00
eed2038e63
Add trivial tests to ensure metadata consistency between pyroject and module 2020-09-24 21:58:39 -04:00
7d3fd324e5
Add pytest dev dependency for future test framework
Add toml dev dependency for reading the pyproject
Update dev dependency list to be alphabetized
2020-09-24 21:58:39 -04:00
f16dfdd182
Bump minor version 2020-09-23 23:32:26 -04:00
215ee011d3
Update problem and usecase description to reflect wider context
This version also not written at 3am
2020-09-23 23:30:25 -04:00
51386fba1a
Add roadmap section for beta and stable work 2020-09-23 23:30:25 -04:00
748eab5b76
Add code of conduct
Add contributing section to readme
2020-09-23 23:30:19 -04:00
308423a86c
Add table of contents
Add developing docs section
Add current limitations docs section
2020-09-23 23:29:57 -04:00
417747c332
Add basic usage instructions
Add badges
2020-09-23 21:43:41 -04:00
dc826df191
Add static and security check envs to toxfile 2020-09-23 20:37:00 -04:00
c9c750d5e4
Update module content to conform to code quality requirements
Add missing exception
Add missing docstrings
Lint and blacken
Fix broken handling of poetrys "unsafe" packages
2020-09-23 20:37:00 -04:00
deea0b9c7a
Add automation config files
Add coveragerc for upcoming pytest coverage
Add pre-commit config
Add makefile for automating common processes
2020-09-23 20:37:00 -04:00
9e28238b52
Add project dependencies and update pyproject meta
Add classifiers and keywords
Add dev dependencies
Add repo link
2020-09-23 20:37:00 -04:00
33 changed files with 4851 additions and 1058 deletions

7
.coveragerc Normal file
View File

@ -0,0 +1,7 @@
[run]
branch = True
[report]
exclude_lines =
\.\.\.
pass

34
.github/scripts/setup-env.sh vendored Executable file
View File

@ -0,0 +1,34 @@
#!/usr/bin/env bash
#
# Environment setup script for the local project. Intended to be used with automation
# to create a repeatable local environment for tests to be run in. The python env
# this script creates can be accessed at the location defined by the CI_VENV variable
# below.
set -e;
CI_CACHE=$HOME/.cache;
POETRY_VERSION=1.3.2;
mkdir --parents "$CI_CACHE";
command -v python;
python --version;
curl --location https://install.python-poetry.org \
--output "$CI_CACHE/install-poetry.py" \
--silent \
--show-error;
python "$CI_CACHE/install-poetry.py" \
--version "$POETRY_VERSION" \
--yes;
poetry --version --no-ansi;
poetry run pip --version;
poetry install \
--quiet \
--remove-untracked \
--no-ansi;
poetry env info;
poetry run tox --version;

91
.github/workflows/ci.yaml vendored Normal file
View File

@ -0,0 +1,91 @@
---
name: CI
on:
pull_request:
types: ["opened", "synchronize"]
push:
branches: ["devel"]
jobs:
Test:
name: Python ${{ matrix.python.version }}
runs-on: ubuntu-latest
strategy:
matrix:
python:
- version: "3.8"
toxenv: py38
- version: "3.9"
toxenv: py39
- version: "3.10"
toxenv: py310
- version: "3.11"
toxenv: py311
- version: "3.12"
toxenv: py312
fail-fast: true
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Python ${{ matrix.python.version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python.version }}
- name: Configure Job Cache
uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.cache/pypoetry/cache
~/.poetry
# Including the hashed poetry.lock in the cache slug ensures that the cache
# will be invalidated, and thus all packages will be redownloaded, if the
# lockfile is updated
key: ${{ runner.os }}-${{ matrix.python.toxenv }}-${{ hashFiles('**/poetry.lock') }}
- name: Configure Path
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Configure Environment
run: .github/scripts/setup-env.sh
- name: Run Toxenv ${{ matrix.python.toxenv }}
run: poetry run tox -e ${{ matrix.python.toxenv }}
Check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Configure Job Cache
uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.cache/pypoetry/cache
~/.poetry
# Hardcoded 'py310' slug here lets this cache piggyback on the 'py310' cache
# that is generated for the tests above
key: ${{ runner.os }}-py310-${{ hashFiles('**/poetry.lock') }}
- name: Configure Path
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Configure Environment
run: .github/scripts/setup-env.sh
- name: Run Static Analysis Checks
run: poetry run tox -e static
- name: Run Static Analysis Checks (Tests)
run: poetry run tox -e static-tests
- name: Run Security Checks
run: poetry run tox -e security

80
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,80 @@
---
# All of the pre-commit hooks here actually use the `pytyhon` pre-commit language
# setting. However, for the python language setting, pre-commit will create and manage
# a cached virtual environment for each hook ID and do a bare `pip install <repo>` into
# the venv to setup the hook. This can result in conflicting dependency versions between
# the version installed to the pre-commit venv and the version installed to the Poetry
# venv specified in the lockfile.
#
# The solution is to specify `language: system` for all hooks and then install the
# required dependencies to the Poetry venv. The `system` language skips the isolated
# venv creation and looks for the entrypoint specified by the hook in the global
# environment which, if running in the Poetry venv, will find the entrypoint provided
# by the Poetry-managed dependency.
#
repos:
- repo: local
hooks:
- id: end-of-file-fixer
name: end-of-file-fixer
entry: end-of-file-fixer
language: system
types:
- text
- id: fix-encoding-pragma
name: fix-encoding-pragma
entry: fix-encoding-pragma
language: system
args:
- "--remove"
types:
- python
- id: trailing-whitespace-fixer
name: trailing-whitespace-fixer
entry: trailing-whitespace-fixer
language: system
types:
- text
- id: check-merge-conflict
name: check-merge-conflict
entry: check-merge-conflict
language: system
types:
- text
- id: reorder-python-imports
name: reorder-python-imports
entry: isort
language: system
require_serial: true
types:
- python
args:
- "--filter-files"
- id: black
name: black
entry: black
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

54
.pylintrc Normal file
View File

@ -0,0 +1,54 @@
[MESSAGES CONTROL]
# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifiers separated by comma (,) or put this
# option multiple times (only on the command line, not in the configuration
# file where it should appear only once).You can also use "--disable=all" to
# disable everything first and then reenable specific checks. For example, if
# you want to run only the similarities checker, you can use "--disable=all
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
disable=logging-fstring-interpolation
,logging-format-interpolation
,line-too-long
,ungrouped-imports
,typecheck
,wrong-import-order
,wrong-import-position
[REPORTS]
# Set the output format. Available formats are text, parseable, colorized, json
# and msvs (visual studio).You can also give a reporter class, eg
# mypackage.mymodule.MyReporterClass.
output-format=colorized
[BASIC]
# Good variable names which should always be accepted, separated by a comma
good-names=_,ip,T
[MISCELLANEOUS]
# Not FIXME or TODO
notes=XXX
[SIMILARITIES]
# Ignore imports when computing similarities.
ignore-imports=yes
# Ignore function signatures when computing similarities.
ignore-signatures=yes
# Minimum lines number of a similarity.
min-similarity-lines=10
[DESIGN]
# Maximum number of arguments for function / method
max-args=7

389
CHANGELOG.md Normal file
View File

@ -0,0 +1,389 @@
# changelog
See also: [Github Release Page](https://github.com/enpaul/tox-poetry-installer/releases).
## Version 1.0.0 Beta 1
View this release on:
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/1.0.0b1),
[PyPI](https://pypi.org/project/tox-poetry-installer/1.0.0b1)
- Update Poetry compatibility to include >=1.5
- Update Tox compatibility to use Tox 4
- Remove support for Tox 3
- Remove deprecated `--require-poetry` command line option
- Remove deprecated `install_dev_deps` confguration option
- Remove deprecated `--parallelize-locked-install` command line option
## Version 0.10.3
View this release on:
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.10.3),
[PyPI](https://pypi.org/project/tox-poetry-installer/0.10.3/)
- Update Poetry requirement to exclude usage with incompatible 1.5 release
## Version 0.10.2
View this release on:
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.10.2),
[PyPI](https://pypi.org/project/tox-poetry-installer/0.10.2/)
- Update documentation with best practices and Poetry 1.2+ command syntax
- Fix failed install of sdist package not raising an exception in multi-threaded mode.
Contributed by [chriskuehl](https://github.com/chriskuehl) (#86)
## Version 0.10.1
View this release on:
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.10.1),
[PyPI](https://pypi.org/project/tox-poetry-installer/0.10.1/)
- Add PyPI classifier for Python-3.11 compatibility
- Add CI support for Python-3.11
- Add support for Poetry-1.3.x (#83)
## Version 0.10.0
View this release on:
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.10.0),
[PyPI](https://pypi.org/project/tox-poetry-installer/0.10.0/)
- Add `poetry_dep_groups` option to support installing groups of Poetry dependencies.
Contributed by [Oshmoun](https://github.com/oshmoun) (#76)
- Deprecate `install_dev_deps` option
## Version 0.9.0
View this release on:
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.9.0),
[PyPI](https://pypi.org/project/tox-poetry-installer/0.9.0/)
- Add support for Poetry-1.2.x. Contributed by [Justin Wood](https://github.com/Callek)
(#73)
- Update Black formatting to stable release version
- Remove support for Python-3.6
- Remove support for Poetry-1.1.x
- Fix installing dependencies multiple times when transient dependencies are duplicated in
the dependency tree
## Version 0.8.5
View this release on:
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.8.5),
[PyPI](https://pypi.org/project/tox-poetry-installer/0.8.5/)
- Fix Poetry version specification supporting the incompatible Poetry-1.2.0 release
## Version 0.8.4
View this release on:
[Github](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.8.4),
[PyPI](https://pypi.org/project/tox-poetry-installer/0.8.4/)
- Fix issue where incompatible package versions were selected for installation when
multiple package versions were in the lockfile
## 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) (#63).
- 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

116
CODE_OF_CONDUCT.md Normal file
View File

@ -0,0 +1,116 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our community a
harassment-free experience for everyone, regardless of age, body size, visible or
invisible disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal appearance,
race, religion, or sexual identity and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming, diverse,
inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our community include:
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes, and learning
from the experience
- Focusing on what is best not just for us as individuals, but for the overall community
Examples of unacceptable behavior include:
- The use of sexualized language or imagery, and sexual attention or advances of any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email address, without
their explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional
setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of acceptable
behavior and will take appropriate and fair corrective action in response to any behavior
that they deem inappropriate, threatening, offensive, or harmful.
Community leaders have the right and responsibility to remove, edit, or reject comments,
commits, code, wiki edits, issues, and other contributions that are not aligned to this
Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when an
individual is officially representing the community in public spaces. Examples of
representing our community include using an official e-mail address, posting via an
official social media account, or acting as an appointed representative at an online or
offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the
community leaders responsible for enforcement at \[INSERT CONTACT METHOD\]. All complaints
will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the reporter of
any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining the
consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing clarity
around the nature of the violation and an explanation of why the behavior was
inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series of actions.
**Consequence**: A warning with consequences for continued behavior. No interaction with
the people involved, including unsolicited interaction with those enforcing the Code of
Conduct, for a specified period of time. This includes avoiding interactions in community
spaces as well as external channels like social media. Violating these terms may lead to a
temporary or permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including sustained
inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public communication with
the community for a specified period of time. No public or private interaction with the
people involved, including unsolicited interaction with those enforcing the Code of
Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community standards,
including sustained inappropriate behavior, harassment of an individual, or aggression
toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
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/translations.
[homepage]: https://www.contributor-covenant.org

View File

@ -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.

40
Makefile Normal file
View File

@ -0,0 +1,40 @@
# tox-poetry-installer makefile
.PHONY: help
# Put it first so that "make" without argument is like "make help"
# Adapted from:
# https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
help: ## List Makefile targets
$(info Makefile documentation)
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-10s\033[0m %s\n", $$1, $$2}'
clean-tox:
rm --recursive --force ./.mypy_cache
rm --recursive --force ./.tox
rm --recursive --force tests/__pycache__/
rm --recursive --force .pytest_cache/
rm --force .coverage
clean-py:
rm --recursive --force ./dist
rm --recursive --force ./build
rm --recursive --force ./*.egg-info
rm --recursive --force ./**/__pycache__/
clean: clean-tox clean-py; ## Clean temp build/cache files and directories
wheel: ## Build Python binary distribution wheel package
poetry build --format wheel
source: ## Build Python source distribution package
poetry build --format sdist
test: ## Run the project testsuite(s)
poetry run tox --recreate --parallel
dev: ## Create the local dev environment
poetry install --extras poetry --sync
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)

430
README.md
View File

@ -1,62 +1,408 @@
# tox-poetry-installer # tox-poetry-installer
A [Tox](https://tox.readthedocs.io/en/latest/) plugin for installing Tox environment A plugin for [Tox](https://tox.readthedocs.io/en/latest/) that lets you install test
dependencies using [Poetry](https://python-poetry.org/) from the Poetry lockfile. environment dependencies from the [Poetry](https://python-poetry.org/) lockfile.
⚠️ **This project is a very, very early prototype and should not be used in any production [![CI Status](https://github.com/enpaul/tox-poetry-installer/workflows/CI/badge.svg?event=push)](https://github.com/enpaul/tox-poetry-installer/actions)
capacity.** [![PyPI Version](https://img.shields.io/pypi/v/tox-poetry-installer)](https://pypi.org/project/tox-poetry-installer/)
[![PyPI Downloads](https://img.shields.io/pypi/dm/tox-poetry-installer)](https://libraries.io/pypi/tox-poetry-installer)
[![License](https://img.shields.io/pypi/l/tox-poetry-installer)](https://opensource.org/licenses/MIT)
[![Python Supported Versions](https://img.shields.io/pypi/pyversions/tox-poetry-installer)](https://www.python.org)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
⚠️ **This project is beta software and is under active development** ⚠️
## Why would I use this? ## Documentation
[The point of using a lockfile is to create reproducable builds](https://docs.gradle.org/current/userguide/dependency_locking.html). One of the main points of Tox is to [allow a Python - [Feature Overview](#feature-overview)
package to be built and tested in multiple environments](https://tox.readthedocs.io/en/latest/#what-is-tox). However, in the Tox configuration file the dependencies are specified with - [Using the Plugin](#user-documentation)
standard dynamic ranges and passed directly to Pip. This means that the reproducability - [Installing](#installing)
a lockfile brings to a project is circumvented when running the tests. - [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)
- [Using with an unmanaged Poetry installation](#using-with-an-unmanaged-poetry-installation)
- [Developing the Plugin](#developer-documentation)
- [Road Map](#road-map)
The obvious solution to this problem is to add the dependencies required for testing to the See the
lockfile as development dependencies so that they are locked along with the primary dependencies [Changelog](https://github.com/enpaul/tox-poetry-installer/blob/devel/CHANGELOG.md) for
of the project. The only remaining question however, is how to install the dev-dependencies from release history.
the lockfile into the Tox environment when Tox sets it up. [For very good reason](https://dev.to/elabftw/stop-using-sudo-pip-install-52mn) Tox uses independent
[virtual environments](https://docs.python.org/3/tutorial/venv.html) for each environment a
project defines, so there needs to be a way to install a locked dependency into a Tox
environment.
This is where this plugin comes in. *See also: [official Tox plugins](https://tox.readthedocs.io/en/latest/plugins.html) and
[the official Poetry documentation on using Tox](https://python-poetry.org/docs/faq/#is-tox-supported)*
Traditionally Tox environments specify dependencies and their corresponding versions inline in ## Feature Overview
[PEP-440](https://www.python.org/dev/peps/pep-0440/) format like below:
- 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 or custom groups 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.
## User Documentation
*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)*
### Installing
The recommended way to install the plugin is to add it to a project using Poetry:
```bash
poetry add -G dev tox-poetry-installer[poetry]
```
> **Note:** Always install the plugin with the `[poetry]` extra, unless you are
> [managing the Poetry installation yourself](#externally-managed-poetry-installation).
Alternatively, it can be installed directly to a virtual environment using Pip, though
this is not recommended:
```bash
source somevenv/bin/activate
pip install tox-poetry-installer
```
Alternatively alternatively, it can be installed using the Tox
[`requires`](https://tox.readthedocs.io/en/latest/config.html#conf-requires) option by
adding the below to `tox.ini`, though this is also not recommended:
```ini
requires =
tox-poetry-installer[poetry] == 0.10.2
```
After installing, check that Tox recognizes the plugin by running
`poetry run tox --version`. The command should give output similar to below:
```
3.20.0 imported from .venv/lib64/python3.10/site-packages/tox/__init__.py
registered plugins:
tox-poetry-installer-0.10.2 at .venv/lib64/python3.10/site-packages/tox_poetry_installer/__init__.py
```
### Quick Start
Congratulations! 🎉 Just by installing the plugin your Tox config is already using locked
dependencies: when Tox builds and installs your project package to a test environment,
your project package's dependencies will be installed from the lockfile.
Now lets update an example `tox.ini` to install the other test environment dependencies
from the lockfile.
A `testenv` from the example `tox.ini` we're starting with is below:
```ini ```ini
[testenv] [testenv]
description = Run the tests description = Some very cool tests
deps = deps =
foo == 1.2.3 black == 20.8b1
bar >=1.3,<2.0 pylint >=2.4.4,<2.7.0
baz mypy <0.800
commands = ...
``` ```
This runs into the problem outlined above: many different versions of the `bar` dependency To update the config so that the testenv dependencies are installed from the lockfile, we
could be installed depending on what the latest version is that matches the defined range. The can replace the built-in
`baz` dependency is entirely unpinned making it a true wildcard, and even the seemingly static [`deps`](https://tox.readthedocs.io/en/latest/config.html#conf-deps) option with the
`foo` dependency could result in subtly different files being downloaded depending on what's `locked_deps` option provided by the plugin, and then remove the inline version
available in the upstream mirrors. 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:
However these same versions, specified in the [pyproject.toml](https://snarky.ca/what-the-heck-is-pyproject-toml/) file, result in reproducible ```ini
installations when using `poetry install` because they each have a specific version and file [testenv]
hash specified in the lockfile. The versions specified in the lockfile are updated only when description = Some very cool tests
`poetry update` is run. locked_deps =
black
pylint
mypy
commands = ...
```
This plugin allows environment dependencies to be specified in the [tox.ini](https://tox.readthedocs.io/en/latest/config.html) configuration file We can also add the `require_locked_deps` option to the test environment. This will both
just by name. The package is automatically retrieved from the lockfile and the Poetry backend block any other install tools (another plugin or Tox itself) from installing dependencies
is used to install the singular locked package version to the Tox environment. When the to the Tox environment and also cause Tox to fail if the test environment also uses the
lockfile is updated, the Tox environment will automatically install the newly locked package built-in [`deps`](https://tox.readthedocs.io/en/latest/config.html#conf-deps) option:
as well. All dependency requirements are specified in one place (pyproject.toml), all
dependencies have a locked version, and everything is installed from that source of truth.
```ini
[testenv]
description = Some very cool tests
require_locked_deps = true
locked_deps =
black
pylint
mypy
commands = ...
```
## Planned features > **Note:** Settings configured on the main `testenv` environment are inherited by
> child test environments (for example, `testenv:foo`). To override this, specify the
> setting in the child environment with a different value.
* Per-environment disabling (i.e. fallback to the default Tox installation backend) Alternatively, we can skip specifying all of our dependencies for a test environment in
* Detection of lockfile changes that trigger Tox environment recreation the Tox config and install Poetry dependency groups directly:
* Tests
```ini
[testenv]
description = Some very cool tests
require_locked_deps = true
poetry_dep_groups =
dev
commands = ...
```
> **Note:** The `install_dev_deps` configuration option is deprecated. See
> [Configuration Options](#configuration-options) for more information.
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
All options listed below are Tox environment options and can be applied to one or more
environment sections of the `tox.ini` file. They cannot be applied to the global Tox
configuration section.
> **Note:** Settings configured on the main `testenv` environment are inherited by
> child test environments (for example, `testenv:foo`). To override this, specify the
> setting in the child environment with a different value.
| 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_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. |
| `poetry_dep_groups` | List | `[]` | Names of Poetry dependency groups specified in `pyproject.toml` to install to the test environment. |
### Runtime Options
All arguments listed below can be passed to the `tox` command to modify runtime behavior
of the plugin.
| 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. |
### Errors
There are several errors that the plugin can encounter for a test environment when Tox is
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.
| Status/Name | Cause |
| :------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `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`. |
| `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`). |
| `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 `require_poetry = true` was specified. |
> **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.
### Other Notes
#### Unsupported Tox config options
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.
> **Note:** The unsupported Tox config options will still apply to unlocked
> dependencies being installed with the default Tox installation backend.
- [`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)
#### Updating locked dependencies in a testenv
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.
However, the plugin cannot determine when the lockfile is updated. If a Tox test
environment has already been created then it will need to be recreated (using Tox's
built-in
[`--recreate`](https://tox.readthedocs.io/en/latest/example/basic.html#forcing-re-creation-of-virtual-environments)
option) for the new version to be found and installed.
> **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.
#### Using with an unmanaged Poetry installation
In CI/CD systems, automation environments, or other Python environments where the loaded
site packages are not managed by Poetry, it can be useful to manage the local installation
of Poetry externally. This also helps to avoid problems that can be caused by the
`--no-root`, `--without dev`, or `--sync` 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`.
> ⚠️ **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.
To skip installing the `poetry` package as a dependency of `tox-poetry-installer`, do not
specify the `poetry` extra when adding the plugin:
```bash
# Adding the package without the "[poetry]" extra specifier so that
# Poetry is not added as a transient dev-dependency:
poetry add -G dev tox-poetry-installer
# Adding the package with the "[poetry]" extra specifier, so the Poetry
# package will be added to the environment and tracked in the lockfile:
poetry add -G dev tox-poetry-installer[poetry]
```
Once the plugin is installed- either with or without the Poetry extra- you can validate
that the plugin will run correctly with the following command. This command checks that
all three required components (Tox, Poetry, and the plugin itself) are available in the
current Python environment:
```bash
python -c '\
import tox;\
import tox_poetry_installer;\
from poetry.poetry import Poetry;\
'
```
> **Note:** To force Tox to fail if Poetry is not installed, add the
> `require_poetry = true` option to the tox `[testenv]` configuration. See the
> [Config Options](#configuration-options) for more information.
## Developer Documentation
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 (and potentially unstable) changes. The stable releases
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).
- 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.10+](https://www.python.org/downloads/) and
[Poetry 1.4](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
# Clone the repository...
# ...over HTTPS
git clone https://github.com/enpaul/tox-poetry-installer.git
# ...over SSH
git clone git@github.com:enpaul/tox-poetry-installer.git
cd tox-poetry-installer/
# Create and configure the local development environment
make dev
# Run tests and CI locally
make test
# See additional make targets
make help
```
> **Note:** The pre-commit hooks require dependencies in the Poetry environment to run.
> To make a commit with the pre-commit hooks, you will need to run `poetry run git commit`
> or, alternatively,
> [launch an environment shell](https://python-poetry.org/docs/cli/#shell).
## Road Map
This project is under active development and is classified as beta software, ready for
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)
- Stable classification will be assigned when the test suite covers an acceptable number
of use cases
### Path to Beta
- [x] Verify that primary package dependencies (from the `.package` env) are installed
correctly using the Poetry backend.
- [x] Support the [`extras`](https://tox.readthedocs.io/en/latest/config.html#conf-extras)
Tox 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
backend.
- [ ] ~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))
- [x] Add trivial tests to ensure the project metadata is consistent between the
pyproject.toml and the module constants.
- [x] Update to use [poetry-core](https://github.com/python-poetry/poetry-core) and
improve robustness of the Tox and Poetry module imports to avoid potentially breaking
API changes 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.~ ([#6](https://github.com/enpaul/tox-poetry-installer/issues/6))
- [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
Everything in Beta plus...
- [ ] Fully replace dependency on `poetry` with dependency on `poetry-core`
([#2](https://github.com/enpaul/tox-poetry-installer/issues/2))
- [x] Add comprehensive unit tests
- [ ] ~Add tests for each feature version of Tox between 3.8 and 3.20~
- [x] Add tests for Python-3.6, 3.7, 3.8, and 3.9
- [x] Add Github Actions based CI

2944
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +1,69 @@
[tool.poetry] [tool.poetry]
name = "tox-poetry-installer" name = "tox-poetry-installer"
version = "0.1.0" version = "1.0.0b1"
description = "Tox plugin to install Tox environment dependencies using the Poetry backend and lockfile"
authors = ["Ethan Paul <e@enp.one>"]
license = "MIT" license = "MIT"
authors = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"]
description = "A plugin for Tox that lets you install test environment dependencies from the Poetry lockfile"
repository = "https://github.com/enpaul/tox-poetry-installer/"
packages = [
{include = "tox_poetry_installer"},
{include = "tests/*.py", format = "sdist"}
]
include = [
"tox_poetry_installer/py.typed"
]
keywords = ["tox", "poetry", "plugin"]
readme = "README.md"
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Plugins",
"Framework :: tox",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
]
[tool.poetry.plugins.tox] [tool.poetry.plugins.tox]
poetry_installer = "tox_poetry_installer" poetry_installer = "tox_poetry_installer"
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.6" python = "^3.8"
poetry = "^1.0.10" cleo = ">=1.0,<3.0"
pluggy = "^0.13.1" poetry = "^1.5.0"
poetry-semver = "^0.1.0" poetry-core = "^1.1.0"
requests = "2.22.0" tox = "^4.1"
[tool.poetry.dev-dependencies] [tool.poetry.group.dev.dependencies]
ipython = {version = "^7.18.1", python = "^3.7"} bandit = {version = "^1.7.7", python = "^3.10"}
tox = "^3.20.0" black = {version = "^24.3.0", python = "^3.10"}
mypy = "^0.782" blacken-docs = {version = "^1.18.0", python = "^3.10"}
ipython = {version = "^8.10.1", python = "^3.10"}
isort = {version = "^5.13.2", python = "^3.10"}
mdformat = {version = "^0.7", python = "^3.10"}
mdformat-gfm = {version = "^0.3", python = "^3.10"}
mypy = {version = "^1.11.1", python = "^3.10"}
pre-commit = {version = "^3.8.0", python = "^3.10"}
pre-commit-hooks = {version = "^4.6.0", python = "^3.10"}
pylint = {version = "^3.2.6", python = "^3.10"}
pytest = {version = "^8.3.2", python = "^3.10"}
pytest-cov = {version = "^5.0.0", python = "^3.10"}
toml = {version = "^0.10.1", python = "^3.10"}
tox = "^4.1"
types-toml = {version = "^0.10.1", python = "^3.10"}
[tool.isort]
profile = "black"
force_single_line = "true"
lines_after_imports = 2
[build-system] [build-system]
requires = ["poetry>=1.0.0"] requires = ["poetry-core>=1.1.0"]
build-backend = "poetry.masonry.api" build-backend = "poetry.core.masonry.api"

0
tests/__init__.py Normal file
View File

71
tests/fixtures.py Normal file
View File

@ -0,0 +1,71 @@
# pylint: disable=missing-module-docstring,missing-function-docstring,unused-argument,too-few-public-methods,protected-access
import time
from pathlib import Path
from typing import List
import poetry.factory
import poetry.installation.executor
import poetry.installation.operations.operation
import poetry.utils.env
import pytest
import tox.tox_env.python.virtual_env.runner
import tox_poetry_installer.hooks._tox_on_install_helpers
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`"""
def __init__(self, *args, **kwargs):
self.env_dir = FAKE_VENV_PATH
self.installed = []
@staticmethod
def is_valid_for_marker(*args, **kwargs):
return True
@staticmethod
def get_version_info():
return (1, 2, 3)
class MockExecutor:
"""Mock class for the :class:`poetry.installation.executor.Executor`"""
def __init__(self, env: MockVirtualEnv, **kwargs):
self.env = env
def execute(
self, operations: List[poetry.installation.operations.operation.Operation]
):
self.env.installed.extend([operation.package for operation in operations])
time.sleep(1)
@pytest.fixture
def mock_venv(monkeypatch):
monkeypatch.setattr(
tox_poetry_installer.hooks._tox_on_install_helpers,
"convert_virtualenv",
lambda venv: venv,
)
monkeypatch.setattr(poetry.installation.executor, "Executor", MockExecutor)
monkeypatch.setattr(
tox.tox_env.python.virtual_env.runner, "VirtualEnvRunner", MockVirtualEnv
)
monkeypatch.setattr(poetry.utils.env, "VirtualEnv", MockVirtualEnv)
@pytest.fixture(scope="function")
def mock_poetry_factory(monkeypatch):
project = poetry.factory.Factory().create_poetry(cwd=TEST_PROJECT_PATH)
def mock_factory(*args, **kwargs):
return project
monkeypatch.setattr(poetry.factory.Factory, "create_poetry", mock_factory)

505
tests/test-project/poetry.lock generated Normal file
View 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"},
]

View 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"

97
tests/test_installer.py Normal file
View File

@ -0,0 +1,97 @@
# pylint: disable=missing-module-docstring,redefined-outer-name,unused-argument,unused-import,protected-access
import time
from unittest import mock
import poetry.factory
import poetry.installation.executor
import pytest
import tox.tox_env.python.virtual_env.runner
import tox_poetry_installer.hooks._tox_on_install_helpers
from .fixtures import mock_poetry_factory
from .fixtures import mock_venv
def test_deduplication(mock_venv, mock_poetry_factory):
"""Test that the installer does not install duplicate dependencies"""
project = poetry.factory.Factory().create_poetry(None)
packages: tox_poetry_installer.hooks._tox_on_install_helpers.PackageMap = {
item.name: item for item in project.locker.locked_repository().packages
}
venv = tox.tox_env.python.virtual_env.runner.VirtualEnvRunner()
to_install = [packages["toml"], packages["toml"]]
tox_poetry_installer.hooks._tox_on_install_helpers.install_package(
project, 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"""
project = poetry.factory.Factory().create_poetry(None)
packages: tox_poetry_installer.hooks._tox_on_install_helpers.PackageMap = {
item.name: item for item in project.locker.locked_repository().packages
}
to_install = [
packages["toml"],
packages["toml"],
packages["tox"],
packages["requests"],
packages["python-dateutil"],
packages["attrs"],
]
venv_sequential = tox.tox_env.python.virtual_env.runner.VirtualEnvRunner()
start_sequential = time.time()
tox_poetry_installer.hooks._tox_on_install_helpers.install_package(
project, venv_sequential, to_install, 0
)
sequential = time.time() - start_sequential
venv_parallel = tox.tox_env.python.virtual_env.runner.VirtualEnvRunner()
start_parallel = time.time()
tox_poetry_installer.hooks._tox_on_install_helpers.install_package(
project, 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))
@pytest.mark.parametrize("num_threads", (0, 8))
def test_propagates_exceptions_during_installation(
mock_venv, mock_poetry_factory, num_threads
):
"""Assert that an exception which occurs during installation is properly raised.
Regression test for https://github.com/enpaul/tox-poetry-installer/issues/86
"""
project = poetry.factory.Factory().create_poetry(None)
packages: tox_poetry_installer.hooks._tox_on_install_helpers.PackageMap = {
item.name: item for item in project.locker.locked_repository().packages
}
to_install = [packages["toml"]]
venv = tox.tox_env.python.virtual_env.runner.VirtualEnvRunner()
fake_exception = ValueError("my testing exception")
with mock.patch.object(
poetry.installation.executor,
"Executor",
**{"return_value.execute.side_effect": fake_exception},
):
with pytest.raises(ValueError) as exc_info:
tox_poetry_installer.hooks._tox_on_install_helpers.install_package(
project, venv, to_install, num_threads
)
assert exc_info.value is fake_exception

38
tests/test_metadata.py Normal file
View File

@ -0,0 +1,38 @@
"""Ensure that the pyproject and module metadata never drift out of sync
The next best thing to having one source of truth is having a way to ensure all of your
sources of truth agree with each other.
"""
from pathlib import Path
import toml
from tox_poetry_installer import __about__
def test_metadata():
"""Test that module metadata matches pyproject poetry metadata"""
with (Path(__file__).resolve().parent / ".." / "pyproject.toml").open() as infile:
pyproject = toml.load(infile, _dict=dict)
assert pyproject["tool"]["poetry"]["name"] == __about__.__title__
assert pyproject["tool"]["poetry"]["version"] == __about__.__version__
assert pyproject["tool"]["poetry"]["license"] == __about__.__license__
assert pyproject["tool"]["poetry"]["description"] == __about__.__summary__
assert pyproject["tool"]["poetry"]["repository"] == __about__.__url__
assert (
all(
item in __about__.__authors__
for item in pyproject["tool"]["poetry"]["authors"]
)
is True
)
assert (
all(
item in pyproject["tool"]["poetry"]["authors"]
for item in __about__.__authors__
)
is True
)

79
tests/test_transients.py Normal file
View File

@ -0,0 +1,79 @@
# pylint: disable=missing-module-docstring,redefined-outer-name,unused-argument,unused-import,protected-access
import poetry.factory
import poetry.utils.env
import pytest
import tox_poetry_installer.hooks._tox_on_install_helpers
from tox_poetry_installer import exceptions
from .fixtures import mock_poetry_factory
from .fixtures import mock_venv
def test_allow_missing():
"""Test that the ``allow_missing`` parameter works as expected"""
with pytest.raises(exceptions.LockedDepNotFoundError):
tox_poetry_installer.hooks._tox_on_install_helpers.identify_transients(
"luke-skywalker", {}, None
)
assert not tox_poetry_installer.hooks._tox_on_install_helpers.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):
tox_poetry_installer.hooks._tox_on_install_helpers.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.
"""
project = poetry.factory.Factory().create_poetry(None)
packages = tox_poetry_installer.hooks._tox_on_install_helpers.build_package_map(
project
)
venv = poetry.utils.env.VirtualEnv() # pylint: disable=no-value-for-parameter
requests_requires = [
packages["certifi"][0],
packages["chardet"][0],
packages["idna"][0],
packages["urllib3"][0],
packages["requests"][0],
]
transients = tox_poetry_installer.hooks._tox_on_install_helpers.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"][0], packages["tox"][0], packages["flask"][0]]:
transients = (
tox_poetry_installer.hooks._tox_on_install_helpers.identify_transients(
package.name, packages, venv
)
)
assert transients[-1] == package
assert len(transients) == len(set(transients))

82
tox.ini
View File

@ -1,11 +1,79 @@
[tox] [tox]
envlist = py38 envlist = py3{8,9,10,11,12} static, static-tests, security
isolated_build = true skip_missing_interpreters = true
[testenv] [testenv]
description = Run the tests (pytest) description = Run the tests
deps = require_locked_deps = true
requests require_poetry = true
skip_install = true locked_deps =
pytest
pytest-cov
toml
commands = commands =
pip freeze pytest {toxinidir}/tests/ \
--cov {toxinidir}/tox_poetry_installer \
--cov-config {toxinidir}/.coveragerc \
--cov-report term-missing
[testenv:static]
description = Static formatting and quality enforcement
basepython = py310
platform = linux
ignore_errors = true
locked_deps =
black
blacken-docs
isort
mdformat
mdformat-gfm
mypy
pre-commit
pre-commit-hooks
pylint
types-toml
commands =
pre-commit run \
--all-files
pylint {toxinidir}/tox_poetry_installer/ \
--rcfile {toxinidir}/.pylintrc
mypy {toxinidir}/tox_poetry_installer/ \
--ignore-missing-imports \
--no-strict-optional
[testenv:static-tests]
description = Static formatting and quality enforcement for the tests
basepython = py310
platform = linux
ignore_errors = true
locked_deps =
pylint
pytest
mypy
toml
types-toml
commands =
pylint {toxinidir}/tests/ \
--rcfile {toxinidir}/.pylintrc
mypy {toxinidir}/tests/ \
--ignore-missing-imports \
--no-strict-optional
[testenv:security]
description = Security checks
basepython = py310
platform = linux
ignore_errors = true
skip_install = true
locked_deps =
bandit
safety
poetry
commands =
bandit {toxinidir}/tox_poetry_installer/ \
--recursive \
--quiet
bandit {toxinidir}/tests/ \
--recursive \
--quiet \
--skip B101

View File

@ -1,78 +0,0 @@
from pathlib import Path
import logging
from typing import Dict, List
from poetry.factory import Factory
from poetry.factory import Poetry
from poetry.packages import Package
from poetry.installation.pip_installer import PipInstaller
from poetry.io.null_io import NullIO
from poetry.utils.env import VirtualEnv
from tox.action import Action as ToxAction
from tox.venv import VirtualEnv as ToxVirtualEnv
from tox import hookimpl
__title__ = "tox-poetry-installer"
__summary__ = "Tox plugin to install Tox environment dependencies using the Poetry backend and lockfile"
__version__ = "0.1.0"
__url__ = "https://github.com/enpaul/tox-poetry-installer/"
__license__ = "MIT"
__authors__ = ["Ethan Paul <e@enp.one>"]
def _make_poetry(venv: ToxVirtualEnv) -> Poetry:
return Factory().create_poetry(venv.envconfig.config.toxinidir)
def _find_locked_dependencies(poetry: Poetry, dependency_name: str) -> List[Package]:
packages: Dict[str, Package] = {
package.name: package
for package in poetry.locker.locked_repository(True).packages
}
try:
top_level = packages[dependency_name]
except KeyError:
raise
def find_transients(name: str) -> List[Package]:
transients = [packages[name]]
for dep in packages[name].requires:
transients += find_transients(dep.name)
return transients
return find_transients(top_level.name)
@hookimpl
def tox_testenv_install_deps(venv: ToxVirtualEnv, action: ToxAction):
logger = logging.getLogger(__name__)
if action.name == venv.envconfig.config.isolated_build_env:
logger.debug(f"Environment {action.name} is isolated build environment; skipping Poetry-based dependency installation")
return None
poetry = _make_poetry(venv)
logger.debug(f"Loaded project pyproject.toml from {poetry.file}")
dependencies = []
for env_dependency in venv.envconfig.deps:
dependencies += _find_locked_dependencies(poetry, env_dependency.name)
logger.debug(f"Identified {len(dependencies)} dependencies for environment {action.name}")
installer = PipInstaller(
env=VirtualEnv(path=Path(venv.envconfig.envdir)),
io=NullIO(),
pool=poetry.pool
)
for dependency in dependencies:
logger.info(f"Installing environment dependency: {dependency}")
installer.install(dependency)
return dependencies

View File

@ -0,0 +1,7 @@
# pylint: disable=missing-docstring
__title__ = "tox-poetry-installer"
__summary__ = "A plugin for Tox that lets you install test environment dependencies from the Poetry lockfile"
__version__ = "1.0.0b1"
__url__ = "https://github.com/enpaul/tox-poetry-installer/"
__license__ = "MIT"
__authors__ = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"]

View File

@ -0,0 +1,4 @@
# pylint: disable=missing-docstring
from tox_poetry_installer.hooks import tox_add_env_config
from tox_poetry_installer.hooks import tox_add_option
from tox_poetry_installer.hooks import tox_on_install

View File

@ -0,0 +1,23 @@
"""Static constants for reference
Rule of thumb: if it's an arbitrary value that will never be changed at runtime, it should go
in this module.
All constants should be type hinted.
"""
from typing import Tuple
from tox_poetry_installer import __about__
# Valid PEP508 version delimiters. These are used to test whether a given string (specifically a
# dependency name) is just a package name or also includes a version identifier.
PEP508_VERSION_DELIMITERS: Tuple[str, ...] = ("~=", "==", "!=", ">", "<")
# Prefix all reporter messages should include to indicate that they came from this module in the
# console output.
REPORTER_PREFIX: str = f"{__about__.__title__}:"
# Number of threads to use for installing dependencies by default
DEFAULT_INSTALL_THREADS: int = 10

View File

@ -0,0 +1,48 @@
"""Custom plugin exceptions
All exceptions should inherit from the common base exception :exc:`ToxPoetryInstallerException`.
::
ToxPoetryInstallerException
+-- SkipEnvironment
| +-- PoetryNotInstalledError
+-- LockedDepVersionConflictError
+-- LockedDepNotFoundError
+-- ExtraNotFoundError
+-- LockedDepsRequiredError
+-- LockfileParsingError
"""
class ToxPoetryInstallerException(Exception):
"""Error while installing locked dependencies to the test environment"""
class SkipEnvironment(ToxPoetryInstallerException):
"""Current environment does not meet preconditions and should be skipped by the plugin"""
class PoetryNotInstalledError(SkipEnvironment):
"""No version of Poetry could be imported from the current Python environment"""
class LockedDepVersionConflictError(ToxPoetryInstallerException):
"""Locked dependencies cannot specify an alternate version for installation"""
class LockedDepNotFoundError(ToxPoetryInstallerException):
"""Locked dependency was not found in the lockfile"""
class ExtraNotFoundError(ToxPoetryInstallerException):
"""Project package extra not defined in project's pyproject.toml"""
class LockedDepsRequiredError(ToxPoetryInstallerException):
"""Environment cannot specify unlocked dependencies when locked dependencies are required"""
class LockfileParsingError(ToxPoetryInstallerException):
"""Failed to load or parse the Poetry lockfile"""

View File

@ -0,0 +1,4 @@
# pylint: disable=missing-module-docstring
from tox_poetry_installer.hooks.tox_add_env_config import tox_add_env_config
from tox_poetry_installer.hooks.tox_add_option import tox_add_option
from tox_poetry_installer.hooks.tox_on_install import tox_on_install

View File

@ -0,0 +1,366 @@
"""Helper functions for the :func:`tox_on_install` hook"""
import collections
import concurrent.futures
import contextlib
import datetime
import pathlib
from typing import Collection
from typing import Dict
from typing import List
from typing import Sequence
from typing import Set
import cleo.io.null_io
import packaging.utils
import poetry.config.config
import poetry.core.packages.dependency
import poetry.core.packages.package
import poetry.factory
import poetry.installation.executor
import poetry.installation.operations.install
import poetry.poetry
import poetry.utils.env
import tox.tox_env.api
import tox.tox_env.package
from tox_poetry_installer import constants
from tox_poetry_installer import exceptions
from tox_poetry_installer import logger
PackageMap = Dict[str, List[poetry.core.packages.package.Package]]
def check_preconditions(venv: tox.tox_env.api.ToxEnv) -> poetry.poetry.Poetry:
"""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 isinstance(venv, tox.tox_env.package.PackageToxEnv):
raise exceptions.SkipEnvironment(f"Skipping Tox provisioning env '{venv.name}'")
try:
return poetry.factory.Factory().create_poetry(venv.core["tox_root"])
# Support running the plugin when the current tox project does not use Poetry for its
# environment/dependency management.
#
# ``RuntimeError`` is dangerous to blindly catch because it can be (and in Poetry's case,
# is) raised in many different places for different purposes.
except RuntimeError as err:
raise exceptions.SkipEnvironment(
f"Skipping installation of locked dependencies due to a Poetry error: {err}"
) from None
def identify_transients(
dep_name: str,
packages: PackageMap,
venv: poetry.utils.env.VirtualEnv,
allow_missing: Sequence[str] = (),
) -> List[poetry.core.packages.package.Package]:
"""Using a pool of packages, identify all transient dependencies of a given package name
:param dep_name: 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.
.. note:: The package corresponding to the dependency specified by the ``dep`` parameter will
be included in the returned list of packages.
"""
searched: Set[str] = set()
def _transients(
transient: poetry.core.packages.dependency.Dependency,
) -> List[poetry.core.packages.package.Package]:
searched.add(transient.name)
results: List[poetry.core.packages.package.Package] = []
for option in packages[transient.name]:
if venv.is_valid_for_marker(option.to_dependency().marker):
for requirement in option.requires:
if requirement.name not in searched:
results += _transients(requirement)
logger.debug(f"Including {option} for installation")
results.append(option)
break
else:
logger.debug(
f"Skipping {transient.name}: target python version is {'.'.join([str(item) for item in venv.get_version_info()])} but package requires {transient.marker}"
)
return results
try:
for option in packages[dep_name]:
if venv.is_valid_for_marker(option.to_dependency().marker):
dep = option.to_dependency()
break
else:
logger.warning(
f"Skipping {dep_name}: no locked version found compatible with target python version {'.'.join([str(item) for item in venv.get_version_info()])}"
)
return []
return _transients(dep)
except KeyError as err:
missing = err.args[0]
if missing in allow_missing:
logger.debug(f"Skipping {missing}: package is allowed to be unlocked")
return []
if any(
delimiter in missing for delimiter in constants.PEP508_VERSION_DELIMITERS
):
raise exceptions.LockedDepVersionConflictError(
f"Locked dependency '{missing}' cannot include version specifier"
) from None
raise exceptions.LockedDepNotFoundError(
f"No version of locked dependency '{missing}' found in the project lockfile"
) from None
def find_project_deps(
packages: PackageMap,
venv: poetry.utils.env.VirtualEnv,
project: poetry.poetry.Poetry,
extras: Sequence[str] = (),
) -> List[poetry.core.packages.package.Package]:
"""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 project: Poetry object for the current project
:param extras: Sequence of extra names to include the dependencies of
"""
required_dep_names = [
item.name for item in project.package.requires if not item.is_optional()
]
extra_dep_names: List[str] = []
for extra in extras:
logger.info(f"Processing project extra '{extra}'")
try:
extra_dep_names += [
item.name
for item in project.package.extras[
packaging.utils.NormalizedName(extra)
]
]
except KeyError:
raise exceptions.ExtraNotFoundError(
f"Environment specifies project extra '{extra}' which was not found in the lockfile"
) from None
dependencies: List[poetry.core.packages.package.Package] = []
for dep_name in required_dep_names + extra_dep_names:
dependencies += identify_transients(
dep_name.lower(), packages, venv, allow_missing=[project.package.name]
)
return dedupe_packages(dependencies)
def find_additional_deps(
packages: PackageMap,
venv: poetry.utils.env.VirtualEnv,
project: poetry.poetry.Poetry,
dep_names: Sequence[str],
) -> List[poetry.core.packages.package.Package]:
"""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 project: Poetry object for the current project
:param dep_names: Sequence of additional dependency names to recursively find the transient
dependencies for
"""
dependencies: List[poetry.core.packages.package.Package] = []
for dep_name in dep_names:
dependencies += identify_transients(
dep_name.lower(), packages, venv, allow_missing=[project.package.name]
)
return dedupe_packages(dependencies)
def find_group_deps(
group: str,
packages: PackageMap,
venv: poetry.utils.env.VirtualEnv,
project: poetry.poetry.Poetry,
) -> List[poetry.core.packages.package.Package]:
"""Find the dependencies belonging to a dependency group
Recursively identify the Poetry dev dependencies
:param group: Name of the dependency group from the project's ``pyproject.toml``
: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 project: Poetry object for the current project
"""
return find_additional_deps(
packages,
venv,
project,
# the type ignore here is due to the difficulties around getting nested data
# from the inherrently unstructured toml structure (which necessarily is flexibly
# typed) but in a situation where there is a meta-structure applied to it (i.e. a
# pyproject.toml structure).
project.pyproject.data["tool"]["poetry"] # type: ignore
.get("group", {})
.get(group, {})
.get("dependencies", {})
.keys(),
)
def find_dev_deps(
packages: PackageMap,
venv: poetry.utils.env.VirtualEnv,
project: poetry.poetry.Poetry,
) -> List[poetry.core.packages.package.Package]:
"""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 project: Poetry object for the current project
"""
dev_group_deps = find_group_deps("dev", packages, venv, project)
# Legacy pyproject.toml poetry format:
legacy_dev_group_deps = find_additional_deps(
packages,
venv,
project,
# the type ignore here is due to the difficulties around getting nested data
# from the inherrently unstructured toml structure (which necessarily is flexibly
# typed) but in a situation where there is a meta-structure applied to it (i.e. a
# pyproject.toml structure).
project.pyproject.data["tool"]["poetry"].get("dev-dependencies", {}).keys(), # type: ignore
)
# Poetry 1.2 unions these two toml sections.
return dedupe_packages(dev_group_deps + legacy_dev_group_deps)
@contextlib.contextmanager
def _optional_parallelize(parallels: int):
"""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)
def install_package(
project: poetry.poetry.Poetry,
venv: tox.tox_env.api.ToxEnv,
packages: Collection[poetry.core.packages.package.Package],
parallels: int = 0,
):
"""Install a bunch of packages to a virtualenv
:param project: 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.
"""
logger.info(f"Installing {len(packages)} packages to environment at {venv.env_dir}")
install_executor = poetry.installation.executor.Executor(
env=convert_virtualenv(venv),
io=cleo.io.null_io.NullIO(),
pool=project.pool,
config=poetry.config.config.Config(),
)
installed: Set[poetry.core.packages.package.Package] = set()
def logged_install(dependency: poetry.core.packages.package.Package) -> None:
start = datetime.datetime.now()
logger.debug(f"Installing {dependency}")
install_executor.execute(
[poetry.installation.operations.install.Install(package=dependency)]
)
end = datetime.datetime.now()
logger.debug(f"Finished installing {dependency} in {end - start}")
with _optional_parallelize(parallels) as executor:
futures = []
for dependency in packages:
if dependency not in installed:
installed.add(dependency)
logger.debug(f"Queuing {dependency}")
future = executor(logged_install, dependency)
if future is not None:
futures.append(future)
else:
logger.debug(f"Skipping {dependency}, already installed")
logger.debug("Waiting for installs to finish...")
for future in concurrent.futures.as_completed(futures):
# Don't actually care about the return value, just waiting on the
# future to ensure any exceptions that were raised in the called
# function are propagated.
future.result()
def dedupe_packages(
packages: Sequence[poetry.core.packages.package.Package],
) -> List[poetry.core.packages.package.Package]:
"""Deduplicates a sequence of Packages while preserving ordering
Adapted from StackOverflow: https://stackoverflow.com/a/480227
"""
seen: Set[poetry.core.packages.package.Package] = set()
# Make this faster, avoid method lookup below
seen_add = seen.add
return [item for item in packages if not (item in seen or seen_add(item))]
def convert_virtualenv(venv: tox.tox_env.api.ToxEnv) -> poetry.utils.env.VirtualEnv:
"""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
"""
return poetry.utils.env.VirtualEnv(path=pathlib.Path(venv.env_dir))
def build_package_map(project: poetry.poetry.Poetry) -> PackageMap:
"""Build the mapping of package names to objects
:param project: Populated poetry object to load locked packages from
:returns: Mapping of package names to Poetry package objects
"""
packages = collections.defaultdict(list)
for package in project.locker.locked_repository().packages:
packages[str(package.name)].append(package)
return packages

View File

@ -0,0 +1,47 @@
"""Add required env configuration options to the tox INI file"""
from typing import List
import tox.config.sets
import tox.plugin
# pylint: disable=missing-function-docstring
@tox.plugin.impl
def tox_add_env_config(
env_conf: tox.config.sets.EnvConfigSet,
):
env_conf.add_config(
"poetry_dep_groups",
of_type=List[str],
default=[],
desc="List of Poetry dependency groups to install to the environment",
)
env_conf.add_config(
"install_project_deps",
of_type=bool,
default=True,
desc="Automatically install all Poetry primary dependencies to the environment",
)
env_conf.add_config(
"require_locked_deps",
of_type=bool,
default=False,
desc="Require all dependencies in the environment be installed using the Poetry lockfile",
)
env_conf.add_config(
"require_poetry",
of_type=bool,
default=False,
desc="Trigger a failure if Poetry is not available to Tox",
)
env_conf.add_config(
"locked_deps",
of_type=List[str],
default=[],
desc="List of locked dependencies to install to the environment using the Poetry lockfile",
)

View File

@ -0,0 +1,18 @@
"""Add additional command line arguments to tox to configure plugin behavior"""
import tox.config.cli.parser
import tox.plugin
from tox_poetry_installer import constants
# pylint: disable=missing-function-docstring
@tox.plugin.impl
def tox_add_option(parser: tox.config.cli.parser.ToxParser):
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",
)

View File

@ -0,0 +1,114 @@
"""Install the dependencies for the current environment
Loads the local Poetry environment and the corresponding lockfile then pulls the dependencies
specified by the Tox environment. Finally these dependencies are installed into the Tox
environment using the Poetry ``PipInstaller`` backend.
"""
import itertools
import tox.plugin
import tox.tox_env.api
from tox_poetry_installer import exceptions
from tox_poetry_installer import logger
from tox_poetry_installer.hooks._tox_on_install_helpers import build_package_map
from tox_poetry_installer.hooks._tox_on_install_helpers import check_preconditions
from tox_poetry_installer.hooks._tox_on_install_helpers import convert_virtualenv
from tox_poetry_installer.hooks._tox_on_install_helpers import dedupe_packages
from tox_poetry_installer.hooks._tox_on_install_helpers import find_additional_deps
from tox_poetry_installer.hooks._tox_on_install_helpers import find_group_deps
from tox_poetry_installer.hooks._tox_on_install_helpers import find_project_deps
from tox_poetry_installer.hooks._tox_on_install_helpers import install_package
# pylint: disable=missing-function-docstring,unused-argument
@tox.plugin.impl
def tox_on_install(tox_env: tox.tox_env.api.ToxEnv, *args) -> None:
try:
poetry = check_preconditions(tox_env)
except exceptions.SkipEnvironment as err:
if (
isinstance(err, exceptions.PoetryNotInstalledError)
and tox_env.conf["require_poetry"]
):
logger.error(str(err))
raise err
logger.info(str(err))
return
logger.info(f"Loaded project pyproject.toml from {poetry.file}")
virtualenv = convert_virtualenv(tox_env)
try:
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}"
)
except FileNotFoundError as err:
logger.error(f"Could not parse lockfile: {err}")
raise exceptions.LockfileParsingError(
f"Could not parse lockfile: {err}"
) from err
try:
if tox_env.conf["require_locked_deps"] and tox_env.conf["deps"].lines():
raise exceptions.LockedDepsRequiredError(
f"Unlocked dependencies '{tox_env.conf['deps']}' specified for environment '{tox_env.name}' which requires locked dependencies"
)
packages = build_package_map(poetry)
group_deps = dedupe_packages(
list(
itertools.chain(
*[
find_group_deps(group, packages, virtualenv, poetry)
for group in tox_env.conf["poetry_dep_groups"]
]
)
)
)
logger.info(
f"Identified {len(group_deps)} group dependencies to install to env"
)
env_deps = find_additional_deps(
packages, virtualenv, poetry, tox_env.conf["locked_deps"]
)
logger.info(
f"Identified {len(env_deps)} environment dependencies to install to env"
)
# extras are not set in a testenv if skip_install=true
try:
extras = tox_env.conf["extras"]
except KeyError:
extras = []
if tox_env.conf["install_project_deps"]:
project_deps = find_project_deps(packages, virtualenv, poetry, extras)
logger.info(
f"Identified {len(project_deps)} project dependencies to install to env"
)
else:
project_deps = []
logger.info("Env does not install project package dependencies, skipping")
except exceptions.ToxPoetryInstallerException as err:
logger.error(str(err))
raise err
except Exception as err:
logger.error(f"Internal plugin error: {err}")
raise err
dependencies = dedupe_packages(group_deps + env_deps + project_deps)
logger.info(f"Installing {len(dependencies)} dependencies from Poetry lock file")
install_package(
poetry,
tox_env,
dependencies,
tox_env.options.parallel_install_threads,
)

View File

@ -0,0 +1,30 @@
"""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 logging
from tox_poetry_installer import constants
def error(message: str):
"""Wrapper around :func:`logging.error` that prefixes the reporter prefix onto the message"""
logging.error(f"{constants.REPORTER_PREFIX} {message}")
def warning(message: str):
"""Wrapper around :func:`logging.warning`"""
logging.warning(f"{constants.REPORTER_PREFIX} {message}")
def info(message: str):
"""Wrapper around :func:`logging.info`"""
logging.info(f"{constants.REPORTER_PREFIX} {message}")
def debug(message: str):
"""Wrapper around :func:`logging.debug`"""
logging.debug(f"{constants.REPORTER_PREFIX} {message}")

View File