Skip to content

Commit

Permalink
[#34] Relax black version requirements (PR #88)
Browse files Browse the repository at this point in the history
* move `black` and `autopep8` from `install_requires` to `extras_require`
* add `usage` workflow to test installation of `pipenv-setup`, `pipenv-setup[black]`, and `pipenv-setup[autopep8]`
* update behavior: if `black` is present, use it to format `setup.py`; if `black` isn't installed, try `autopep8`; if neither is installed, don't format `setup.py`
  • Loading branch information
bryant-finney authored Nov 29, 2021
1 parent d3cc76f commit e04bea6
Show file tree
Hide file tree
Showing 7 changed files with 454 additions and 302 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
name: test-${{ matrix.os }}-python${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# this works like a loop; think `pytest.mark.parametrize`
python-version: [2.7, 3.5, 3.6, 3.7, 3.8]
Expand Down
89 changes: 89 additions & 0 deletions .github/workflows/usage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# -------------------------------------------------------------------------------------
# Summary: Test the external CLI usage of this project.
# Created: 2021-11-20 18:44:48
# Author: Bryant Finney <[email protected]> (https://bryant-finney.github.io/about)
# -------------------------------------------------------------------------------------
name: Test Usage

on:
push:
pull_request:
workflow_dispatch:
release:
types: [published]

jobs:
build:
name: Build wheel
outputs:
wheel: ${{ steps.build.outputs.wheel }}

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2

- name: Prepare build system
run: pip install --upgrade pip setuptools wheel

- name: Build wheel and source distribution 🛠️
id: build
run: |
python setup.py sdist bdist_wheel
echo "::set-output name=wheel::$(ls ./dist/*.whl)"
- name: Upload build artifacts ⬆️
uses: actions/upload-artifact@v2
with:
name: dist
path: dist/*.whl

test-install:
name: "${{ matrix.os }} | py${{ matrix.py }}: ${{ matrix.manager }} install ${{ needs.build.outputs.wheel }}[${{ matrix.extras }}]"
needs: build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
extras: ["", "dev", "black", "autopep8"]
manager: [pip, pipenv]
os: [ubuntu-latest, windows-latest, macos-latest]
py: [3.7, 3.8]

steps:
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.py }}

- name: Update ${{ matrix.manager }}
run: echo "${{ matrix.manager }}" | grep pipenv | xargs pip install --upgrade pip

- name: Download build artifacts ⬇️
uses: actions/download-artifact@v2
with:
name: dist
path: dist

- name: Install using ${{ matrix.manager }} ➕
if: "!${{ matrix.extras }}"
run: ${{ matrix.manager }} install "${{ needs.build.outputs.wheel }}"

- name: Install (with [${{ matrix.extras }}] extras) using ${{ matrix.manager }} ➕
if: ${{ matrix.extras }}
run: ${{ matrix.manager }} install "${{ needs.build.outputs.wheel }}[${{ matrix.extras }}]"

- name: "Verify ${{ matrix.extras }} installation (${{ matrix.manager }}) 🖨️"
if: ${{ matrix.manager == 'pip' && matrix.extras && matrix.extras != 'dev' }}
run: ${{ matrix.extras }} --version

- name: "Verify ${{ matrix.extras }} installation (${{ matrix.manager }}) 🖨️"
if: ${{ matrix.manager == 'pipenv' && matrix.extras && matrix.extras != 'dev' }}
run: pipenv run ${{ matrix.extras }} --version

- name: "Verify package installation (${{ matrix.manager }}) 🖨️"
if: ${{ matrix.manager == 'pip' }}
run: pipenv-setup --help

- name: "Verify installation (${{ matrix.manager }}) 🖨️"
if: ${{ matrix.manager == 'pipenv' }}
run: pipenv run pipenv-setup --help
3 changes: 1 addition & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
black = { markers = "python_version>='3.6'", version = "==19.10b0" }
pipenv-setup = { editable = true, path = "." }
pytest = { markers = "python_version>='3.6'", version = "~=5.2" }
pytest-mypy = { markers = "python_version>='3.5'", version = ">=0.8" }
Expand All @@ -16,12 +17,10 @@ types-six = "*"

[packages]
pipfile = "~=0.0"
black = { markers = "python_version>='3.6'", version = "==19.10b0" }
colorama = "~=0.4"
packaging = "~=20.0"
requirementslib = "~=1.5"
vistir = "~=0.4"
autopep8 = { markers = "python_version<'3.6'", version = "~=1.4" }
six = "~=1.12"
typing = { markers = "python_version<'3.7'", version = "~=3.7" }
chardet = ">=3.0.0, <=5.0.0"
Expand Down
Loading

0 comments on commit e04bea6

Please sign in to comment.