Skip to content

Commit

Permalink
remove circular dependency on export plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
dimbleby committed Jul 9, 2022
1 parent bf885ac commit 671f7cc
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 48 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,18 @@ jobs:
run: poetry run python -m pytest -n auto -p no:sugar -q --integration tests/integration

- name: Get Plugin Version (poetry-plugin-export)
uses: sergeysova/jq-action@v2
id: poetry-plugin-export-version
run: |
echo ::set-output name=version::$(\
poetry show poetry-plugin-export | grep version | cut -d : -f 2 | xargs)
with:
cmd: |
curl -s https://pypi.org/pypi/poetry-plugin-export/json | jq -r '.info.version'
- name: Checkout Plugin Source (poetry-plugin-export)
uses: actions/checkout@v2
with:
path: poetry-plugin-export
repository: python-poetry/poetry-plugin-export
ref: refs/tags/${{ steps.poetry-plugin-export-version.outputs.version }}
ref: refs/tags/${{ steps.poetry-plugin-export-version.outputs.value }}

- name: Run pytest (poetry-plugin-export)
run: poetry run python -m pytest -p no:sugar -q poetry-plugin-export/tests/
Expand Down
10 changes: 0 additions & 10 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,3 @@
language: python
language_version: python3
pass_filenames: false

- id: poetry-export
name: poetry-export
description: run poetry export to sync lock file with requirements.txt
entry: poetry export
language: python
language_version: python3
pass_filenames: false
files: ^poetry.lock$
args: ["-f", "requirements.txt", "-o", "requirements.txt"]
2 changes: 2 additions & 0 deletions docs/pre-commit-hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ The `poetry-export` hook calls the `poetry export` command
to sync your `requirements.txt` file with your current dependencies.

{{% note %}}
This command is provided by the [Export Poetry Plugin](https://github.com/python-poetry/poetry-plugin-export).

It is recommended to run the [`poetry-lock`](#poetry-lock) hook prior to this one.
{{% /note %}}

Expand Down
17 changes: 1 addition & 16 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ generate-setup-file = false
python = "^3.7"

poetry-core = "^1.1.0b2"
poetry-plugin-export = "^1.0.4"
cachecontrol = { version = "^0.12.9", extras = ["filecache"] }
cachy = "^0.3.0"
cleo = "^1.0.0a5"
Expand Down
18 changes: 1 addition & 17 deletions src/poetry/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import contextlib
import logging
import re
import warnings

from typing import TYPE_CHECKING
from typing import Any
Expand Down Expand Up @@ -59,12 +58,7 @@ def create_poetry(
)

# Loading global configuration
with warnings.catch_warnings():
# this is preserved to ensure export plugin tests pass in ci,
# once poetry-plugin-export version is updated to use one that do not
# use Factory.create_config(), this can be safely removed.
warnings.filterwarnings("ignore", category=DeprecationWarning)
config = self.create_config()
config = Config.create()

# Loading local configuration
local_config_file = TOMLFile(base_poetry.file.parent / "poetry.toml")
Expand Down Expand Up @@ -113,16 +107,6 @@ def create_poetry(
def get_package(cls, name: str, version: str) -> ProjectPackage:
return ProjectPackage(name, version, version)

@classmethod
def create_config(cls, io: IO | None = None) -> Config:
if io is not None:
logger.debug("Ignoring provided io when creating config.")
warnings.warn(
"Use of Factory.create_config() is deprecated, use Config.create() instead",
DeprecationWarning,
)
return Config.create()

@classmethod
def configure_sources(
cls,
Expand Down

0 comments on commit 671f7cc

Please sign in to comment.