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 14, 2022
1 parent fdec38b commit b04265b
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 31 deletions.
33 changes: 29 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ jobs:
shell: bash
steps:
- uses: actions/checkout@v2
with:
path: poetry

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
Expand Down Expand Up @@ -76,21 +78,27 @@ jobs:

- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true'
working-directory: ./poetry
run: timeout 10s poetry run pip --version || rm -rf .venv

- name: Install dependencies
working-directory: ./poetry
run: poetry install

- name: Run mypy
working-directory: ./poetry
run: poetry run mypy

- name: Install pytest plugin
working-directory: ./poetry
run: poetry run pip install pytest-github-actions-annotate-failures

- name: Run pytest
working-directory: ./poetry
run: poetry run python -m pytest -n auto -p no:sugar -q tests/

- name: Run pytest (integration suite)
working-directory: ./poetry
env:
POETRY_TEST_INTEGRATION_GIT_USERNAME: ${GITHUB_ACTOR}
POETRY_TEST_INTEGRATION_GIT_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -99,8 +107,9 @@ jobs:
- name: Get Plugin Version (poetry-plugin-export)
id: poetry-plugin-export-version
run: |
echo ::set-output name=version::$(\
poetry show poetry-plugin-export | grep version | cut -d : -f 2 | xargs)
PLUGIN_VERSION=$(curl -s https://pypi.org/pypi/poetry-plugin-export/json | python -c 'import json, sys ; print(json.load(sys.stdin)["info"]["version"])')
echo "Found version ${PLUGIN_VERSION}"
echo ::set-output name=version::${PLUGIN_VERSION}
- name: Checkout Plugin Source (poetry-plugin-export)
uses: actions/checkout@v2
Expand All @@ -109,10 +118,26 @@ jobs:
repository: python-poetry/poetry-plugin-export
ref: refs/tags/${{ steps.poetry-plugin-export-version.outputs.version }}

- name: Update poetry version (poetry-plugin-export)
working-directory: poetry-plugin-export
run: |
poetry add --lock --dev ../poetry
git diff
- name: Install (poetry-plugin-export)
working-directory: ./poetry-plugin-export
run: poetry install

- name: Run pytest (poetry-plugin-export)
run: poetry run python -m pytest -p no:sugar -q poetry-plugin-export/tests/
working-directory: ./poetry-plugin-export
run: poetry run python -m pytest -p no:sugar -q tests/

- name: Check for clean working tree
working-directory: ./poetry
run: git diff --exit-code --stat HEAD

- name: Check for clean working tree (poetry-plugin-export)
working-directory: ./poetry-plugin-export
run: |
git checkout -- pyproject.toml poetry.lock
git diff --exit-code --stat HEAD
git -C poetry-plugin-export diff --exit-code --stat HEAD
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 hook 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.0b3"
poetry-plugin-export = "^1.0.5"
cachecontrol = { version = "^0.12.9", extras = ["filecache"] }
cachy = "^0.3.0"
cleo = "^1.0.0a5"
Expand Down

0 comments on commit b04265b

Please sign in to comment.