From 4779de9aa12ff4011b46d60accae354bbd86d281 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Schl=C3=B6mer?= Date: Mon, 11 Mar 2019 00:12:32 +0100 Subject: [PATCH 1/2] rename to termiplot --- .circleci/config.yml | 6 +-- Makefile | 8 ++-- README.md | 54 ++++++++++++------------ setup.py | 6 +-- {asciiplotlib => termiplot}/__about__.py | 0 {asciiplotlib => termiplot}/__init__.py | 0 {asciiplotlib => termiplot}/figure.py | 0 {asciiplotlib => termiplot}/helpers.py | 0 {asciiplotlib => termiplot}/hist.py | 0 {asciiplotlib => termiplot}/plot.py | 0 {asciiplotlib => termiplot}/subplot.py | 0 {asciiplotlib => termiplot}/table.py | 0 test/test_figure.py | 14 +++--- test/test_hist.py | 14 +++--- test/test_plot.py | 8 ++-- test/test_subplot.py | 12 +++--- test/test_table.py | 24 +++++------ 17 files changed, 73 insertions(+), 73 deletions(-) rename {asciiplotlib => termiplot}/__about__.py (100%) rename {asciiplotlib => termiplot}/__init__.py (100%) rename {asciiplotlib => termiplot}/figure.py (100%) rename {asciiplotlib => termiplot}/helpers.py (100%) rename {asciiplotlib => termiplot}/hist.py (100%) rename {asciiplotlib => termiplot}/plot.py (100%) rename {asciiplotlib => termiplot}/subplot.py (100%) rename {asciiplotlib => termiplot}/table.py (100%) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0533e4f..8ea9532 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -13,10 +13,10 @@ jobs: - run: pip3 install . - run: pip3 install -r test_requirements.txt # format and lint - - run: LC_ALL=C.UTF-8 black --check setup.py asciiplotlib/ test/*.py - - run: flake8 setup.py asciiplotlib/ test/*.py + - run: LC_ALL=C.UTF-8 black --check setup.py termiplot/ test/*.py + - run: flake8 setup.py termiplot/ test/*.py # The tests - - run: cd test/ && MPLBACKEND=Agg pytest --cov asciiplotlib + - run: cd test/ && MPLBACKEND=Agg pytest --cov termiplot # submit to codecov - run: apt-get install -y curl - run: bash <(curl -s https://codecov.io/bash) -R ~/work diff --git a/Makefile b/Makefile index 5ac3c52..7dc860a 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION=$(shell python3 -c "import asciiplotlib; print(asciiplotlib.__version__)") +VERSION=$(shell python3 -c "import termiplot; print(termiplot.__version__)") default: @echo "\"make publish\"?" @@ -24,8 +24,8 @@ clean: @rm -rf *.egg-info/ build/ dist/ MANIFEST .pytest_cache/ lint: - black --check setup.py asciiplotlib/ test/*.py - flake8 setup.py asciiplotlib/ test/*.py + black --check setup.py termiplot/ test/*.py + flake8 setup.py termiplot/ test/*.py black: - black setup.py asciiplotlib/ test/*.py + black setup.py termiplot/ test/*.py diff --git a/README.md b/README.md index 84bd7e7..02fbfcc 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,26 @@ -# asciiplotlib +# termiplot -[![CircleCI](https://img.shields.io/circleci/project/github/nschloe/asciiplotlib/master.svg)](https://circleci.com/gh/nschloe/asciiplotlib) -[![codecov](https://img.shields.io/codecov/c/github/nschloe/asciiplotlib.svg)](https://codecov.io/gh/nschloe/asciiplotlib) +[![CircleCI](https://img.shields.io/circleci/project/github/nschloe/termiplot/master.svg)](https://circleci.com/gh/nschloe/termiplot) +[![codecov](https://img.shields.io/codecov/c/github/nschloe/termiplot.svg)](https://codecov.io/gh/nschloe/termiplot) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black) -[![PyPi Version](https://img.shields.io/pypi/v/asciiplotlib.svg)](https://pypi.org/project/asciiplotlib) -[![GitHub stars](https://img.shields.io/github/stars/nschloe/asciiplotlib.svg?logo=github&label=Stars&logoColor=white)](https://github.com/nschloe/asciiplotlib) +[![PyPi Version](https://img.shields.io/pypi/v/termiplot.svg)](https://pypi.org/project/termiplot) +[![GitHub stars](https://img.shields.io/github/stars/nschloe/termiplot.svg?logo=github&label=Stars&logoColor=white)](https://github.com/nschloe/termiplot) -asciiplotlib is a Python 3 library for all your terminal plotting needs. It aims to work +termiplot is a Python 3 library for all your terminal plotting needs. It aims to work like [matplotlib](https://matplotlib.org/). ### Line plots -For line plots, asciiplotlib relies on [gnuplot](http://www.gnuplot.info/). With that installed, the code +For line plots, termiplot relies on [gnuplot](http://www.gnuplot.info/). With that installed, the code ```python -import asciiplotlib as apl +import termiplot as tp import numpy x = numpy.linspace(0, 2 * numpy.pi, 10) y = numpy.sin(x) -fig = apl.figure() +fig = tp.figure() fig.plot(x, y, label="data", width=50, height=15) fig.show() ``` @@ -44,34 +44,34 @@ produces ### Tables -asciiplotlib provides many options for table plotting. For the most basic example, the +termiplot provides many options for table plotting. For the most basic example, the code ```python -import asciiplotlib as apl +import termiplot as tp import numpy numpy.random.seed(0) data = numpy.random.rand(5, 2) -fig = apl.figure() +fig = tp.figure() fig.table(data) fig.show() ``` produces -![table1](https://nschloe.github.io/asciiplotlib/table1.png) +![table1](https://nschloe.github.io/termiplot/table1.png) You can control border style, padding, alignment, and various other attributes. For example, ```python -import asciiplotlib as apl +import termiplot as tp data = [ [["a", "bb", "ccc"]], [[1, 2, 3], [613.23236243236, 613.23236243236, 613.23236243236]], ] -fig = apl.figure() +fig = tp.figure() fig.table(data, border_style="thin", force_ascii=True, padding=(0, 1), alignment="lcr") fig.show() ``` @@ -86,51 +86,51 @@ produces +-----------------+-----------------+-----------------+ ``` See -[`test/test_table.py`](https://github.com/nschloe/asciiplotlib/blob/master/test/test_table.py) +[`test/test_table.py`](https://github.com/nschloe/termiplot/blob/master/test/test_table.py) for more examples. ### Horizontal histograms ```python -import asciiplotlib as apl +import termiplot as tp import numpy numpy.random.seed(123) sample = numpy.random.normal(size=1000) counts, bin_edges = numpy.histogram(sample) -fig = apl.figure() +fig = tp.figure() fig.hist(counts, bin_edges, orientation="horizontal", force_ascii=False) fig.show() ``` produces -![hist1](https://nschloe.github.io/asciiplotlib/hist1.png) +![hist1](https://nschloe.github.io/termiplot/hist1.png) ### Vertical histograms ```python -import asciiplotlib as apl +import termiplot as tp import numpy numpy.random.seed(123) sample = numpy.random.normal(size=1000) counts, bin_edges = numpy.histogram(sample, bins=40) -fig = apl.figure() +fig = tp.figure() fig.hist(counts, bin_edges, grid=[15, 25], force_ascii=False) fig.show() ``` produces -![hist2](https://nschloe.github.io/asciiplotlib/hist2.png) +![hist2](https://nschloe.github.io/termiplot/hist2.png) ### Installation -asciiplotlib is [available from the Python Package -Index](https://pypi.org/project/asciiplotlib/), so simply do +termiplot is [available from the Python Package +Index](https://pypi.org/project/termiplot/), so simply do ``` -pip3 install -U asciiplotlib +pip3 install -U termiplot ``` to install or upgrade. Use `sudo -H` to install as root or the `--user` option of `pip3` to install in `$HOME`. @@ -138,7 +138,7 @@ of `pip3` to install in `$HOME`. ### Testing -To run the asciiplotlib unit tests, check out this repository and type +To run the termiplot unit tests, check out this repository and type ``` pytest ``` @@ -155,4 +155,4 @@ To create a new release ### License -asciiplotlib is published under the [MIT license](https://en.wikipedia.org/wiki/MIT_License). +termiplot is published under the [MIT license](https://en.wikipedia.org/wiki/MIT_License). diff --git a/setup.py b/setup.py index 3e01fc6..d31c228 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ # https://packaging.python.org/single_source_version/ base_dir = os.path.abspath(os.path.dirname(__file__)) about = {} -with open(os.path.join(base_dir, "asciiplotlib", "__about__.py"), "rb") as f: +with open(os.path.join(base_dir, "termiplot", "__about__.py"), "rb") as f: exec(f.read(), about) @@ -17,10 +17,10 @@ def read(fname): setup( - name="asciiplotlib", + name="termiplot", version=about["__version__"], packages=find_packages(), - url="https://github.com/nschloe/asciiplotlib", + url="https://github.com/nschloe/termiplot", author=about["__author__"], author_email=about["__email__"], install_requires=[], diff --git a/asciiplotlib/__about__.py b/termiplot/__about__.py similarity index 100% rename from asciiplotlib/__about__.py rename to termiplot/__about__.py diff --git a/asciiplotlib/__init__.py b/termiplot/__init__.py similarity index 100% rename from asciiplotlib/__init__.py rename to termiplot/__init__.py diff --git a/asciiplotlib/figure.py b/termiplot/figure.py similarity index 100% rename from asciiplotlib/figure.py rename to termiplot/figure.py diff --git a/asciiplotlib/helpers.py b/termiplot/helpers.py similarity index 100% rename from asciiplotlib/helpers.py rename to termiplot/helpers.py diff --git a/asciiplotlib/hist.py b/termiplot/hist.py similarity index 100% rename from asciiplotlib/hist.py rename to termiplot/hist.py diff --git a/asciiplotlib/plot.py b/termiplot/plot.py similarity index 100% rename from asciiplotlib/plot.py rename to termiplot/plot.py diff --git a/asciiplotlib/subplot.py b/termiplot/subplot.py similarity index 100% rename from asciiplotlib/subplot.py rename to termiplot/subplot.py diff --git a/asciiplotlib/table.py b/termiplot/table.py similarity index 100% rename from asciiplotlib/table.py rename to termiplot/table.py diff --git a/test/test_figure.py b/test/test_figure.py index 1a08c23..68dff03 100644 --- a/test/test_figure.py +++ b/test/test_figure.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- # -import asciiplotlib as apl +import termiplot as tp def test_simple(): - fig = apl.figure() + fig = tp.figure() fig.aprint("abc") string = fig.get_string() assert string == """abc""" @@ -12,7 +12,7 @@ def test_simple(): def test_padding_1(): - fig = apl.figure(padding=1) + fig = tp.figure(padding=1) fig.aprint("abc") string = fig.get_string() assert ( @@ -25,7 +25,7 @@ def test_padding_1(): def test_padding_1b(): - fig = apl.figure(padding=(1,)) + fig = tp.figure(padding=(1,)) fig.aprint("abc") string = fig.get_string() assert ( @@ -38,7 +38,7 @@ def test_padding_1b(): def test_padding_2(): - fig = apl.figure(padding=(1, 2)) + fig = tp.figure(padding=(1, 2)) fig.aprint("abc") string = fig.get_string() assert ( @@ -51,7 +51,7 @@ def test_padding_2(): def test_padding_3(): - fig = apl.figure(padding=(1, 2, 3)) + fig = tp.figure(padding=(1, 2, 3)) fig.aprint("abc") string = fig.get_string() assert ( @@ -66,7 +66,7 @@ def test_padding_3(): def test_padding_4(): - fig = apl.figure(padding=(1, 2, 3, 4)) + fig = tp.figure(padding=(1, 2, 3, 4)) fig.aprint("abc") string = fig.get_string() assert ( diff --git a/test/test_hist.py b/test/test_hist.py index 6a8b1c8..51a95d3 100644 --- a/test/test_hist.py +++ b/test/test_hist.py @@ -5,7 +5,7 @@ import numpy import pytest -import asciiplotlib as apl +import termiplot as tp @pytest.mark.skipif( @@ -16,7 +16,7 @@ def test_horizontal(): numpy.random.seed(123) sample = numpy.random.normal(size=1000) counts, bin_edges = numpy.histogram(sample) - fig = apl.figure() + fig = tp.figure() fig.hist(counts, bin_edges, orientation="horizontal") # fig.show() string = fig.get_string() @@ -43,7 +43,7 @@ def test_horizontal_ascii(): numpy.random.seed(123) sample = numpy.random.normal(size=1000) counts, bin_edges = numpy.histogram(sample) - fig = apl.figure() + fig = tp.figure() fig.hist(counts, bin_edges, orientation="horizontal", force_ascii=True) string = fig.get_string() @@ -73,7 +73,7 @@ def test_vertical(): numpy.random.seed(123) sample = numpy.random.normal(size=1000) counts, bin_edges = numpy.histogram(sample, bins=40) - fig = apl.figure() + fig = tp.figure() fig.hist(counts, bin_edges) fig.show() @@ -101,7 +101,7 @@ def test_vertical_ascii(): numpy.random.seed(123) sample = numpy.random.normal(size=1000) counts, bin_edges = numpy.histogram(sample, bins=40) - fig = apl.figure() + fig = tp.figure() fig.hist(counts, bin_edges, force_ascii=True) # fig.show() @@ -133,7 +133,7 @@ def test_vertical_grid(): numpy.random.seed(123) sample = numpy.random.normal(size=1000) counts, bin_edges = numpy.histogram(sample, bins=40) - fig = apl.figure() + fig = tp.figure() fig.hist(counts, bin_edges, grid=[15, 25]) # fig.show() string = fig.get_string() @@ -164,7 +164,7 @@ def test_vertical_strip(): numpy.random.seed(20) sample = numpy.random.normal(size=10000) counts, bin_edges = numpy.histogram(sample) - fig = apl.figure() + fig = tp.figure() fig.hist(counts, bin_edges, grid=[5, 8], strip=True) string = fig.get_string() diff --git a/test/test_plot.py b/test/test_plot.py index ba33ab7..91f3152 100644 --- a/test/test_plot.py +++ b/test/test_plot.py @@ -2,14 +2,14 @@ # import numpy -import asciiplotlib as apl +import termiplot as tp def test_plot(): x = numpy.linspace(0, 2 * numpy.pi, 10) y = numpy.sin(x) - fig = apl.figure() + fig = tp.figure() fig.plot(x, y, label="data", width=50, height=15) string = fig.get_string() @@ -35,7 +35,7 @@ def test_nolabel(): x = numpy.linspace(0, 2 * numpy.pi, 10) y = numpy.sin(x) - fig = apl.figure() + fig = tp.figure() fig.plot(x, y, width=50, height=15) string = fig.get_string() @@ -61,7 +61,7 @@ def test_plot_lim(): x = numpy.linspace(0, 2 * numpy.pi, 10) y = numpy.sin(x) - fig = apl.figure() + fig = tp.figure() fig.plot( x, y, diff --git a/test/test_subplot.py b/test/test_subplot.py index ad91ace..6df23c3 100644 --- a/test/test_subplot.py +++ b/test/test_subplot.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- # -import asciiplotlib as apl +import termiplot as tp def _generate_content(*args, **kwargs): - grid = apl.subplot_grid((2, 3), *args, **kwargs) + grid = tp.subplot_grid((2, 3), *args, **kwargs) grid[0, 0].aprint("Some text") grid[0, 1].aprint("Some more text\nand more") grid[0, 2].aprint("Some more text\nand more\neven more") @@ -15,7 +15,7 @@ def _generate_content(*args, **kwargs): def test_subplot(): - grid = apl.subplot_grid((1, 2), width=20) + grid = tp.subplot_grid((1, 2), width=20) grid[0, 0].aprint("Some text") grid[0, 1].aprint("Some more text") string = grid.get_string() @@ -31,7 +31,7 @@ def test_subplot(): def test_subplot_custom_border(): - grid = apl.subplot_grid((1, 2), border_style="x", width=20) + grid = tp.subplot_grid((1, 2), border_style="x", width=20) grid[0, 0].aprint("Some text") grid[0, 1].aprint("Some more text") string = grid.get_string() @@ -47,7 +47,7 @@ def test_subplot_custom_border(): def test_subplot2(): - grid = apl.subplot_grid((1, 2), width=20, border_style="thick") + grid = tp.subplot_grid((1, 2), width=20, border_style="thick") grid[0, 0].aprint("Some text") grid[0, 1].aprint("Some more text\nand more") string = grid.get_string() @@ -64,7 +64,7 @@ def test_subplot2(): def test_subplot_padding(): - grid = apl.subplot_grid((1, 2), width=20, padding=2, border_style="double") + grid = tp.subplot_grid((1, 2), width=20, padding=2, border_style="double") grid[0, 0].aprint("Some text") grid[0, 1].aprint("Some more text\nand more") string = grid.get_string() diff --git a/test/test_table.py b/test/test_table.py index d429d48..9a78df8 100644 --- a/test/test_table.py +++ b/test/test_table.py @@ -5,7 +5,7 @@ import numpy import pytest -import asciiplotlib as apl +import termiplot as tp @pytest.mark.skipif( @@ -16,7 +16,7 @@ def test_table(): numpy.random.seed(0) data = numpy.random.rand(5, 2) - fig = apl.figure() + fig = tp.figure() fig.table(data) string = fig.get_string() @@ -45,7 +45,7 @@ def test_table_double(): numpy.random.seed(0) data = numpy.random.rand(5, 2) - fig = apl.figure() + fig = tp.figure() fig.table(data, border_style="double") string = fig.get_string() @@ -70,7 +70,7 @@ def test_table_ascii(): numpy.random.seed(0) data = numpy.random.rand(5, 2) - fig = apl.figure() + fig = tp.figure() fig.table(data, border_style="thin", force_ascii=True) string = fig.get_string() @@ -95,7 +95,7 @@ def test_table_mixed(): numpy.random.seed(0) data = [[0, 0.123], [1, 2.13], [2, 613.2323]] - fig = apl.figure() + fig = tp.figure() fig.table(data, border_style="thin", force_ascii=True) string = fig.get_string() @@ -120,7 +120,7 @@ def test_table_padding_top(): numpy.random.seed(0) data = [[0, 0.123], [1, 2.13], [2, 613.2323]] - fig = apl.figure() + fig = tp.figure() fig.table(data, padding=(1, 0)) string = fig.get_string() @@ -153,7 +153,7 @@ def test_table_padding_both(): numpy.random.seed(0) data = [[0, 0.123], [1, 2.13], [2, 613.2323]] - fig = apl.figure() + fig = tp.figure() fig.table(data, padding=(1, 1)) string = fig.get_string() @@ -182,7 +182,7 @@ def test_table_alignment(): numpy.random.seed(0) data = [[1, 2, 3], [613.23236243236, 613.23236243236, 613.23236243236]] - fig = apl.figure() + fig = tp.figure() fig.table(data, force_ascii=True, alignment="lcr") string = fig.get_string() @@ -204,7 +204,7 @@ def test_noborder(): [[1, 2, 3], [613.23236243236, 613.23236243236, 613.23236243236]], ] - fig = apl.figure() + fig = tp.figure() fig.table(data, border_style=None, padding=0) string = fig.get_string() @@ -227,7 +227,7 @@ def test_header(): [[1, 2, 3], [613.23236243236, 613.23236243236, 613.23236243236]], ] - fig = apl.figure() + fig = tp.figure() fig.table(data, alignment="lcr") string = fig.get_string() @@ -251,7 +251,7 @@ def test_header_ascii(): [[1, 2, 3], [613.23236243236, 613.23236243236, 613.23236243236]], ] - fig = apl.figure() + fig = tp.figure() fig.table(data, force_ascii=True, alignment="lcr") string = fig.get_string() @@ -279,7 +279,7 @@ def test_header_thick(): [[1, 2, 3], [613.23236243236, 613.23236243236, 613.23236243236]], ] - fig = apl.figure() + fig = tp.figure() fig.table(data, border_style=("thin", "thick"), alignment="lcr") string = fig.get_string() From 3b7f2d938307017d5f7ab7bd934a2d866faabf19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Schl=C3=B6mer?= Date: Mon, 11 Mar 2019 00:12:56 +0100 Subject: [PATCH 2/2] version bump --- termiplot/__about__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/termiplot/__about__.py b/termiplot/__about__.py index 20bbbc8..9a7b842 100644 --- a/termiplot/__about__.py +++ b/termiplot/__about__.py @@ -5,5 +5,5 @@ __email__ = "nico.schloemer@gmail.com" __copyright__ = u"Copyright (c) 2018-2019, {} <{}>".format(__author__, __email__) __license__ = "License :: OSI Approved :: MIT License" -__version__ = "0.1.7" +__version__ = "0.1.8" __status__ = "Development Status :: 4 - Beta"