Skip to content

Commit 5e2cf3c

Browse files
authored
Merge pull request #17 from Anselmoo/dev-updates
Update setup.py and style Replaced travis by github-action
2 parents 727da12 + f619364 commit 5e2cf3c

File tree

13 files changed

+153
-80
lines changed

13 files changed

+153
-80
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Python Package
5+
6+
on:
7+
push:
8+
branches: [ master ]
9+
pull_request:
10+
branches: [ master ]
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
python-version: [3.6, 3.7, 3.8, 3.9]
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v2
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
30+
if [ -f dev-requirements.txt ]; then pip install -r dev-requirements.txt; fi
31+
- name: Lint with flake8, black, isort, pydocstyle
32+
run: |
33+
flake8 bashplot/ --count --max-line-length=88 --ignore=W293,W291 --statistic
34+
black . --check -v
35+
isort . --check -v
36+
flake8 . --count --exit-zero --max-complexity=10 --statistics
37+
pydocstyle --convention=numpy -e bashplot/bashplot.py
38+
- name: Test with pytest
39+
run: |
40+
coverage run --source=./test -m unittest
41+
coverage report -m
42+
- name: Codecov
43+
uses: codecov/codecov-action@v1
44+
with:
45+
token: ${{ secrets.CODECOV_TOKEN }}
46+
env_vars: OS,PYTHON
47+
deploy:
48+
runs-on: ubuntu-latest
49+
needs: build
50+
steps:
51+
- name: Publish package
52+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
53+
- uses: actions/checkout@v2
54+
- name: Set up Python
55+
uses: actions/setup-python@v2
56+
with:
57+
python-version: '3.8'
58+
- name: Install dependencies
59+
run: |
60+
python -m pip install --upgrade pip
61+
pip install setuptools wheel twine
62+
- name: Build and publish on PyPi
63+
env:
64+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
65+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
66+
run: |
67+
python setup.py sdist bdist_wheel
68+
twine upload dist/*

.gitignore

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1 @@
1-
html/
2-
build/
3-
dist/
4-
bashplot.egg-info/
5-
.DS_Store
6-
.coverage
7-
__pycache__
8-
.coverage
9-
test/.coverage
10-
.dccache
1+
Pipfile.lock

.travis.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

Pipfile

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
[[source]]
2-
name = "pypi"
32
url = "https://pypi.org/simple"
43
verify_ssl = true
5-
6-
[dev-packages]
4+
name = "pypi"
75

86
[packages]
9-
plotille = "*"
10-
numpy = "*"
11-
pytest = "*"
12-
pytest-cov = "*"
7+
bashplot = {editable = true, path = "."}
8+
9+
[dev-packages]
1310
coverage = "*"
11+
pytest = "*"
12+
isort = "*"
13+
black = "==20.8b1"
14+
flake8 = "*"
15+
pydocstyle = "*"
1416

1517
[requires]
16-
python_version = "3.7"
18+
python_version = "3.8"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Travis (.com) branch](https://img.shields.io/travis/com/Anselmoo/bashplot/master?logo=travis)](https://travis-ci.com/Anselmoo/bashplot)
1+
![Python Package](https://github.com/Anselmoo/bashplot/workflows/Python%20Package/badge.svg)
22
[![CodeFactor Grade](https://img.shields.io/codefactor/grade/github/Anselmoo/bashplot/master?logo=codefactor)](https://www.codefactor.io/repository/github/anselmoo/bashplot)
33
[![Codecov branch](https://img.shields.io/codecov/c/github/Anselmoo/bashplot/master?logo=Codecov)](https://codecov.io/gh/Anselmoo/bashplot)
44
[![Code Style: Black](https://img.shields.io/badge/code%20style-black-black.svg)](https://github.com/ambv/black)
@@ -278,7 +278,7 @@ bashplot.bashplot(fnames, args)
278278

279279
I'm happy to accept how to improve batchplot; please forward your [issues](https://github.com/Anselmoo/bashplot/issues) or [pull requests](https://github.com/Anselmoo/bashplot/pulls).
280280

281-
Keep in mind that [pull requests](https://github.com/Anselmoo/bashplot/pulls) have to pass TravisCI in combination with [flake8](https://github.com/PyCQA/flake8), [black](https://github.com/psf/black), and [pydocstyle](https://github.com/PyCQA/pydocstyle).
281+
Keep in mind that [pull requests](https://github.com/Anselmoo/bashplot/pulls) have to pass TravisCI in combination with [flake8](https://github.com/PyCQA/flake8), [black](https://github.com/psf/black), [isort](https://github.com/PyCQA/isort) and [pydocstyle](https://github.com/PyCQA/pydocstyle).
282282

283283
## License
284284
---

azure-pipelines.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ strategy:
1616
python.version: '3.7'
1717
Python38:
1818
python.version: '3.8'
19+
Python39:
20+
python.version: '3.9'
1921

2022
steps:
2123
- task: UsePythonVersion@0
@@ -41,7 +43,7 @@ steps:
4143
- script: |
4244
4345
pip install coverage
44-
pipt install pytest-azurepipelines
46+
pip install pytest-azurepipelines
4547
cd test
4648
coverage run -m unittest test_bashplot.py
4749
coverage report

bashplot/bashplot.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
######################################################
1212

1313
import argparse
14-
from pathlib import Path
1514
import sys
15+
from pathlib import Path
1616

1717
import numpy as np
1818
import plotille as plt
@@ -96,8 +96,7 @@ def plot_plot(fig, x, Y, label):
9696
fig.plot(x, Y[:, 0], label=label)
9797
if Y.shape[1] == 1:
9898
return fig
99-
else:
100-
return plot_plot(fig, x, Y[:, 1:], label=label)
99+
return plot_plot(fig, x, Y[:, 1:], label=label)
101100

102101

103102
def plot_scatter(fig, x, Y, label):
@@ -128,8 +127,7 @@ def plot_scatter(fig, x, Y, label):
128127
fig.scatter(x, Y[:, 0], label=label)
129128
if Y.shape[1] == 1:
130129
return fig
131-
else:
132-
return plot_plot(fig, x, Y[:, 1:], label=label)
130+
return plot_plot(fig, x, Y[:, 1:], label=label)
133131

134132

135133
def plot(data, args, label):

dev-requirements.txt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#
2+
# These requirements were autogenerated by pipenv
3+
# To regenerate from the project's Pipfile, run:
4+
#
5+
# pipenv lock --requirements --dev-only
6+
#
7+
8+
-i https://pypi.org/simple
9+
appdirs==1.4.4
10+
attrs==20.3.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
11+
black==20.8b1
12+
click==7.1.2; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
13+
coverage==5.3.1
14+
flake8==3.8.4
15+
iniconfig==1.1.1
16+
isort==5.7.0
17+
mccabe==0.6.1
18+
mypy-extensions==0.4.3
19+
packaging==20.8; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
20+
pathspec==0.8.1
21+
pluggy==0.13.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
22+
py==1.10.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
23+
pycodestyle==2.6.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
24+
pydocstyle==5.1.1
25+
pyflakes==2.2.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
26+
pyparsing==2.4.7; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'
27+
pytest==6.2.1
28+
regex==2020.11.13
29+
snowballstemmer==2.0.0
30+
toml==0.10.2; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'
31+
typed-ast==1.4.2
32+
typing-extensions==3.7.4.3

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["setuptools", "wheel"]
3+
build-backend = "setuptools.build_meta:__legacy__"

requirements.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
numpy>=1.10
2-
plotille>=3.3
1+
numpy==1.19.5; python_version >= '3.6'
2+
plotille==3.7.2; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
3+
six==1.15.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'

0 commit comments

Comments
 (0)