Replace applymoban.py with Yaml configuration

Add Change log.
This commit is contained in:
John Vandenberg 2016-05-10 17:28:50 +07:00
parent 31a34d1a7a
commit 9c0a54d0bd
13 changed files with 251 additions and 69 deletions

View File

@ -1,5 +1,10 @@
{% extends "travis.yml.jj2" %} {% extends "travis.yml.jj2" %}
{%block test_other_python_versions%} - 2.6 {%block custom_python_versions%}
python:
- 2.6
- 2.7
{%endblock%} {%endblock%}
{% block custom_install %} - rm README.rst; touch README.rst # fails
{%endblock%}

17
.moban.yml Normal file
View File

@ -0,0 +1,17 @@
configuration:
configuration_dir: "commons/config"
template_dir:
- "commons/templates"
- ".moban.d"
configuration: pyexcel_ods.yaml
targets:
- README.rst: README.rst
- setup.py: setup.py
- "docs/source/conf.py": "docs/source/conf.py.jj2"
- .travis.yml: travis.yml
- requirements.txt: requirements.txt
- LICENSE: LICENSE.jj2
- MANIFEST.in: MANIFEST.in.jj2
- "tests/requirements.txt": "tests/requirements.txt"
- test.sh: test.sh.jj2
- test.bat: test.sh.jj2

View File

@ -2,16 +2,14 @@ sudo: false
language: python language: python
notifications: notifications:
email: false email: false
env:
global:
python: python:
- 2.7
- 2.6 - 2.6
install: - 2.7
- rm applymoban.py before_install:
- pip install -r requirements.txt - rm README.rst; touch README.rst # fails
- if [[ -f rnd_requirements.txt ]]; then pip install -r rnd_requirements.txt; fi
- pip install -r tests/requirements.txt - pip install -r tests/requirements.txt
script: script:
make test make test
after_success: after_success:
codecov codecov

101
CHANGELOG.rst Normal file
View File

@ -0,0 +1,101 @@
Change log
================================================================================
0.1.1 - 30.01.2016
--------------------------------------------------------------------------------
Added
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#. 'streaming' is an extra option given to get_data. Only when 'streaming'
is explicitly set to True, the data will be consisted of generators,
hence will break your existing code.
#. uses yield in to_array and returns a generator
#. support multi-line text cell #5
#. feature migration from pyexcel-ods3 pyexcel/pyexcel-ods3#5
Updated
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#. compatibility with pyexcel-io 0.1.1
0.0.12 - 10.10.2015
--------------------------------------------------------------------------------
Updated
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#. Bug fix: excessive trailing columns with empty values
0.0.11 - 26.09.2015
--------------------------------------------------------------------------------
Updated
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#. Complete fix for libreoffice datetime field
0.0.10 - 15.09.2015
--------------------------------------------------------------------------------
Updated
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#. Bug fix: date field could have datetime from libreoffice
0.0.9 - 21.08.2015
--------------------------------------------------------------------------------
Updated
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#. Bug fix: utf-8 string throw unicode exceptions
0.0.8 - 28.06.2015
--------------------------------------------------------------------------------
Updated
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#. Pin dependency odfpy 0.9.6 to avoid buggy odfpy 1.3.0
0.0.7 - 28.05.2015
--------------------------------------------------------------------------------
Updated
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#. Bug fix: "number-columns-repeated" is now respected
0.0.6 - 21.05.2015
--------------------------------------------------------------------------------
Updated
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#. get_data and save_data are seen across pyexcel-* extensions. remember them
once and use them across all extensions.
0.0.5 - 22.02.2015
--------------------------------------------------------------------------------
Added
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#. Loads only one sheet from a multiple sheet book
#. Use New BSD License
0.0.4 - 14.12.2014
--------------------------------------------------------------------------------
Updated
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#. IO interface update as pyexcel-io introduced keywords.
0.0.3 - 08.12.2014
--------------------------------------------------------------------------------
#. initial release

View File

@ -1 +1,2 @@
include README.rst include README.rst
include CHANGELOG.rst

View File

@ -17,7 +17,7 @@ does the same thing but supports Python 3.3 and 3.4 and depends on lxml.
Known constraints Known constraints
================== ==================
Fonts, colors and charts are not supported. Fonts, colors and charts are not supported.
Installation Installation
================================================================================ ================================================================================
@ -62,7 +62,11 @@ Write to an ods file
... from StringIO import StringIO ... from StringIO import StringIO
... else: ... else:
... from io import BytesIO as StringIO ... from io import BytesIO as StringIO
>>> from pyexcel_io import OrderedDict >>> PY2 = sys.version_info[0] == 2
>>> if PY2 and sys.version_info[1] < 7:
... from ordereddict import OrderedDict
... else:
... from collections import OrderedDict
Here's the sample code to write a dictionary to an ods file: Here's the sample code to write a dictionary to an ods file:
@ -125,6 +129,12 @@ Continue from previous example:
As a pyexcel plugin As a pyexcel plugin
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
No longer, explicit import is needed since pyexcel version 0.2.2. Instead,
this library is auto-loaded. So if you want to read data in ods format,
installing it is enough.
Any version under pyexcel 0.2.2, you have to keep doing the following:
Import it in your file to enable this plugin: Import it in your file to enable this plugin:
.. code-block:: python .. code-block:: python
@ -141,16 +151,16 @@ Here is the sample code:
.. code-block:: python .. code-block:: python
>>> import pyexcel as pe >>> import pyexcel as pe
>>> from pyexcel.ext import ods >>> # from pyexcel.ext import ods
>>> sheet = pe.get_book(file_name="your_file.ods") >>> sheet = pe.get_book(file_name="your_file.ods")
>>> sheet >>> sheet
Sheet Name: Sheet 1 Sheet 1:
+---+---+---+ +---+---+---+
| 1 | 2 | 3 | | 1 | 2 | 3 |
+---+---+---+ +---+---+---+
| 4 | 5 | 6 | | 4 | 5 | 6 |
+---+---+---+ +---+---+---+
Sheet Name: Sheet 2 Sheet 2:
+-------+-------+-------+ +-------+-------+-------+
| row 1 | row 2 | row 3 | | row 1 | row 2 | row 3 |
+-------+-------+-------+ +-------+-------+-------+
@ -180,13 +190,13 @@ You got to wrap the binary content with stream to get ods working:
... r = pe.get_book(file_type="ods", file_content=content) ... r = pe.get_book(file_type="ods", file_content=content)
... print(r) ... print(r)
... ...
Sheet Name: Sheet 1 Sheet 1:
+---+---+---+ +---+---+---+
| 1 | 2 | 3 | | 1 | 2 | 3 |
+---+---+---+ +---+---+---+
| 4 | 5 | 6 | | 4 | 5 | 6 |
+---+---+---+ +---+---+---+
Sheet Name: Sheet 2 Sheet 2:
+-------+-------+-------+ +-------+-------+-------+
| row 1 | row 2 | row 3 | | row 1 | row 2 | row 3 |
+-------+-------+-------+ +-------+-------+-------+
@ -215,6 +225,38 @@ License
New BSD License New BSD License
Developer guide
==================
Development steps for code changes
#. git clone https://github.com/pyexcel/pyexcel-ods.git
#. cd pyexcel-ods
#. pip install -r requirements.txt
#. pip install -r tests/requirements.txt
In order to update test envrionment, and documentation, additional setps are
required:
#. pip install moban
#. git clone https://github.com/pyexcel/pyexcel-commons.git
#. make your changes in `.moban.d` directory, then issue command `moban`
How to test your contribution
------------------------------
Although `nose` and `doctest` are both used in code testing, it is adviable that unit tests are put in tests. `doctest` is incorporated only to make sure the code examples in documentation remain valid across different development releases.
On Linux/Unix systems, please launch your tests like this::
$ make test
On Windows systems, please issue this command::
> test.bat
Credits Credits
================================================================================ ================================================================================
@ -225,4 +267,4 @@ ODSReader is originally written by `Marco Conti <https://github.com/marcoconti83
>>> import os >>> import os
>>> os.unlink("your_file.ods") >>> os.unlink("your_file.ods")
>>> os.unlink("another_file.ods") >>> os.unlink("another_file.ods")

View File

@ -1,15 +0,0 @@
from os import path, system
config_dir = 'commons/config'
template_dir = 'commons/templates'
if not path.exists("commons"):
system("git clone https://github.com/pyexcel/pyexcel-commons.git commons")
system("moban -cd {0} -td {1} -t docs/source/conf.py.jj2 -o docs/source/conf.py -c moban.yaml".format(config_dir, template_dir))
system("moban -cd {0} -td {1} .moban.d -t README.rst -o README.rst -c moban.yaml".format(config_dir, template_dir))
system("moban -cd {0} -td {1} .moban.d -t setup.py -o setup.py -c moban.yaml".format(config_dir, template_dir))
system("moban -cd {0} -td {1} .moban.d -t travis.yml -o .travis.yml -c moban.yaml".format(config_dir, template_dir))
system("moban -cd {0} -td .moban.d -t requirements.txt -o requirements.txt -c moban.yaml".format(config_dir))
system("moban -cd {0} -td {1} -t LICENSE.jj2 -o LICENSE -c moban.yaml".format(config_dir, template_dir))
system("moban -cd {0} -td {1} .moban.d -t tests/requirements.txt -o tests/requirements.txt -c moban.yaml".format(config_dir, template_dir))
system("moban -cd {0} -td {1} .moban.d -t MANIFEST.in.jj2 -o MANIFEST.in -c moban.yaml".format(config_dir, template_dir))

View File

@ -248,4 +248,4 @@ texinfo_documents = [
#texinfo_show_urls = 'footnote' #texinfo_show_urls = 'footnote'
# If true, do not generate a @detailmenu in the "Top" node's menu. # If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False #texinfo_no_detailmenu = False

9
pyexcel_ods.yaml Normal file
View File

@ -0,0 +1,9 @@
overrides: "pyexcel.yaml"
name: "pyexcel-ods"
nick_name: ods
version: 0.1.1
file_type: ods
dependencies:
- pyexcel-io>=0.1.0
- odfpy==0.9.6
description: A wrapper library to read, manipulate and write data in ods format

View File

@ -5,45 +5,68 @@ except ImportError:
use_setuptools() use_setuptools()
from setuptools import setup, find_packages from setuptools import setup, find_packages
with open("README.rst", 'r') as readme: NAME = 'pyexcel-ods'
README_txt = readme.read() AUTHOR = 'C.W.'
VERSION = '0.1.1'
EMAIL = 'wangc_2011 (at) hotmail.com'
LICENSE = 'New BSD'
PACKAGES = find_packages(exclude=['ez_setup', 'examples', 'tests'])
DESCRIPTION = 'A wrapper library to read, manipulate and write data in ods format'
KEYWORDS = [
'excel',
'python',
'pyexcel',
]
dependencies = [ INSTALL_REQUIRES = [
'pyexcel-io>=0.1.0', 'pyexcel-io>=0.1.0',
'odfpy==0.9.6', 'odfpy==0.9.6',
] ]
extras = {} EXTRAS_REQUIRE = {
}
CLASSIFIERS = [
setup( 'Topic :: Office/Business',
name='pyexcel-ods', 'Topic :: Utilities',
author='C. W.', 'Topic :: Software Development :: Libraries',
version='0.1.1', 'Programming Language :: Python',
author_email='wangc_2011 (at) hotmail.com', 'License :: OSI Approved :: BSD License',
url='https://github.com/pyexcel/pyexcel-ods', 'Intended Audience :: Developers',
description='A wrapper library to read, manipulate and write data in ods format',
install_requires=dependencies,
extras_require=extras,
packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
include_package_data=True,
long_description=README_txt,
zip_safe=False,
tests_require=['nose'],
keywords=[
'excel',
'python',
'pyexcel',
],
license='New BSD',
classifiers=[
'Topic :: Office/Business',
'Topic :: Utilities',
'Topic :: Software Development :: Libraries',
'Programming Language :: Python',
'License :: OSI Approved :: BSD License',
'Intended Audience :: Developers',
'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7' 'Programming Language :: Python :: 2.7'
] ]
)
def read_files(*files):
"""Read files into setup"""
text = ""
for single_file in files:
text = text + read(single_file) + "\n"
return text
def read(afile):
"""Read a file into setup"""
with open(afile, 'r') as opened_file:
return opened_file.read()
if __name__ == '__main__':
setup(
name=NAME,
author=AUTHOR,
version=VERSION,
author_email=EMAIL,
description=DESCRIPTION,
install_requires=INSTALL_REQUIRES,
keywords=KEYWORDS,
extras_require=EXTRAS_REQUIRE,
packages=PACKAGES,
include_package_data=True,
long_description=read_files('README.rst', 'CHANGELOG.rst'),
zip_safe=False,
tests_require=['nose'],
license=LICENSE,
classifiers=CLASSIFIERS
)

View File

@ -1 +1,2 @@
nosetests --with-cov --with-doctest --doctest-extension=.rst -I applymoban.py -I setup.py pip freeze
nosetests --with-cov --cov pyexcel_ods --cov tests --with-doctest --doctest-extension=.rst tests README.rst pyexcel_ods

View File

@ -1 +1,2 @@
nosetests --rednose --with-cov --cov pyexcel_ods --cov tests --with-doctest --doctest-extension=.rst pip freeze
nosetests --with-cov --cov pyexcel_ods --cov tests --with-doctest --doctest-extension=.rst tests README.rst pyexcel_ods

View File

@ -1,5 +1,4 @@
nose nose
rednose
nose-cov nose-cov
codecov codecov
coverage coverage