Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework plugin for 1.x release #46

Merged
merged 11 commits into from
Apr 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 30 additions & 16 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@
[flake8]
min_python_version = 3.7.0
max-line-length = 88
ignore = E501, E203, W503
ban-relative-imports = true
# flake8-use-fstring: https://github.com/MichaelKim0407/flake8-use-fstring#--percent-greedy-and---format-greedy
format-greedy = 1
inline-quotes = double
# Allow omission of a return type hint for __init__ if at least one argument is annotated
# used by flake8-annotations
mypy-init-return = true
enable-extensions = TC, TC1
type-checking-exempt-modules = typing, typing-extensions
eradicate-whitelist-extend = ^-.*;
extend-ignore =
# E203: Whitespace before ':' (pycqa/pycodestyle#373)
E203,
# SIM106: Handle error-cases first
SIM106,
# ANN101: Missing type annotation for self in method
ANN101,
# ANN102: Missing type annotation for cls in classmethod
ANN102,
per-file-ignores =
__init__.py:F401
exclude =
.git
__pycache__
setup.py
build
dist
releases
.venv
.tox
.mypy_cache
.pytest_cache
.vscode
.github
tests/fixtures/
# F401: Module imported by unused (non-implicit modules)
# TC002: Move third-party import '...' into a type-checking block
__init__.py:F401,TC002,
# ANN201: Missing return type annotation for public function
tests/test_*:ANN201
tests/**/test_*:ANN201
extend-exclude =
# External to the project's coding standards:
tests/fixtures/*,
tests/**/fixtures/*,
19 changes: 0 additions & 19 deletions .github/workflows/code-quality.yaml

This file was deleted.

50 changes: 25 additions & 25 deletions .github/workflows/tests.yml → .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,33 @@ name: Tests
on:
pull_request: {}
push:
branches: [main]
branches:
- main


concurrency:
group: tests-${{ github.head_ref || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
tests:
name: ${{ matrix.os }} / ${{ matrix.python-version }}
runs-on: "${{ matrix.os }}-latest"
continue-on-error: ${{ matrix.experimental }}
name: ${{ matrix.os }} / ${{ matrix.python-version }} ${{ matrix.suffix }}
runs-on: ${{ matrix.image }}
strategy:
matrix:
os: [Ubuntu, MacOS, Windows]
python-version: [3.6, 3.7, 3.8, 3.9]
experimental: [false]
bootstrap-args: [""]
os: [Ubuntu, macOS, Windows]
python-version: ["3.7", "3.8", "3.9", "3.10"]
include:
- os: Ubuntu
python-version: pypy3
experimental: false
- os: Ubuntu
python-version: "3.10.0-alpha - 3.10.0"
experimental: true
bootstrap-args: "--git https://github.com/python-poetry/poetry.git"
image: ubuntu-latest
- os: Windows
image: windows-2022
- os: macOS
image: macos-11
fail-fast: false
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v2

Expand All @@ -35,26 +40,21 @@ jobs:

- name: Get full Python version
id: full-python-version
shell: bash
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")

- name: Bootstrap poetry
shell: bash
run: |
curl -sL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py \
| python - -y ${{ matrix.bootstrap-args }}
curl -sL https://install.python-poetry.org | python - -y ${{ matrix.bootstrap-args }}

- name: Update PATH
if: ${{ matrix.os != 'Windows' }}
shell: bash
run: echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Update Path for Windows
if: ${{ matrix.os == 'Windows' }}
shell: bash
run: echo "$APPDATA\Python\Scripts" >> $GITHUB_PATH

- name: Configure poetry
shell: bash
run: poetry config virtualenvs.in-project true

- name: Set up cache
Expand All @@ -66,13 +66,13 @@ jobs:

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

- name: Install dependencies
shell: bash
run: poetry install

- name: Install pytest plugin
run: poetry run pip install pytest-github-actions-annotate-failures

- name: Run pytest
shell: bash
run: poetry run python -m pytest -q tests/
run: poetry run python -m pytest -p no:sugar -q tests/
13 changes: 5 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,22 @@ on:
- '*.*.*'

jobs:
Release:
release:
name: Release
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Get tag
id: tag
run: echo ::set-output name=tag::${GITHUB_REF#refs/tags/}

- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: "3.9"

- name: Install Poetry
run: |
curl -sL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py \
| python - -y
curl -sL https://install.python-poetry.org | python - -y ${{ matrix.bootstrap-args }}

- name: Update PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH

Expand All @@ -37,6 +33,7 @@ jobs:
run: |
[[ "$(poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] \
|| echo ::set-output name=prerelease::true

- name: Create Release
uses: ncipollo/release-action@v1
with:
Expand Down
102 changes: 84 additions & 18 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,95 @@
ci:
autofix_prs: false

repos:
- repo: https://github.com/psf/black
rev: 21.11b1
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: black
- id: trailing-whitespace
- id: end-of-file-fixer
exclude: ^.*\.egg-info/
- id: check-merge-conflict
- id: check-case-conflict
- id: check-json
- id: check-toml
- id: check-yaml
- id: pretty-format-json
args: [--autofix, --no-ensure-ascii, --no-sort-keys]
- id: check-ast
- id: debug-statements
- id: check-docstring-first

- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
hooks:
- id: flake8
- id: python-check-mock-methods
- id: python-use-type-annotations
- id: python-check-blanket-type-ignore
- id: python-check-blanket-noqa

- repo: https://github.com/timothycrosley/isort
rev: 5.10.1
- repo: https://github.com/asottile/yesqa
rev: v1.3.0
hooks:
- id: isort
additional_dependencies: [toml]
exclude: ^.*/?setup\.py$
- id: yesqa
additional_dependencies: &flake8_deps
- flake8-annotations==2.7.0
- flake8-broken-line==0.4.0
- flake8-bugbear==21.9.2
- flake8-comprehensions==3.7.0
- flake8-eradicate==1.2.0
- flake8-no-pep420==1.2.0
- flake8-quotes==3.3.1
- flake8-simplify==0.14.2
- flake8-tidy-imports==4.5.0
- flake8-type-checking==1.1.0
- flake8-typing-imports==1.11.0
- flake8-use-fstring==1.3
- pep8-naming==0.12.1

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
- repo: https://github.com/asottile/pyupgrade
rev: v2.31.1
hooks:
- id: trailing-whitespace
- id: pyupgrade
args: [--py37-plus]
exclude: ^(install|get)-poetry.py$

- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
name: "isort (python)"
types: [python]
args: [--add-import, from __future__ import annotations]
exclude: |
(?x)(
^tests/.*/fixtures/.*
^(install|get)-poetry.py$
| ^src/poetry/__init__.py$
)
- id: end-of-file-fixer
exclude: ^tests/.*/fixtures/.*
- id: debug-statements
- id: isort
name: "isort (pyi)"
types: [pyi]
args: [--lines-after-imports, "-1"]

- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black

- repo: https://github.com/pycqa/flake8
rev: 4.0.1
hooks:
- id: flake8
additional_dependencies: *flake8_deps

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.942
hooks:
- id: mypy
pass_filenames: false
additional_dependencies:
- types-requests

- repo: https://github.com/pre-commit/pre-commit
rev: v2.18.1
hooks:
- id: validate_manifest
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Poetry export plugin
# Poetry Plugin: Export

This package is a plugin that allows the export of locked packages to various formats.

Expand All @@ -12,19 +12,19 @@ This plugin provides the same features as the existing `export` command of Poetr
The easiest way to install the `export` plugin is via the `plugin add` command of Poetry.

```bash
poetry plugin add poetry-export-plugin
poetry plugin add poetry-plugin-export
```

If you used `pipx` to install Poetry you can add the plugin via the `pipx inject` command.

```bash
pipx inject poetry poetry-export-plugin
pipx inject poetry poetry-plugin-export
```

Otherwise, if you used `pip` to install Poetry you can add the plugin packages via the `pip install` command.

```bash
pip install poetry-export-plugin
pip install poetry-plugin-export
```


Expand Down
Loading