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 2133fa7
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 45 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ jobs:
path: .venv
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}

- name: temp early plugin version getter
uses: sergeysova/jq-action@v2
id: poetry-plugin-export-version-early
run: |
curl -s https://pypi.org/pypi/poetry-plugin-export/json | jq -r '.info.version'
- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true'
run: timeout 10s poetry run pip --version || rm -rf .venv
Expand All @@ -97,10 +103,11 @@ 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)
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
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 2133fa7

Please sign in to comment.