Skip to content

Commit

Permalink
Migrate openrouteservie-py to the year 2021 (#60)
Browse files Browse the repository at this point in the history
Enforce more code styles. Migrate to poetry. New publishing routines. No Conda specific release anymore. No python < 3 support.
  • Loading branch information
MichaelsJP authored May 26, 2021
1 parent 1d7b7e6 commit 0af44a1
Show file tree
Hide file tree
Showing 51 changed files with 2,181 additions and 1,245 deletions.
4 changes: 0 additions & 4 deletions .condarc

This file was deleted.

24 changes: 21 additions & 3 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
[run]
branch = False
source = codecov
omit =
*/venv/*
*/.venv/*
*/.env/*
*/.tox/*
*/docs/*
tests/*
setup.py

[report]
omit =
*/python?.?/*
*/site-packages/nose/*
*__init__*
*/venv/*
*/.venv/*
*/.env/*
*/.tox/*
*/docs/*
tests/*
setup.py
exclude_lines =
pragma: no cover
91 changes: 91 additions & 0 deletions .github/workflows/ci-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Continous Integration

on:
push:
branches:
- main
- master
release:
types:
- created

jobs:
linux-tests:
strategy:
fail-fast: false
matrix:
config:
- python-version: 3.6
tox: 36
- python-version: 3.7
tox: 37
- python-version: 3.8
tox: 38
- python-version: 3.9
tox: 39
- python-version: pypy-3.6
tox: py3
- python-version: pypy-3.7
tox: py3
poetry-version: [ 1.1.4 ]
os: [ macos-latest, windows-2019, ubuntu-20.04, ubuntu-18.04 ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Set up testing Python ${{ matrix.config.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.config.python-version }}
architecture: x64
- name: Set up base Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
architecture: x64
- name: Python Poetry Action
uses: abatilo/[email protected]
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Run Tox
run: tox -e py${{ matrix.config.tox }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: true
verbose: true
build-and-publish:
name: Build and publish Python distributions 📦 to PyPI and TestPyPI
runs-on: ubuntu-20.04
needs:
- linux-tests
steps:
- uses: actions/checkout@v2
- name: Set up base Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Python Poetry Action
uses: abatilo/[email protected]
with:
poetry-version: 1.1.4
- name: Publish distribution 📦 with test.pypi.org
if: startsWith(github.ref, 'refs/tags')
run: |
poetry config repositories.testpypi https://test.pypi.org/legacy/
poetry config pypi-token.testpypi ${{ secrets.TEST_PYPI_API_TOKEN }}
poetry build
poetry publish -r testpypi
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
poetry build
poetry publish
90 changes: 66 additions & 24 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,80 @@
name: tests

on:
on:
pull_request:
branches: '**'
push:
branches:
- master

jobs:
build:
runs-on: ${{ matrix.os }}
lint:
runs-on: ubuntu-20.04
steps:
- name: checkout
uses: actions/checkout@v2
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Python Poetry Action
uses: abatilo/[email protected]
with:
poetry-version: 1.1.4
- name: Install lint dependencies
run: |
pip install tox pytest pytest-cov
- name: Install and run pre-commit
uses: pre-commit/[email protected]
with:
extra_args: --all-files
test:
needs:
- lint
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
python_version: [
3.7,
3.8,
3.9,
pypy3
]
config:
- python-version: 3.6
tox: 36
- python-version: 3.7
tox: 37
- python-version: 3.8
tox: 38
- python-version: 3.9
tox: 39
- python-version: pypy-3.6
tox: py3
- python-version: pypy-3.7
tox: py3
poetry-version: [ 1.1.4 ]
os: [ macos-latest, windows-2019, ubuntu-20.04, ubuntu-18.04 ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python_version }}
- name: Set up testing Python ${{ matrix.config.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.config.python-version }}
architecture: x64
- name: Set up base Python 3.9
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python_version }}
python-version: 3.9
architecture: x64
- name: Python Poetry Action
uses: abatilo/[email protected]
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Install dependencies
run: |
pip install -r requirements-dev.txt
- name: nosetests
run: |
nosetests --with-coverage --cover-erase --cover-package=openrouteservice -v
- name: coveralls
run: |
coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
python -m pip install --upgrade pip
pip install tox
- name: Run Tox
run: tox -e py${{ matrix.config.tox }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: true
verbose: true
19 changes: 0 additions & 19 deletions .github/workflows/conda-package.yml

This file was deleted.

39 changes: 0 additions & 39 deletions .github/workflows/python-package.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.tox/
.venv/
.coverage
**/.ipynb_checkpoints/
Expand All @@ -16,3 +17,6 @@ test.py

cover/
conda/
*coverage.xml
/setup.py
/requirements.txt
55 changes: 55 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
exclude: |
(?x)(
^conda.recipe/meta.yaml
)
- id: check-json
- id: forbid-new-submodules
- id: mixed-line-ending
args: [ '--fix=lf' ]
description: Forces to replace line ending by the UNIX 'lf' character.
- id: pretty-format-json
args: [ '--no-sort-keys' ]
- id: no-commit-to-branch
args: [ --branch, master ]
- id: no-commit-to-branch
args: [ --branch, main ]

- repo: https://github.com/ambv/black
rev: stable
hooks:
- id: black
args: # arguments to configure black
- --line-length=80
language_version: python3.9
- repo: https://gitlab.com/pycqa/flake8
rev: "3.8.4"
hooks:
- id: flake8
exclude: |
(?x)(
^test/* |
^docs/*
)
args:
- "--max-line-length=120"
- "--ignore=P101,D202,D401"
additional_dependencies:
[
"flake8-bugbear==19.8.0",
"flake8-coding==1.3.2",
"flake8-comprehensions==3.0.1",
"flake8-debugger==3.2.1",
"flake8-deprecated==1.3",
"flake8-pep3101==1.2.1",
"flake8-polyfill==1.0.2",
"flake8-print==3.1.4",
"flake8-string-format==0.2.3",
"flake8-docstrings==1.5.0",
]
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include README.rst
include README.rst
Loading

0 comments on commit 0af44a1

Please sign in to comment.