Skip to content

Commit

Permalink
release 0.1.9 (#31)
Browse files Browse the repository at this point in the history
* ✨ loosen the requirement on lml

* 🔨 use moban 0.3.3 and apply isort and black

* 🥚 🎡 release 0.1.9

* ✨ support EPS format
  • Loading branch information
chfw authored Nov 13, 2018
1 parent 7861bd5 commit 7cd4cff
Show file tree
Hide file tree
Showing 20 changed files with 98,602 additions and 28 deletions.
3 changes: 3 additions & 0 deletions .moban.d/tests/custom_requirements.txt.jj2
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{% extends "tests/requirements.txt.jj2" %}
{%block extras %}
pyecharts
moban
black;python_version>="3.6"
isort;python_version>="3.6"
{%endblock%}
6 changes: 5 additions & 1 deletion .moban.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
requires:
- type: git
url: https://github.com/moremoban/pypi-mobans
submodule: true
configuration:
template_dir:
- "setupmobans/templates"
- "pypi-mobans:templates"
- ".moban.d"
configuration: pyecharts-snapshot.yml
targets:
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Change log
================================================================================

0.1.9 - 13.11.2018
--------------------------------------------------------------------------------

Updated
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

#. Loosen the requirement on lml

0.1.8 - 12.09.2018
--------------------------------------------------------------------------------

Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ test:

demo:
bash images.sh

format:
isort -y $(find pyecharts_snapshot -name "*.py"|xargs echo) $(find tests -name "*.py"|xargs echo)
black -l 79 pyecharts_snapshot
black -l 79 tests
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ pyecharts-snapshot
Introduction
================================================================================

pyecharts-snapshot renders the output of pyecharts as a png, jpeg, gif, svg image or
a pdf file at command line or in your code.
pyecharts-snapshot renders the output of pyecharts as a png, jpeg, gif, eps, svg
image or a pdf file at command line or in your code.


Please be aware of its dependency on **phantom.js**.
Expand Down
9 changes: 9 additions & 0 deletions changelog.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
name: pyecharts-snapshot
organisation: pyecharts
releases:
- changes:
- action: Added
details:
- 'Support eps'
- action: Updated
details:
- 'Loosen the requirement on lml'
date: 13.11.2018
version: 0.1.9
- changes:
- action: Fixed
details:
Expand Down
1 change: 1 addition & 0 deletions examples/bar.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# coding=utf-8
from __future__ import unicode_literals

from pyecharts import Bar

attr = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
Expand Down
98,479 changes: 98,479 additions & 0 deletions examples/demo.eps

Large diffs are not rendered by default.

48 changes: 48 additions & 0 deletions examples/demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# coding=utf-8
from __future__ import unicode_literals

from pyecharts import Bar, Grid, Line, Scatter, EffectScatter

attr = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
v1 = [5, 20, 36, 10, 75, 90]
v2 = [10, 25, 8, 60, 20, 80]
bar = Bar("柱状图示例", height=720, width=1200, title_pos="65%")
bar.add("商家A", attr, v1, is_stack=True)
bar.add("商家B", attr, v2, is_stack=True, legend_pos="80%")
line = Line("折线图示例")
attr = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"]
line.add(
"最高气温",
attr,
[11, 11, 15, 13, 12, 13, 10],
mark_point=["max", "min"],
mark_line=["average"],
)
line.add(
"最低气温",
attr,
[1, -2, 2, 5, 3, 2, 0],
mark_point=["max", "min"],
mark_line=["average"],
legend_pos="20%",
)
v1 = [5, 20, 36, 10, 75, 90]
v2 = [10, 25, 8, 60, 20, 80]
scatter = Scatter("散点图示例", title_top="50%", title_pos="65%")
scatter.add("scatter", v1, v2, legend_top="50%", legend_pos="80%")
es = EffectScatter("动态散点图示例", title_top="50%")
es.add(
"es",
[11, 11, 15, 13, 12, 13, 10],
[1, -2, 2, 5, 3, 2, 0],
effect_scale=6,
legend_top="50%",
legend_pos="20%",
)

grid = Grid()
grid.add(bar, grid_bottom="60%", grid_left="60%")
grid.add(line, grid_bottom="60%", grid_right="60%")
grid.add(scatter, grid_top="60%", grid_left="60%")
grid.add(es, grid_top="60%", grid_right="60%")
grid.render(path="demo.eps", delay=3)
3 changes: 2 additions & 1 deletion examples/grid.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# coding=utf-8
from __future__ import unicode_literals
from pyecharts import Bar, Line, Scatter, EffectScatter, Grid

from pyecharts import Bar, Grid, Line, Scatter, EffectScatter

attr = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
v1 = [5, 20, 36, 10, 75, 90]
Expand Down
2 changes: 1 addition & 1 deletion examples/pdf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding=utf-8
from __future__ import unicode_literals

from pyecharts import Line, Pie, Grid
from pyecharts import Pie, Grid, Line

line = Line("折线图示例", width=1200)
attr = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"]
Expand Down
8 changes: 4 additions & 4 deletions pyecharts-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ organisation: "pyecharts"
author: "C.W."
contact: "[email protected]"
company: "Onni Software Ltd."
version: "0.1.8"
current_version: "0.1.8"
release: "0.1.8"
version: "0.1.9"
current_version: "0.1.9"
release: "0.1.9"
copyright_year: 2017-2018
command_line_interface: "snapshot"
entry_point: "pyecharts_snapshot.main:main"
nodocs: true
license: MIT
dependencies:
- pillow
- lml==0.0.2
- lml>=0.0.2
keywords:
- echarts
- visualisation
Expand Down
2 changes: 1 addition & 1 deletion pyecharts_snapshot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
PluginInfo(
EXTENSION_TYPE,
"%s.environment.SnapshotEnvironment" % __name__,
tags=["png", "svg", "jpeg", "gif", "pdf"],
tags=["png", "svg", "jpeg", "gif", "pdf", "eps"],
)
)
3 changes: 1 addition & 2 deletions pyecharts_snapshot/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
from tempfile import mkstemp

from pyecharts.engine import EchartsEnvironment

from pyecharts_snapshot.main import (
make_a_snapshot,
DEFAULT_DELAY,
DEFAULT_PIXEL_RATIO,
make_a_snapshot,
)


Expand Down
13 changes: 9 additions & 4 deletions pyecharts_snapshot/main.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import io
import os
import sys
import codecs
import base64
import codecs
import subprocess

import pyecharts_snapshot.logger as logger

from PIL import Image

PY2 = sys.version_info[0] == 2
Expand All @@ -16,7 +17,7 @@
from io import BytesIO

HELP_TEXT = """
Usage: snapshot input file [png|jpeg|gif|svg|pdf] [delay] [pixel ratio]
Usage: snapshot input file [png|jpeg|gif|svg|pdf|eps] [delay] [pixel ratio]
snapshot help: display this help message
Parameters:
delay: float value, unit in seconds and defaults 1.5 seconds
Expand All @@ -31,6 +32,10 @@
GIF_FORMAT = "gif"
PDF_FORMAT = "pdf"
SVG_FORMAT = "svg"
EPS_FORMAT = "eps"

SUPPORTED_IMAGE_FORMATS = [
PDF_FORMAT, JPG_FORMAT, GIF_FORMAT, SVG_FORMAT, EPS_FORMAT]

PHANTOMJS_EXEC = "phantomjs"
DEFAULT_OUTPUT_NAME = "output.%s"
Expand All @@ -57,7 +62,7 @@ def main():
pixel_ratio = DEFAULT_PIXEL_RATIO
if len(sys.argv) >= 3:
file_type = sys.argv[2]
if file_type in [PDF_FORMAT, JPG_FORMAT, GIF_FORMAT, SVG_FORMAT]:
if file_type in SUPPORTED_IMAGE_FORMATS:
output = DEFAULT_OUTPUT_NAME % file_type
elif file_type != PNG_FORMAT:
raise TypeError(NOT_SUPPORTED_FILE_TYPE % file_type)
Expand Down Expand Up @@ -114,7 +119,7 @@ def make_a_snapshot(
raise OSError(content_array)
base64_imagedata = content_array[1]
imagedata = decode_base64(base64_imagedata)
if file_type in [PDF_FORMAT, GIF_FORMAT]:
if file_type in [PDF_FORMAT, GIF_FORMAT, EPS_FORMAT]:
save_as(imagedata, output_name, file_type)
elif file_type in [PNG_FORMAT, JPG_FORMAT]:
save_as_png(imagedata, output_name)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pillow
lml==0.0.2
lml>=0.0.2
16 changes: 9 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
import sys
import codecs
from shutil import rmtree
from setuptools import setup, find_packages, Command

from setuptools import Command, setup, find_packages

PY2 = sys.version_info[0] == 2
PY26 = PY2 and sys.version_info[1] < 7

NAME = 'pyecharts-snapshot'
AUTHOR = 'C.W.'
VERSION = '0.1.8'
VERSION = '0.1.9'
EMAIL = '[email protected]'
LICENSE = 'MIT'
ENTRY_POINTS = {
Expand All @@ -23,9 +25,10 @@
'renders pyecharts output as image'
)
URL = 'https://github.com/pyecharts/pyecharts-snapshot'
DOWNLOAD_URL = '%s/archive/0.1.8.tar.gz' % URL
DOWNLOAD_URL = '%s/archive/0.1.9.tar.gz' % URL
FILES = ['README.rst', 'CONTRIBUTORS.rst', 'CHANGELOG.rst']
KEYWORDS = [
'python',
'echarts',
'visualisation',
'data',
Expand All @@ -34,7 +37,6 @@
'jpeg',
'svg',
'pdf',
'python',
]

CLASSIFIERS = [
Expand All @@ -51,7 +53,7 @@

INSTALL_REQUIRES = [
'pillow',
'lml==0.0.2',
'lml>=0.0.2',
]
SETUP_COMMANDS = {}

Expand All @@ -62,8 +64,8 @@
# You do not need to read beyond this line
PUBLISH_COMMAND = '{0} setup.py sdist bdist_wheel upload -r pypi'.format(
sys.executable)
GS_COMMAND = ('gs pyecharts-snapshot v0.1.8 ' +
"Find 0.1.8 in changelog for more details")
GS_COMMAND = ('gs pyecharts-snapshot v0.1.9 ' +
"Find 0.1.9 in changelog for more details")
NO_GS_MESSAGE = ('Automatic github release is disabled. ' +
'Please install gease to enable it.')
UPLOAD_FAILED_MSG = (
Expand Down
3 changes: 3 additions & 0 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ codecov
coverage
flake8
pyecharts
moban
black;python_version>="3.6"
isort;python_version>="3.6"
1 change: 1 addition & 0 deletions tests/test_environment.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os

from pyecharts import Bar
from pyecharts_snapshot.environment import SnapshotEnvironment

Expand Down
14 changes: 10 additions & 4 deletions tests/test_snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@
import codecs
import filecmp
from io import BytesIO
from mock import patch
from nose.tools import raises, eq_
from platform import python_implementation

from pyecharts_snapshot.main import main, make_a_snapshot, PY2
from pyecharts_snapshot.main import save_as_svg, to_file_uri
from pyecharts_snapshot.main import (
PY2,
main,
save_as_svg,
to_file_uri,
make_a_snapshot,
)

from mock import patch
from nose.tools import eq_, raises

PY27 = sys.version_info[1] == 7 and PY2 and python_implementation() != "PyPy"
HTML_FILE = os.path.join("tests", "fixtures", "render.html")
Expand Down

0 comments on commit 7cd4cff

Please sign in to comment.