Skip to content

Commit

Permalink
Merge pull request #44 from jannikmi/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
jannikmi committed Jul 10, 2022
2 parents 1e7dc9b + 04fbdc3 commit dc78db2
Show file tree
Hide file tree
Showing 34 changed files with 1,242 additions and 867 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/build.yml
@@ -0,0 +1,89 @@
name: build

on:
pull_request:
push:
branches:
- master
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
strategy:
# By default, GitHub will maximize the number of jobs run in parallel
# depending on the available runners on GitHub-hosted virtual machines.
# max-parallel: 8
fail-fast: false
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
env:
TOXENV: ${{ matrix.tox-env }}
TOX_SKIP_MISSING_INTERPRETERS: False
steps:
- uses: actions/checkout@v2

- name: Run pre-commit hook
uses: pre-commit/action@v2.0.3
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Upgrade pip version
run: pip install -U pip

- name: Install test dependencies
run: pip install tox tox-gh-actions poetry

- name: Run tox
run: tox

deploy:
runs-on: ubuntu-latest
needs: test
if: endsWith(github.ref, '/master')
steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install build dependencies
run: |
pip install poetry
- name: Fetch version
id: fetch_version
run: echo "::set-output name=version_nr::$(poetry version -s)"

- name: Build a binary wheel and a source tarball
# Note: poetry build required to support CLI script entrypoint in pyproject.toml?!
run: |
poetry build
- name: Create GitHub Release
id: create_gh_release
uses: actions/create-release@v1
env:
# use token provided by Actions
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ steps.fetch_version.outputs.version_nr }}
with:
tag_name: ${{env.VERSION}}
release_name: Release ${{env.VERSION}}
draft: false
prerelease: false

- name: PyPI Publishing
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_DEPLOYMENT_API_KEY }}
118 changes: 58 additions & 60 deletions .pre-commit-config.yaml
@@ -1,71 +1,69 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: check-ast # Is it valid Python?
- id: debug-statements # no debbuging statements used
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-case-conflict
# - id: check-executables-have-shebangs
- id: check-json
- id: pretty-format-json
args: [ "--autofix" ]
- id: check-merge-conflict
- id: name-tests-test
- id: check-docstring-first
- id: requirements-txt-fixer
# - id: detect-aws-credentials
- id: detect-private-key
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-ast # Is it valid Python?
- id: debug-statements # no debbuging statements used
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-case-conflict
# - id: check-executables-have-shebangs
- id: check-json
- id: pretty-format-json
args: [ "--autofix" ]
- id: check-merge-conflict
- id: check-docstring-first
- id: requirements-txt-fixer
# - id: detect-aws-credentials
- id: detect-private-key

- repo: https://github.com/pycqa/isort
rev: 5.7.0
hooks:
- id: isort
args: [ "--profile", "black", "--filter-files" ]
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
args: [ "--profile", "black", "--filter-files" ]

- repo: https://github.com/psf/black
rev: 20.8b1
hooks:
- id: black
language_version: python3
- repo: https://github.com/asottile/blacken-docs
rev: v1.9.2
hooks:
- id: blacken-docs
additional_dependencies: [ black==20.8b1 ]
- repo: https://github.com/psf/black
rev: 22.6.0
hooks:
- id: black
language_version: python3
args:
- --line-length=120

- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
hooks:
- id: flake8
exclude: "docs/"
args: ['--ignore','W503'] # line break before binary operator
additional_dependencies:
- flake8-bugbear
- flake8-comprehensions
- flake8-tidy-imports
- repo: https://github.com/asottile/blacken-docs
rev: v1.12.1
hooks:
- id: blacken-docs
additional_dependencies: [ black ]

- repo: https://github.com/mgedmin/check-manifest
rev: "0.46"
hooks:
- id: check-manifest
args: [ "--no-build-isolation", "--ignore", "*.png,.travis/*,docs/*,build_n_install.py,publish.py,readthedocs.yml" ]
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
exclude: ^(docs|scripts|tests)/
args:
- --max-line-length=120
additional_dependencies:
- flake8-bugbear
- flake8-comprehensions
- flake8-tidy-imports

# TODO sphinx check
# - repo: https://github.com/myint/rstcheck
# rev: 'v3.3.1'
# hooks:
# - id: rstcheck
- repo: https://github.com/mgedmin/check-manifest
rev: "0.48"
hooks:
- id: check-manifest
args: [ "--no-build-isolation", "--ignore", "*.png,docs/*,publish.py,readthedocs.yml,poetry.lock,setup.py" ]
additional_dependencies: [ numpy, poetry==1.1.11 ]

- repo: https://github.com/asottile/pyupgrade
rev: v2.9.0
hooks:
- id: pyupgrade
- repo: https://github.com/asottile/pyupgrade
rev: v2.36.0
hooks:
- id: pyupgrade

# # very detailed linting:
# TODO enable for very detailed linting:
# - repo: https://github.com/pycqa/pylint
# rev: pylint-2.6.0
# hooks:
Expand Down
6 changes: 0 additions & 6 deletions .travis/install.sh

This file was deleted.

8 changes: 0 additions & 8 deletions .travis/run.sh

This file was deleted.

6 changes: 5 additions & 1 deletion CHANGELOG.rst
Expand Up @@ -2,7 +2,11 @@ Changelog
=========


TODO python 3.6 support. tests not passing so far only for this python version
2.2.1 (2022-07-10)
-------------------

* packaging completely based on pyproject.toml (poetry)
* CI/CD: automatic publishing based on GitHub Actions

2.2.0 (2021-01-25)
-------------------
Expand Down
23 changes: 0 additions & 23 deletions MANIFEST.in

This file was deleted.

38 changes: 38 additions & 0 deletions Makefile
@@ -0,0 +1,38 @@
pin:
@echo "pinning the dependencies specified in 'pyproject.toml':"
@poetry update -vv
#poetry export -f requirements.txt --output docs/requirements.txt --without-hashes

req:
@echo "installing the development dependencies..."
@poetry install
@#poetry install --no-dev


update: pin req

test:
@tox
#pytest

hook:
@pre-commit install
@pre-commit run --all-files

hook2:
@pre-commit autoupdate

clean:
rm -rf .pytest_cache .coverage coverage.xml tests/__pycache__ .mypyp_cache/ .tox


build:
poetry build

# documentation generation:
# https://docs.readthedocs.io/en/stable/intro/getting-started-with-sphinx.html
docs:
(cd docs && make html)


.PHONY: clean test build docs
3 changes: 1 addition & 2 deletions README.rst
Expand Up @@ -36,8 +36,7 @@ python package for fast geometric shortest path computation in 2D multi-polygon

Quick Guide:

::

.. code-block:: console
pip install extremitypathfinder
Expand Down
4 changes: 0 additions & 4 deletions TODOs.txt

This file was deleted.

1 change: 0 additions & 1 deletion VERSION

This file was deleted.

37 changes: 0 additions & 37 deletions build_n_install.py

This file was deleted.

3 changes: 2 additions & 1 deletion docs/0_getting_started.rst
Expand Up @@ -10,7 +10,8 @@ Installation

Installation with pip:

::

.. code-block:: console
pip install extremitypathfinder
Expand Down

0 comments on commit dc78db2

Please sign in to comment.