Skip to content

Commit 4acb140

Browse files
authored
Merge pull request #392 from nschloe/modernize
setup.cfg, pyproject.toml
2 parents 0221330 + 4952baf commit 4acb140

File tree

10 files changed

+78
-76
lines changed

10 files changed

+78
-76
lines changed

.circleci/config.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
- image: circleci/python:3.7
77
steps:
88
- checkout
9-
- run: pip3 install -U black flake8 --user
9+
- run: pip install black flake8
1010
- run: black --check .
1111
- run: flake8 .
1212
build:
@@ -18,18 +18,13 @@ jobs:
1818
# <https://stackoverflow.com/a/44333806/353337>
1919
- run: DEBIAN_FRONTEND=noninteractive sudo apt install tzdata
2020
- run: sudo apt install -y texlive-latex-base texlive-latex-extra context
21-
- run: pip3 install -U pytest pytest-cov excode --user
21+
- run: pip install excode
2222
- checkout
2323
- run: excode README.md test/zzz_readme_test.py --filter python,test
24-
- run: pip3 install -r test_requirements.txt --user
25-
- run: pip3 install .[all] --user
26-
- run: pip3 check
2724
# The actual test
28-
- run:
29-
command: pytest --cov tikzplotlib
30-
working_directory: test/
31-
environment:
32-
MPLBACKEND: Agg
25+
- run: |
26+
pip install tox
27+
tox
3328
# submit to codecov
3429
- run: bash <(curl -s https://codecov.io/bash)
3530

.github/workflows/ci.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,13 @@ jobs:
3131
- uses: actions/checkout@v2
3232
- name: Install dependencies
3333
run: sudo apt-get install -y texlive-latex-base texlive-latex-extra context python3-tk
34-
- name: Install package
35-
run: |
36-
pip install .
3734
- name: Extract tests from README
3835
run: |
3936
pip install excode
4037
excode README.md test/zzz_readme_test.py --filter python,test
41-
- name: Test with pytest
38+
- name: Test with tox
4239
run: |
43-
pip install pytest pytest-cov
44-
pip install -r test_requirements.txt
45-
cd test/ && MPLBACKEND=Agg pytest --cov tikzplotlib
40+
pip install tox
41+
tox
4642
# - name: Submit to codecov
4743
# run: bash <(curl -s https://codecov.io/bash)

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
VERSION=$(shell python3 -c "import tikzplotlib; print(tikzplotlib.__version__)")
1+
VERSION=$(shell python3 -c "from configparser import ConfigParser; p = ConfigParser(); p.read('setup.cfg'); print(p['metadata']['version'])")
22

33
default:
44
@echo "\"make publish\"?"
55

66
tag:
77
# Make sure we're on the master branch
88
@if [ "$(shell git rev-parse --abbrev-ref HEAD)" != "master" ]; then exit 1; fi
9-
@echo "Tagging v$(VERSION)..."
10-
git tag v$(VERSION)
11-
git push --tags
9+
# @echo "Tagging v$(VERSION)..."
10+
# git tag v$(VERSION)
11+
# git push --tags
1212
curl -H "Authorization: token `cat $(HOME)/.github-access-token`" -d '{"tag_name": "$(VERSION)"}' https://api.github.com/repos/nschloe/tikzplotlib/releases
1313

1414
upload: setup.py

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>=42", "wheel"]
3+
build-backend = "setuptools.build_meta"

setup.cfg

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
[metadata]
2+
name = tikzplotlib
3+
version = 0.9.1
4+
author = Nico Schlömer
5+
6+
description = Convert matplotlib figures into TikZ/PGFPlots
7+
url = https://github.com/nschloe/tikzplotlib
8+
project_urls =
9+
Code=https://github.com/nschloe/tikzplotlib
10+
Issues=https://github.com/nschloe/tikzplotlib/issues
11+
long_description = file: README.md
12+
long_description_content_type = text/markdown
13+
license = MIT
14+
platforms = any
15+
classifiers =
16+
Development Status :: 4 - Beta
17+
License :: OSI Approved :: MIT License
18+
Operating System :: OS Independent
19+
Programming Language :: Python
20+
Programming Language :: Python :: 3
21+
Programming Language :: Python :: 3.6
22+
Programming Language :: Python :: 3.7
23+
Programming Language :: Python :: 3.8
24+
Topic :: Multimedia :: Graphics :: Graphics Conversion
25+
Topic :: Scientific/Engineering :: Visualization
26+
27+
[options]
28+
packages = find:
29+
# importlib_metadata can be removed when we support Python 3.8+ only
30+
install_requires =
31+
importlib_metadata
32+
matplotlib >= 1.4.0
33+
numpy
34+
Pillow
35+
python_requires = >=3.6
36+
setup_requires =
37+
setuptools>=42
38+
wheel

setup.py

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,4 @@
1-
import os
1+
from setuptools import setup
22

3-
from setuptools import find_packages, setup
4-
5-
# https://packaging.python.org/single_source_version/
6-
base_dir = os.path.abspath(os.path.dirname(__file__))
7-
about = {}
8-
with open(os.path.join(base_dir, "tikzplotlib", "__about__.py"), "rb") as f:
9-
exec(f.read(), about)
10-
11-
12-
setup(
13-
name="tikzplotlib",
14-
version=about["__version__"],
15-
packages=find_packages(),
16-
url="https://github.com/nschloe/tikzplotlib",
17-
author=about["__author__"],
18-
author_email=about["__email__"],
19-
install_requires=["matplotlib >= 1.4.0", "numpy", "Pillow"],
20-
description="Convert matplotlib figures into TikZ/PGFPlots",
21-
long_description=open("README.md").read(),
22-
long_description_content_type="text/markdown",
23-
license=about["__license__"],
24-
python_requires=">=3.6",
25-
classifiers=[
26-
about["__status__"],
27-
about["__license__"],
28-
"Operating System :: OS Independent",
29-
"Programming Language :: Python :: 3",
30-
"Programming Language :: Python :: 3.6",
31-
"Programming Language :: Python :: 3.7",
32-
"Programming Language :: Python :: 3.8",
33-
"Topic :: Multimedia :: Graphics :: Graphics Conversion",
34-
"Topic :: Scientific/Engineering :: Visualization",
35-
],
36-
)
3+
if __name__ == "__main__":
4+
setup()

test_requirements.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

tikzplotlib/__about__.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
__author__ = "Nico Schlömer"
2-
__email__ = "[email protected]"
3-
__copyright__ = f"Copyright (c) 2010-2020, {__author__} <{__email__}>"
4-
__license__ = "License :: OSI Approved :: MIT License"
5-
__version__ = "0.9.1"
6-
__status__ = "Development Status :: 5 - Production/Stable"
1+
try:
2+
# Python 3.8
3+
from importlib import metadata
4+
except ImportError:
5+
import importlib_metadata as metadata
6+
7+
try:
8+
__version__ = metadata.version("tikzplotlib")
9+
except Exception:
10+
__version__ = "unknown"

tikzplotlib/__init__.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,11 @@
11
"""Script to convert Matplotlib generated figures into TikZ/PGFPlots figures.
22
"""
3-
from .__about__ import (
4-
__author__,
5-
__copyright__,
6-
__email__,
7-
__license__,
8-
__status__,
9-
__version__,
10-
)
3+
from .__about__ import __version__
114
from ._cleanfigure import clean_figure
125
from ._save import Flavors, get_tikz_code, save
136

147
__all__ = [
15-
"__author__",
16-
"__email__",
17-
"__copyright__",
18-
"__license__",
198
"__version__",
20-
"__status__",
219
"get_tikz_code",
2210
"save",
2311
"clean_figure",

tox.ini

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[tox]
2+
envlist = py3
3+
isolated_build = True
4+
5+
[testenv]
6+
deps =
7+
pandas
8+
pytest
9+
pytest-cov
10+
commands =
11+
pytest --cov {envsitepackagesdir}/tikzplotlib --cov-report xml --cov-report term

0 commit comments

Comments
 (0)