# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['tests', 'tests.test-project.test_project', 'tox_poetry_installer']

package_data = \
{'': ['*'], 'tests': ['test-project/*']}

install_requires = \
['poetry-core>=1.1.0,<2.0.0', 'tox>=3.8.0,<4.0.0']

extras_require = \
{'poetry': ['cleo>=1.0,<3.0', 'poetry>=1.2.0,<2.0.0']}

entry_points = \
{'tox': ['poetry_installer = tox_poetry_installer']}

setup_kwargs = {
    'name': 'tox-poetry-installer',
    'version': '0.10.1',
    'description': 'A plugin for Tox that lets you install test environment dependencies from the Poetry lockfile',
    'long_description': '# tox-poetry-installer\n\nA plugin for [Tox](https://tox.readthedocs.io/en/latest/) that lets you install test\nenvironment dependencies from the [Poetry](https://python-poetry.org/) lockfile.\n\n[![CI Status](https://github.com/enpaul/tox-poetry-installer/workflows/CI/badge.svg?event=push)](https://github.com/enpaul/tox-poetry-installer/actions)\n[![PyPI Version](https://img.shields.io/pypi/v/tox-poetry-installer)](https://pypi.org/project/tox-poetry-installer/)\n[![PyPI Downloads](https://img.shields.io/pypi/dm/tox-poetry-installer)](https://libraries.io/pypi/tox-poetry-installer)\n[![License](https://img.shields.io/pypi/l/tox-poetry-installer)](https://opensource.org/licenses/MIT)\n[![Python Supported Versions](https://img.shields.io/pypi/pyversions/tox-poetry-installer)](https://www.python.org)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n⚠️ **This project is beta software and is under active development** ⚠️\n\n## Documentation\n\n- [Feature Overview](#feature-overview)\n- [Using the Plugin](#user-documentation)\n  - [Installing](#installing)\n  - [Quick Start](#quick-start)\n  - [References](#references)\n    - [Config Options](#configuration-options)\n    - [Runtime Options](#runtime-options)\n    - [Errors](#errors)\n  - [Other Notes](#other-notes)\n    - [Unsupported Tox config options](#unsupported-tox-config-options)\n    - [Updating locked dependencies in a testenv](#updating-locked-dependencies-in-a-testenv)\n    - [Installing unsafe dependencies](#installing-unsafe-dependencies)\n    - [Using with an unmanaged Poetry installation](#using-with-an-unmanaged-poetry-installation)\n- [Developing the Plugin](#developer-documentation)\n- [Road Map](#road-map)\n\nSee the\n[Changelog](https://github.com/enpaul/tox-poetry-installer/blob/devel/CHANGELOG.md) for\nrelease history.\n\n*See also: [official Tox plugins](https://tox.readthedocs.io/en/latest/plugins.html), [Poetry Tox plugin](https://github.com/tkukushkin/tox-poetry)*\n\n## Feature Overview\n\n- Manage package versions in exactly one place and with exactly one tool: Poetry.\n- Ensure CI/CD and other automation tools are using the same package versions that you are\n  in your local development environment.\n- Add only the packages or custom groups you need to a Tox test environment, instead of\n  everything in your lockfile.\n- Directly integrate with Poetry, re-using your existing package indexes and credentials,\n  with no additional configuration.\n- Wherever possible, built-in Tox config options are always respected and their behavior\n  kept consistent.\n- Extremely configurable. Every feature can be disabled or enabled for any given Tox test\n  environment.\n- Friendly to other Tox plugins and supports a wide range of environments.\n\n## User Documentation\n\n*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)*\n\n### Installing\n\nThe recommended way to install the plugin is to add it to a project using Poetry:\n\n```bash\npoetry add tox-poetry-installer[poetry] --dev\n```\n\n> **Note:** Always install the plugin with the `[poetry]` extra, unless you are\n> [managing the Poetry installation yourself](#externally-managed-poetry-installation).\n\nAlternatively, it can be installed directly to a virtual environment using Pip, though\nthis is not recommended:\n\n```bash\nsource somevenv/bin/activate\npip install tox-poetry-installer\n```\n\nAlternatively alternatively, it can be installed using the Tox\n[`requires`](https://tox.readthedocs.io/en/latest/config.html#conf-requires) option by\nadding the below to `tox.ini`, though this is also not recommended:\n\n```ini\nrequires =\n    tox-poetry-installer[poetry] == 0.8.0\n```\n\nAfter installing, check that Tox recognizes the plugin by running\n`poetry run tox --version`. The command should give output similar to below:\n\n```\n3.20.0 imported from .venv/lib64/python3.8/site-packages/tox/__init__.py\nregistered plugins:\n    tox-poetry-installer-0.8.0 at .venv/lib64/python3.8/site-packages/tox_poetry_installer/__init__.py\n```\n\n### Quick Start\n\nCongratulations! 🎉 Just by installing the plugin your Tox config is already using locked\ndependencies: when Tox builds and installs your project package to a test environment,\nyour project package\'s dependencies will be installed from the lockfile.\n\nNow lets update an example `tox.ini` to install the other test environment dependencies\nfrom the lockfile.\n\nA `testenv` from the example `tox.ini` we\'re starting with is below:\n\n```ini\n[testenv]\ndescription = Some very cool tests\ndeps =\n    black == 20.8b1\n    pylint >=2.4.4,<2.7.0\n    mypy <0.800\ncommands = ...\n```\n\nTo update the config so that the testenv dependencies are installed from the lockfile, we\ncan replace the built-in\n[`deps`](https://tox.readthedocs.io/en/latest/config.html#conf-deps) option with the\n`locked_deps` option provided by the plugin, and then remove the inline version\nspecifiers. With these changes the three testenv dependencies (as well as all of their\ndependencies) will be installed from the lockfile when the test environment is recreated:\n\n```ini\n[testenv]\ndescription = Some very cool tests\nlocked_deps =\n    black\n    pylint\n    mypy\ncommands = ...\n```\n\nWe can also add the `require_locked_deps` option to the test environment. This will both\nblock any other install tools (another plugin or Tox itself) from installing dependencies\nto the Tox environment and also cause Tox to fail if the test environment also uses the\nbuilt-in [`deps`](https://tox.readthedocs.io/en/latest/config.html#conf-deps) option:\n\n```ini\n[testenv]\ndescription = Some very cool tests\nrequire_locked_deps = true\nlocked_deps =\n    black\n    pylint\n    mypy\ncommands = ...\n```\n\n> **Note:** Settings configured on the main `testenv` environment are inherited by child\n> test environments (for example, `testenv:foo`). To override this, specify the setting in\n> the child environment with a different value.\n\nAlternatively, we can skip specifying all of our dependencies for a test environment in\nthe Tox config and install Poetry dependency groups directly:\n\n```ini\n[testenv]\ndescription = Some very cool tests\nrequire_locked_deps = true\npoetry_dep_groups =\n    dev\ncommands = ...\n```\n\n> **Note:** Setting `poetry_dep_groups = [dev]` on an environment that also installs the\n> project package is functionally equivalent to running `poetry install`.\n\n> **Note:** The `install_dev_deps` configuration option is deprecated. See [Configuration\n> Options](#configuration-options) for more information.\n\nFinally, we can also install an unlocked dependency (a dependency which doesn\'t take its\nversion from the Poetry lockfile) into the test environment alongside the locked ones. We\nneed to remove the `require_locked_deps = true` option, otherwise the environment will\nerror, and then we can add the unlocked dependency using the built-in\n[`deps`](https://tox.readthedocs.io/en/latest/config.html#conf-deps) option:\n\n```ini\n[testenv]\ndescription = Some very cool tests\ndeps =\n    pytest >= 5.6.0,<6.0.0\nlocked_deps =\n    black\n    pylint\n    mypy\ncommands = ...\n```\n\n## References\n\n### Configuration Options\n\nAll options listed below are Tox environment options and can be applied to one or more\nenvironment sections of the `tox.ini` file. They cannot be applied to the global Tox\nconfiguration section.\n\n> **Note:** Settings configured on the main `testenv` environment are inherited by child\n> test environments (for example, `testenv:foo`). To override this, specify the setting in\n> the child environment with a different value.\n\n| Option                 |  Type   | Default | Description                                                                                                                                                                                                                                                                                                                                                          |\n| :--------------------- | :-----: | :-----: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `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.                                                                                                                                                                                          |\n| `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. |\n| `install_project_deps` | Boolean |  True   | Whether all of the Poetry primary dependencies for the project package should be installed to the test environment.                                                                                                                                                                                                                                                  |\n| `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.                                                                                            |\n| `poetry_dep_groups`    |  List   |  `[]`   | Names of Poetry dependency groups specified in `pyproject.toml` to install to the test environment.                                                                                                                                                                                                                                                                  |\n\n> **Note:** The `install_dev_deps` configuration option is deprecated and will be removed in\n> version 1.0.0. Please set `poetry_dep_groups = [dev]` in `tox.ini` for environments that\n> install the development dependencies.\n\n### Runtime Options\n\nAll arguments listed below can be passed to the `tox` command to modify runtime behavior\nof the plugin.\n\n| Argument                     |  Type   | Default | Description                                                                                                                                                                                                                                                                          |\n| :--------------------------- | :-----: | :-----: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `--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. |\n\n> **Note:** The `--require-poetry` runtime option is deprecated and will be removed in\n> version 1.0.0. Please set `require_poetry = true` in `tox.ini` for environments that\n> should fail if Poetry is not available.\n\n> **Note:** The `--parallelize-locked-install` option is deprecated and will be removed in\n> version 1.0.0. Please use the `--parallel-install-threads` option.\n\n### Errors\n\nThere are several errors that the plugin can encounter for a test environment when Tox is\nrun. If an error is encountered then the status of the test environment that caused the\nerror will be set to one of the "Status" values below to indicate what the error was.\n\n| Status/Name                     | Cause                                                                                                                                                                                                                           |\n| :------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `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`.                                              |\n| `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`).                                                 |\n| `LockedDepNotFoundError`        | Indicates that an item specified in the `locked_deps` config option does not match the name of a package in the Poetry lockfile.                                                                                                |\n| `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. |\n| `PoetryNotInstalledError`       | Indicates that the `poetry` module could not be imported under the current runtime environment, and `require_poetry = true` was specified.                                                                                      |\n| `RequiresUnsafeDepError`        | Indicates that the package-under-test depends on a package that Poetry has classified as unsafe and cannot be installed.                                                                                                        |\n\n> **Note:** One or more of these errors can be caused by the `pyproject.toml` being out of\n> sync with the Poetry lockfile. If this is the case, than a warning will be logged when Tox\n> is run.\n\n### Other Notes\n\n#### Unsupported Tox config options\n\nBelow are the built-in Tox config options that are not respected by this plugin. All of\nthese options are made obsolete by the Poetry lockfile: either they aren\'t needed or their\nequivalent functionality is instead taken directly from the package details Poetry stores\nin its lockfile.\n\n> **Note:** The unsupported Tox config options will still apply to unlocked dependencies\n> being installed with the default Tox installation backend.\n\n- [`install_command`](https://tox.readthedocs.io/en/latest/config.html#conf-install_command)\n- [`pip_pre`](https://tox.readthedocs.io/en/latest/config.html#conf-pip_pre)\n- [`download`](https://tox.readthedocs.io/en/latest/config.html#conf-download)\n- [`indexserver`](https://tox.readthedocs.io/en/latest/config.html#conf-indexserver)\n- [`usedevelop`](https://tox.readthedocs.io/en/latest/config.html#conf-indexserver)\n\n#### Updating locked dependencies in a testenv\n\nWhen Poetry updates the version of a package in the lockfile (using either `poetry lock`\nor `poetry update`) then the plugin will automatically use this new version to install the\npackage to a test environment; there is no need to manually update `tox.ini` after\nupdating the Poetry lockfile.\n\nHowever, the plugin cannot determine when the lockfile is updated. If a Tox test\nenvironment has already been created then it will need to be recreated (using Tox\'s\nbuilt-in\n[`--recreate`](https://tox.readthedocs.io/en/latest/example/basic.html#forcing-re-creation-of-virtual-environments)\noption) for the new version to be found and installed.\n\n> **Note:** To force Tox to always recreate a test environment the\n> [`recreate`](https://tox.readthedocs.io/en/latest/config.html#conf-recreate) config option\n> can be set.\n\n#### Installing unsafe dependencies\n\nThere are several packages that cannot be installed from the lockfile because they are\nexcluded by Poetry itself. As a result these packages cannot be installed by this plugin\neither as test environment dependencies passed directly to `locked_deps` or as a transient\ndependency. When one of these packages is encountered by the plugin a warning will be\nlogged to the console and\n**the unsafe package will not be installed to the test environment**.\n\nThis list can be found in the Poetry source code\n[here](https://github.com/python-poetry/poetry/blob/master/poetry/puzzle/provider.py). As\nof [Poetry 1.1.6](https://github.com/python-poetry/poetry/releases/tag/1.1.6) there are\nfour packages classified as "unsafe" by Poetry and excluded from the lockfile:\n\n- `setuptools`\n- `distribute`\n- `pip`\n- `wheel`\n\n#### Using with an unmanaged Poetry installation\n\nIn CI/CD systems, automation environments, or other Python environments where the loaded\nsite packages are not managed by Poetry, it can be useful to manage the local installation\nof Poetry externally. This also helps to avoid problems that can be caused by the\n`--no-root`, `--no-dev`, or `--remove-untracked` arguments to the `poetry install` command\nwhich, in some situations, can cause Poetry to uninstall itself if Poetry is specified as\na dependency of one of the packages it is managing (like this plugin). To support these\nuse cases, this plugin specifies the `poetry` package as an optional dependency that can\nbe installed using a setuptools extra also named `poetry`.\n\n**Critical Warning: This plugin requires Poetry to function. If the plugin is installed without the `poetry` setuptools extra then Poetry must be installed independently for the plugin to function properly.**\n\nTo skip installing the `poetry` package as a dependency of `tox-poetry-installer`, do not\nspecify the `poetry` extra when adding the plugin:\n\n```bash\n# Adding the package without the "[poetry]" extra specifier so that\n# Poetry is not added as a transient dev-dependency:\npoetry add tox-poetry-installer --dev\n\n# Adding the package with the "[poetry]" extra specifier, so the Poetry\n# package will be added to the environment and tracked in the lockfile:\npoetry add tox-poetry-installer[poetry] --dev\n```\n\nOnce the plugin is installed- either with or without the Poetry extra- you can validate\nthat the plugin will run correctly with the following command. This command checks that\nall three required components (Tox, Poetry, and the plugin itself) are available in the\ncurrent Python environment:\n\n```bash\npython -c \'\\\n  import tox;\\\n  import tox_poetry_installer;\\\n  from poetry.poetry import Poetry;\\\n\'\n```\n\n> **Note:** To force Tox to fail if Poetry is not installed, add the `require_poetry = true`\n> option to the tox `[testenv]` configuration. See the\n> [Config Options](#configuration-options) for more information.\n\n## Developer Documentation\n\nAll project contributors and participants are expected to adhere to the\n[Contributor Covenant Code of Conduct, v2](CODE_OF_CONDUCT.md) ([external link](https://www.contributor-covenant.org/version/2/0/code_of_conduct/)).\n\nThe `devel` branch has the latest (and potentially unstable) changes. The stable releases\nare tracked on [Github](https://github.com/enpaul/tox-poetry-installer/releases),\n[PyPi](https://pypi.org/project/tox-poetry-installer/#history), and in the\n[Changelog](CHANGELOG.md).\n\n- To report a bug, request a feature, or ask for assistance, please\n  [open an issue on the Github repository](https://github.com/enpaul/tox-poetry-installer/issues/new).\n- To report a security concern or code of conduct violation, please contact the project\n  author directly at **\u200cme \\[at\u200c\\] enp dot\u200e \u200cone**.\n- To submit an update, please\n  [fork the repository](https://docs.github.com/en/enterprise/2.20/user/github/getting-started-with-github/fork-a-repo)\n  and [open a pull request](https://github.com/enpaul/tox-poetry-installer/compare).\n\nDeveloping this project requires [Python 3.7+](https://www.python.org/downloads/) and\n[Poetry 1.2](https://python-poetry.org/docs/#installation) or later. GNU Make can\noptionally be used to quickly setup a local development environment, but this is not\nrequired.\n\nTo setup a local development environment:\n\n```bash\n# Clone the repository...\n# ...over HTTPS\ngit clone https://github.com/enpaul/tox-poetry-installer.git\n# ...over SSH\ngit clone git@github.com:enpaul/tox-poetry-installer.git\n\ncd tox-poetry-installer/\n\n# Create and configure the local development environment\nmake dev\n\n# Run tests and CI locally\nmake test\n\n# See additional make targets\nmake help\n```\n\n> **Note:** The pre-commit hooks require dependencies in the Poetry environment to run. To\n> make a commit with the pre-commit hooks, you will need to run `poetry run git commit` or,\n> alternatively, [launch an environment shell](https://python-poetry.org/docs/cli/#shell).\n\n## Road Map\n\nThis project is under active development and is classified as beta software, ready for\nproduction environments on a provisional basis only.\n\n- Beta classification was assigned with\n  [v0.6.0](https://github.com/enpaul/tox-poetry-installer/releases/tag/0.6.0)\n- Stable classification will be assigned when the test suite covers an acceptable number of\n  use cases\n\n### Path to Beta\n\n- [x] Verify that primary package dependencies (from the `.package` env) are installed\n  correctly using the Poetry backend.\n- [x] Support the [`extras`](https://tox.readthedocs.io/en/latest/config.html#conf-extras) Tox\n  configuration option ([#4](https://github.com/enpaul/tox-poetry-installer/issues/4))\n- [x] Add per-environment Tox configuration option to fall back to default installation\n  backend.\n- [ ] ~Add warnings when an unsupported Tox configuration option is detected while using the\n  Poetry backend.~ ([#5](https://github.com/enpaul/tox-poetry-installer/issues/5))\n- [x] Add trivial tests to ensure the project metadata is consistent between the pyproject.toml\n  and the module constants.\n- [x] Update to use [poetry-core](https://github.com/python-poetry/poetry-core) and improve\n  robustness of the Tox and Poetry module imports to avoid potentially breaking API changes\n  in upstream packages. ([#2](https://github.com/enpaul/tox-poetry-installer/issues/2))\n- [ ] ~Find and implement a way to mitigate the\n  [UNSAFE_DEPENDENCIES issue](https://github.com/python-poetry/poetry/issues/1584) in\n  Poetry.~ ([#6](https://github.com/enpaul/tox-poetry-installer/issues/6))\n- [x] Fix logging to make proper use of Tox\'s logging reporter infrastructure ([#3](https://github.com/enpaul/tox-poetry-installer/issues/3))\n- [x] Add configuration option for installing all dev-dependencies to a testenv ([#14](https://github.com/enpaul/tox-poetry-installer/issues/14))\n\n### Path to Stable\n\nEverything in Beta plus...\n\n- [ ] Fully replace dependency on `poetry` with dependency on `poetry-core` ([#2](https://github.com/enpaul/tox-poetry-installer/issues/2))\n- [x] Add comprehensive unit tests\n- [ ] ~Add tests for each feature version of Tox between 3.8 and 3.20~\n- [x] Add tests for Python-3.6, 3.7, 3.8, and 3.9\n- [x] Add Github Actions based CI\n',
    'author': 'Ethan Paul',
    'author_email': '24588726+enpaul@users.noreply.github.com',
    'maintainer': 'None',
    'maintainer_email': 'None',
    'url': 'https://github.com/enpaul/tox-poetry-installer/',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'extras_require': extras_require,
    'entry_points': entry_points,
    'python_requires': '>=3.7,<4.0',
}


setup(**setup_kwargs)
