Skip to content

Commit

Permalink
Merge pull request #20 from hacf-fr/poetry
Browse files Browse the repository at this point in the history
Migrate to Poetry.

Contribute to #18
  • Loading branch information
oncleben31 authored Jul 27, 2020
2 parents e465db7 + c309870 commit 3ca77ef
Show file tree
Hide file tree
Showing 13 changed files with 590 additions and 106 deletions.
11 changes: 0 additions & 11 deletions .coveragerc

This file was deleted.

24 changes: 6 additions & 18 deletions setup.cfg → .flake8
Original file line number Diff line number Diff line change
@@ -1,30 +1,18 @@


[metadata]
description-file = README.md

[tool:pytest]
addopts = --verbose
python_files = tests/*.py

[tool:isort]
line_length = 88
multi_line_output = 3
include_trailing_comma = true

[flake8]
select = C,D,E,F,W
max-complexity = 10
docstring-convention = google
exclude = .venv,.git,.tox,docs,venv,bin,lib,deps,build,.eggs
doctests = True

# To work with Black
max-line-length = 88
# E501: line too long
# W503: Line break occurred before a binary operator
# E203: Whitespace before ':'
# D202 No blank lines allowed after function docstring
# W504 line break after binary operator
# ignore =
ignore = W503
# E501,
# W503,
# E203,
# D202,
# W504
# W504
37 changes: 12 additions & 25 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,25 @@
name: "Release actions"

name: Release
on:
push:
tags:
- "*"
release:
types: [published]

jobs:
deploy:
release:
runs-on: ubuntu-latest
name: Deploy to PyPi
steps:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: "3.x"
python-version: "3.8"
architecture: x64

- name: Install dependencies
run: python -m pip install setuptools wheel twine black pytest .[testing]

- run: python3 -m black .

- run: python3 -m pytest

- uses: olegtarasov/get-tag@v2
name: Set tag envronment variable
run: pip install poetry==1.0.9

- name: Set version number
run: |
sed -i "s/version=\"0.0.0\"/version=\"$GIT_TAG_NAME\"/" ${{github.workspace}}/setup.py
- name: Publish to PyPi
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
# - run: python3 -m black .
- run: poetry install
- run: poetry run pytest
- run: poetry build
- run: poetry publish --username=__token__ --password=${{ secrets.PYPI_TOKEN }}
15 changes: 5 additions & 10 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,18 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Install dependencies
run: |
python -m pip install --upgrade pip
# Requirements for package tests
pip install .[testing]
# Requirement for CI tests
pip install flake8
pip install poetry==1.0.9
poetry install
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
poetry run flake8
- name: Test with pytest
run: |
pytest --cov --cov-report=xml
poetry run pytest --cov --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
Expand Down
Loading

0 comments on commit 3ca77ef

Please sign in to comment.