diff --git a/.isort.cfg b/.isort.cfg new file mode 100644 index 00000000..ba2778dc --- /dev/null +++ b/.isort.cfg @@ -0,0 +1,6 @@ +[settings] +multi_line_output=3 +include_trailing_comma=True +force_grid_wrap=0 +use_parentheses=True +line_length=88 diff --git a/.travis.yml b/.travis.yml index c050028f..92538283 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,27 +8,15 @@ cache: pip dist: xenial install: travis_retry pip install tox-travis script: tox -stages: -- test -- name: deploy - if: repo = jazzband/tablib AND tag IS present -jobs: - include: - - stage: test - after_success: - - pip install -U codecov - - codecov - - stage: deploy - install: skip - script: skip +after_success: bash <(curl -s https://codecov.io/bash) +deploy: + provider: pypi + user: jazzband + server: https://jazzband.co/projects/tablib/upload + distributions: sdist bdist_wheel + password: + secure: svV4fYtodwW+iTyFOm5ISEfhVwcA+6vTskD3x6peznc40TdMV9Ek8nT3Q/NB4lCbXoUw2qR4H6uhLCjesnv/VvVk/qbitCyD8ySlgwOV5n7NzJs8lC8EYaHSjGQjatTwJAokfGVYkPawkI7HXDqtDggLUQBK+Ag8HDW+XBSbQIU= + on: + tags: true + repo: jazzband/tablib python: 3.7 - deploy: - provider: pypi - user: jazzband - server: https://jazzband.co/projects/tablib/upload - distributions: sdist bdist_wheel - password: - secure: svV4fYtodwW+iTyFOm5ISEfhVwcA+6vTskD3x6peznc40TdMV9Ek8nT3Q/NB4lCbXoUw2qR4H6uhLCjesnv/VvVk/qbitCyD8ySlgwOV5n7NzJs8lC8EYaHSjGQjatTwJAokfGVYkPawkI7HXDqtDggLUQBK+Ag8HDW+XBSbQIU= - on: - tags: true - repo: jazzband/tablib diff --git a/HACKING b/HACKING deleted file mode 100644 index ebbb24cc..00000000 --- a/HACKING +++ /dev/null @@ -1,14 +0,0 @@ -Where possible, please follow PEP8 with regard to coding style. Sometimes the line -length restriction is too hard to follow, so don't bend over backwards there. - -Triple-quotes should always be """, single quotes are ' unless using " -would result in less escaping within the string. - -All modules, functions, and methods should be well documented reStructuredText for -Sphinx AutoDoc. - -All functionality should be available in pure Python. Optional C (via Cython) -implementations may be written for performance reasons, but should never -replace the Python implementation. - -Lastly, don't take yourself too seriously :) \ No newline at end of file diff --git a/MANIFEST.in b/MANIFEST.in index 65583dc6..2f5f4f3d 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1,6 @@ -include HISTORY.md README.md LICENSE AUTHORS test_tablib.py +recursive-include docs * +recursive-include tests * +include pytest.ini tox.ini .isort.cfg .coveragerc HISTORY.md README.md LICENSE AUTHORS +prune docs/_build +prune *.pyc +prune __pycache__ diff --git a/Makefile b/Makefile deleted file mode 100644 index 35470bd2..00000000 --- a/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -test: - python test_tablib.py -publish: - python setup.py register - python setup.py sdist upload - python setup.py bdist_wheel --universal upload diff --git a/docs/api.rst b/docs/api.rst index 942b69d2..1792eb59 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -36,7 +36,7 @@ Functions --------- -.. autofunction:: detect +.. autofunction:: detect_format .. autofunction:: import_set @@ -61,4 +61,4 @@ Exceptions You're trying to add something that doesn't quite taste right. -Now, go start some :ref:`Tablib Development `. \ No newline at end of file +Now, go start some :ref:`Tablib Development `. diff --git a/docs/development.rst b/docs/development.rst index 83fd159a..c481d0da 100644 --- a/docs/development.rst +++ b/docs/development.rst @@ -150,31 +150,7 @@ the easiest way to test your changes for potential issues is to simply run the t .. code-block:: console - $ ./test_tablib.py - - -`Jenkins CI`_, amongst other tools, supports Java's xUnit testing report format. -Nose_ allows us to generate our own xUnit reports. - -Installing nose is simple. - -.. code-block:: console - - $ pip install nose - -Once installed, we can generate our xUnit report with a single command. - -.. code-block:: console - - $ nosetests test_tablib.py --with-xunit - -This will generate a **nosetests.xml** file, which can then be analyzed. - -.. _Nose: https://github.com/nose-devs/nose - - - -.. _jenkins: + $ tox ---------------------- Continuous Integration diff --git a/docs/tutorial.rst b/docs/tutorial.rst index 421954a7..4189269d 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -5,9 +5,6 @@ Quickstart ========== -.. module:: tablib - - Eager to get started? This page gives a good introduction in how to get started with Tablib. This assumes you already have Tablib installed. @@ -301,7 +298,7 @@ Now that we have extra meta-data on our rows, we can easily filter our :class:`D It's that simple. The original :class:`Dataset` is untouched. Open an Excel Workbook and read first sheet --------------------------------- +------------------------------------------- To open an Excel 2007 and later workbook with a single sheet (or a workbook with multiple sheets but you just want the first sheet), use the following: diff --git a/src/tablib/core.py b/src/tablib/core.py index 107cbe8a..85b01087 100644 --- a/src/tablib/core.py +++ b/src/tablib/core.py @@ -815,7 +815,7 @@ def get_col(self, index): # ---- def add_formatter(self, col, handler): - """Adds a :ref:`formatter` to the :class:`Dataset`. + """Adds a formatter to the :class:`Dataset`. .. versionadded:: 0.9.5 :param col: column to. Accepts index int or header str. diff --git a/requirements.txt b/tests/requirements.txt similarity index 83% rename from requirements.txt rename to tests/requirements.txt index 11061933..cd43514a 100644 --- a/requirements.txt +++ b/tests/requirements.txt @@ -1,3 +1,5 @@ +pytest +pytest-cov backports.csv; python_version < '3.0' MarkupPy odfpy diff --git a/tests/test_tablib.py b/tests/test_tablib.py index 216ca880..c872e81c 100755 --- a/tests/test_tablib.py +++ b/tests/test_tablib.py @@ -1103,7 +1103,3 @@ class DocTests(unittest.TestCase): def test_rst_formatter_doctests(self): results = doctest.testmod(tablib.formats._rst) self.assertEqual(results.failed, 0) - - -if __name__ == '__main__': - unittest.main() diff --git a/tox.ini b/tox.ini index fdfb05da..ebd8f538 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,40 @@ [tox] +usedevelop = true minversion = 2.4 -envlist = py27, py35, py36, py37 +envlist = + py{27,35,36,37,38}-tests, + py37-{docs,lint} [testenv] +basepython = + py27: python2.7 + py35: python3.5 + py36: python3.6 + py37: python3.7 + py38: python3.8 deps = - pytest - pytest-cov - -rrequirements.txt + tests: -rtests/requirements.txt + docs: sphinx extras = pandas -commands = pytest +commands = + tests: pytest {posargs:tests} + docs: sphinx-build -b html -d {envtmpdir}/doctrees docs {envtmpdir}/html + +[testenv:py37-lint] +basepython = python3.7 +deps = + flake8 + # flake8-black + # flake8-isort + twine + check-manifest +commands = + # flake8 src/tablib tests/ + check-manifest -v + python setup.py sdist + twine check dist/* + +[flake8] +exclude = + .tox +ignore=E501,E127,E128,E124