Skip to content

Commit

Permalink
Merge pull request #46 from nschloe/modernize
Browse files Browse the repository at this point in the history
Modernize
  • Loading branch information
nschloe authored Jul 29, 2020
2 parents 765e903 + a0bbdd6 commit 1c9a690
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 64 deletions.
29 changes: 0 additions & 29 deletions .circleci/config.yml

This file was deleted.

File renamed without changes.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v1
- uses: actions/setup-python@v2
with:
python-version: "3.x"
- uses: actions/checkout@v2
Expand All @@ -23,11 +23,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.5, 3.6, 3.7, 3.8]
python-version: [3.6, 3.7, 3.8]
steps:
- uses: actions/setup-python@v1
- uses: actions/setup-python@v2
with:
python-version: "3.x"
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v2
- name: Install dependencies
run: |
Expand All @@ -37,5 +37,5 @@ jobs:
pip install tox
tox
- name: Submit to codecov
if: matrix.python-version == 3.8
uses: codecov/codecov-action@v1
if: ${{ matrix.python-version == '3.8' }}
run: bash <(curl -s https://codecov.io/bash)
11 changes: 2 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,12 @@ default:
tag:
# Make sure we're on the master branch
@if [ "$(shell git rev-parse --abbrev-ref HEAD)" != "master" ]; then exit 1; fi
# @echo "Tagging v$(VERSION)..."
# git tag v$(VERSION)
# git push --tags
curl -H "Authorization: token `cat $(HOME)/.github-access-token`" -d '{"tag_name": "v$(VERSION)"}' https://api.github.com/repos/nschloe/termplotlib/releases

upload: setup.py
@if [ "$(shell git rev-parse --abbrev-ref HEAD)" != "master" ]; then exit 1; fi
rm -f dist/*
python3 setup.py sdist
python3 setup.py bdist_wheel
python3 -m pep517.build --source --binary .
twine upload dist/*

publish: tag upload
Expand All @@ -29,8 +25,5 @@ lint:
flake8 .

format:
isort -rc .
black .

black:
isort .
black .
12 changes: 5 additions & 7 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = termplotlib
version = 0.3.1
version = 0.3.2
author = Nico Schlömer
email = [email protected]
description = Plotting on the command line
Expand All @@ -10,8 +10,8 @@ project_urls =
Issues=https://github.com/nschloe/termplotlib/issues
long_description = file: README.md
long_description_content_type = text/markdown
license = GPLv3
platforms = any
license = GPL-3.0-or-later
license_file = LICENSE.txt
classifiers =
Development Status :: 4 - Beta
Environment :: Console
Expand All @@ -20,7 +20,6 @@ classifiers =
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Expand All @@ -29,10 +28,9 @@ classifiers =

[options]
packages = find:
# importlib_metadata can be removed when we support Python 3.8+ only
install_requires =
importlib_metadata
python_requires = >=3.5
importlib_metadata;python_version<"3.8"
python_requires = >=3.6
setup_requires =
setuptools>=42
wheel
2 changes: 1 addition & 1 deletion termplotlib/hist.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def hist(
force_ascii=force_ascii,
)

assert orientation == "horizontal", "Unknown orientation '{}'".format(orientation)
assert orientation == "horizontal", f"Unknown orientation '{orientation}'"
return hist_horizontal(
counts,
bin_edges,
Expand Down
12 changes: 6 additions & 6 deletions termplotlib/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ def plot(

gnuplot_input = []

gnuplot_input.append("set term dumb mono {},{}".format(width, height))
gnuplot_input.append(f"set term dumb mono {width},{height}")
# gnuplot_input.append("set tics nomirror")
gnuplot_input.append("set tics scale {}".format(ticks_scale))
gnuplot_input.append(f"set tics scale {ticks_scale}")

if xlim:
gnuplot_input.append("set xrange [{}:{}]".format(xlim[0], xlim[1]))
Expand All @@ -35,24 +35,24 @@ def plot(
gnuplot_input.append("set yrange [{}:{}]".format(ylim[0], ylim[1]))

if xlabel:
gnuplot_input.append('set xlabel "{}"'.format(xlabel))
gnuplot_input.append(f'set xlabel "{xlabel}"')

if title:
gnuplot_input.append('set title "{}"'.format(title))
gnuplot_input.append(f'set title "{title}"')

if extra_gnuplot_arguments:
gnuplot_input += extra_gnuplot_arguments

string = plot_command
if label:
string += " title '{}'".format(label)
string += f" title '{label}'"
else:
string += " notitle"

gnuplot_input.append(string)

for xx, yy in zip(x, y):
gnuplot_input.append("{:e} {:e}".format(xx, yy))
gnuplot_input.append(f"{xx:e} {yy:e}")
gnuplot_input.append("e")

out = p.communicate(input="\n".join(gnuplot_input).encode())[0]
Expand Down
4 changes: 2 additions & 2 deletions test/test_barh.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

@pytest.mark.skipif(
sys.stdout.encoding not in ["UTF-8", "UTF8"],
reason="Need UTF-8 terminal (not {})".format(sys.stdout.encoding),
reason=f"Need UTF-8 terminal (not {sys.stdout.encoding})",
)
def test_barh():
fig = tpl.figure()
Expand Down Expand Up @@ -47,7 +47,7 @@ def test_barh_ascii():

@pytest.mark.skipif(
sys.stdout.encoding not in ["UTF-8", "UTF8"],
reason="Need UTF-8 terminal (not {})".format(sys.stdout.encoding),
reason=f"Need UTF-8 terminal (not {sys.stdout.encoding})",
)
def test_barh_floats():
fig = tpl.figure()
Expand Down
8 changes: 4 additions & 4 deletions test/test_hist.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

@pytest.mark.skipif(
sys.stdout.encoding not in ["UTF-8", "UTF8"],
reason="Need UTF-8 terminal (not {})".format(sys.stdout.encoding),
reason=f"Need UTF-8 terminal (not {sys.stdout.encoding})",
)
def test_horizontal():
numpy.random.seed(123)
Expand Down Expand Up @@ -65,7 +65,7 @@ def test_horizontal_ascii():

@pytest.mark.skipif(
sys.stdout.encoding not in ["UTF-8", "UTF8"],
reason="Need UTF-8 terminal (not {})".format(sys.stdout.encoding),
reason=f"Need UTF-8 terminal (not {sys.stdout.encoding})",
)
def test_vertical():
numpy.random.seed(123)
Expand Down Expand Up @@ -125,7 +125,7 @@ def test_vertical_ascii():

@pytest.mark.skipif(
sys.stdout.encoding not in ["UTF-8", "UTF8"],
reason="Need UTF-8 terminal (not {})".format(sys.stdout.encoding),
reason=f"Need UTF-8 terminal (not {sys.stdout.encoding})",
)
def test_vertical_grid():
numpy.random.seed(123)
Expand Down Expand Up @@ -156,7 +156,7 @@ def test_vertical_grid():

@pytest.mark.skipif(
sys.stdout.encoding not in ["UTF-8", "UTF8"],
reason="Need UTF-8 terminal (not {})".format(sys.stdout.encoding),
reason=f"Need UTF-8 terminal (not {sys.stdout.encoding})",
)
def test_vertical_strip():
numpy.random.seed(20)
Expand Down

0 comments on commit 1c9a690

Please sign in to comment.