Skip to content

Commit 6da091f

Browse files
authored
Merge pull request #3 from tacaswell/wip_proposed_toplevel_api
WIP: Proposed top-level API
2 parents 593505e + 6594b97 commit 6da091f

File tree

5 files changed

+53
-3
lines changed

5 files changed

+53
-3
lines changed

.coveragerc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[run]
2+
branch = true
3+
source =
4+
mplaltair
5+
6+
[report]
7+
exclude_lines =
8+
raise NotImplemented
9+
def __str__
10+
def __repr__
11+
if __name__ == .__main__.:

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ matrix:
1818

1919
install:
2020
- python -m pip install --upgrade pip
21-
- python -m pip install --upgrade codecov coverage
21+
- python -m pip install --upgrade codecov coverage pytest
2222
- python -m pip install -ve .
2323

2424
script:
25-
- coverage run python -m pytest
25+
- coverage run run_tests.py
2626
- coverage report -m
2727
- set -e
2828
- codecov

mplaltair/__init__.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,35 @@
11
import matplotlib
22
import altair
3+
4+
5+
# TODO rename this?
6+
def convert(encoding, *, figure=None):
7+
"""Convert an altair encoding to a Matplotlib figure
8+
9+
10+
Parameters
11+
----------
12+
encoding
13+
The Altair encoding of the plot.
14+
15+
figure : matplotib.figure.Figure, optional
16+
# TODO: generalize this to 'thing that supports gridspec slicing?
17+
18+
Returns
19+
-------
20+
figure : matplotlib.figure.Figure
21+
The Figure with all artists in it (ready to be saved or shown)
22+
23+
mapping : dict
24+
Mapping from parts of the encoding to the Matplotlib artists. This is
25+
for later customization.
26+
27+
28+
"""
29+
if figure is None:
30+
from matplotlib import pyplot as plt
31+
figure = plt.figure()
32+
33+
mapping = {}
34+
35+
return figure, mapping

run_tests.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env python
2+
import sys
3+
import pytest
4+
5+
if __name__ == '__main__':
6+
sys.exit(pytest.main(sys.argv[1:]))

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
'Programming Language :: Python :: 3.5',
2424
'Programming Language :: Python :: 3.6',
2525
'Topic :: Scientific/Engineering :: Visualization',
26-
classifiers=classifiers,
2726
]
2827

2928

@@ -39,6 +38,7 @@
3938
python_requires='>=3.5',
4039
license="BSD",
4140
platforms='any',
41+
classifiers=classifiers,
4242
long_description=descr)
4343

4444
setup(**setup_parameters)

0 commit comments

Comments
 (0)