Commit d52780c5 by Arun Babu Neelicattu Committed by Randy Döring

export: add poetry-plugin-export

parent d18b6520
...@@ -621,8 +621,13 @@ poetry export -f requirements.txt --output requirements.txt ...@@ -621,8 +621,13 @@ poetry export -f requirements.txt --output requirements.txt
``` ```
{{% note %}} {{% note %}}
Only the `requirements.txt` format is currently supported. This command is provided by the [Export Poetry Plugin](https://github.com/python-poetry/poetry-plugin-export)
This command is also available as a pre-commit hook. See [pre-commit hooks](/docs/pre-commit-hooks#poetry-export) for more information. and is also available as a pre-commit hook. See [pre-commit hooks](/docs/pre-commit-hooks#poetry-export) for more information.
{{% /note %}}
{{% note %}}
Unlike the `install` command, this command only includes the project's dependencies defined in the implicit `default`
group defined in `tool.poetry.dependencies` when used without specifying any options.
{{% /note %}} {{% /note %}}
### Options ### Options
...@@ -631,8 +636,12 @@ This command is also available as a pre-commit hook. See [pre-commit hooks](/doc ...@@ -631,8 +636,12 @@ This command is also available as a pre-commit hook. See [pre-commit hooks](/doc
Currently, only `requirements.txt` is supported. Currently, only `requirements.txt` is supported.
* `--output (-o)`: The name of the output file. If omitted, print to standard * `--output (-o)`: The name of the output file. If omitted, print to standard
output. output.
* `--dev`: Include development dependencies. * `--dev`: Include development dependencies. (**Deprecated**)
* `--extras (-E)`: Extra sets of dependencies to include. * `--extras (-E)`: Extra sets of dependencies to include.
* `--without`: The dependency groups to ignore.
* `--with`: The optional dependency groups to include.
* `--only`: The only dependency groups to include.
* `--default`: Only include the default dependencies. (**Deprecated**)
* `--without-hashes`: Exclude hashes from the exported file. * `--without-hashes`: Exclude hashes from the exported file.
* `--without-urls`: Exclude source repository urls from the exported file. * `--without-urls`: Exclude source repository urls from the exported file.
* `--with-credentials`: Include credentials for extra indices. * `--with-credentials`: Include credentials for extra indices.
......
...@@ -35,6 +35,7 @@ generate-setup-file = false ...@@ -35,6 +35,7 @@ generate-setup-file = false
python = "^3.7" python = "^3.7"
poetry-core = "^1.1.0a7" poetry-core = "^1.1.0a7"
poetry-plugin-export = "^1.0"
cachecontrol = { version = "^0.12.9", extras = ["filecache"] } cachecontrol = { version = "^0.12.9", extras = ["filecache"] }
cachy = "^0.3.0" cachy = "^0.3.0"
cleo = "^1.0.0a4" cleo = "^1.0.0a4"
......
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from unittest.mock import ANY
from unittest.mock import Mock from unittest.mock import Mock
import pytest import pytest
from poetry.console.commands.export import Exporter from poetry_plugin_export.exporter import Exporter
from tests.helpers import get_package from tests.helpers import get_package
...@@ -155,15 +155,6 @@ def test_export_with_urls( ...@@ -155,15 +155,6 @@ def test_export_with_urls(
the Exporter test. the Exporter test.
""" """
mock_export = Mock() mock_export = Mock()
monkeypatch.setattr(Exporter, "export", mock_export) monkeypatch.setattr(Exporter, "with_urls", mock_export)
tester.execute("--without-urls") tester.execute("--without-urls")
mock_export.assert_called_once_with( mock_export.assert_called_once_with(False)
ANY,
ANY,
ANY,
dev=False,
extras=[],
with_credentials=False,
with_hashes=True,
with_urls=False,
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment