From 933e500c65c55ddc05e136af8603d9fa9e40c317 Mon Sep 17 00:00:00 2001 From: Andrew Pinkham Date: Mon, 17 Apr 2017 17:33:46 -0400 Subject: [PATCH] Version 2: Python & Markdown compatibility changes (#5) Core functionality remains the same. Python and Python Markdown versions are changed. Repository infrastructure changed. - Add test/support for Python-Markdown 2.6 - Drop Support For: - Python 2.6 (EOL 2013) - Python 3.2 (EOL 2016) - Python-Markdown 2.4 (Superceded in 2014) - Fix Issue #2 - Setup.py errors; Description.rst missing - Replace coveralls with codecov - Add repository information such as AUTHORS and HISTORY - Update Makefile dist and release for PyPI changes --- .bumpversion.cfg | 9 +++ .travis.yml | 35 +++++----- AUTHORS.rst | 13 ++++ DESCRIPTION.rst | 40 ------------ HISTORY.rst | 20 ++++++ LICENSE | 3 +- MANIFEST.in | 6 ++ Makefile | 15 +++-- README.md | 69 -------------------- README.rst | 101 +++++++++++++++++++++++++++++ mdx_subscript.py | 2 +- requirements/dev_requirements.txt | 11 ++-- requirements/run_requirements.txt | 2 +- requirements/test_requirements.txt | 6 +- setup.cfg | 2 +- setup.py | 35 ++++++---- tests/test_subscript.py | 2 +- tox.ini | 20 ++++++ 18 files changed, 235 insertions(+), 156 deletions(-) create mode 100644 .bumpversion.cfg create mode 100644 AUTHORS.rst delete mode 100644 DESCRIPTION.rst create mode 100644 HISTORY.rst create mode 100644 MANIFEST.in delete mode 100644 README.md create mode 100644 README.rst create mode 100644 tox.ini diff --git a/.bumpversion.cfg b/.bumpversion.cfg new file mode 100644 index 0000000..dda226a --- /dev/null +++ b/.bumpversion.cfg @@ -0,0 +1,9 @@ +[bumpversion] +current_version = 2.0.0 +commit = True +tag = True + +[bumpversion:file:setup.py] +search = version='{current_version}' +replace = version='{new_version}' + diff --git a/.travis.yml b/.travis.yml index 54e9e66..3862ba5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,23 +1,24 @@ +branches: + only: + - development language: python python: - - "2.6" - - "2.7" - - "3.2" - - "3.3" - - "3.4" - - "pypy" + - 2.7 + - 3.3 + - 3.4 + - 3.5 + - 3.6 + - pypy +cache: + pip: true env: - - "MD_VERSION=2.4.1" - - "MD_VERSION=2.5.1" + - MD_VERSION=2.5 MD_NEXT=2.6 + - MD_VERSION=2.6 MD_NEXT=2.7 install: - - "pip install -q Markdown==$MD_VERSION" - - "pip install ." - - "pip install -r requirements/test_requirements.txt" + - pip install -q "Markdown>=$MD_VERSION,<$MD_NEXT" + - pip install . + - pip install -r requirements/test_requirements.txt script: - - "nosetests --with-coverage --cover-package=mdx_subscript" + - nosetests --with-coverage --cover-branches --cover-package=mdx_subscript after_success: - - "coveralls" -matrix: - exclude: - - python: "2.6" - env: "MD_VERSION=2.5.1" + - codecov diff --git a/AUTHORS.rst b/AUTHORS.rst new file mode 100644 index 0000000..6b6d139 --- /dev/null +++ b/AUTHORS.rst @@ -0,0 +1,13 @@ +======= +Credits +======= + +Development Lead +---------------- + +* Andrew Pinkham + +Contributors +------------ + +* Adrian diff --git a/DESCRIPTION.rst b/DESCRIPTION.rst deleted file mode 100644 index 726240c..0000000 --- a/DESCRIPTION.rst +++ /dev/null @@ -1,40 +0,0 @@ -An extension to the `Python Markdown`_ project which adds the ability to subscript text. To do so, the character :code:`~` becomes a Markdown tag for text meant to be subscripted, and is replaced with the HTML :code:`sub` tag. - -For example, given the text: :: - - The molecular composition of water is H~2~O. - -… using Markdown with this extension will output: :: - -

The molecular composition of water is H2O.

- -This project is provided under the `Simplified (2 Clause) BSD license`_. - -Installation ------------- - -:: - - pip install MarkdownSubscript - -Usage ------ - -Python -^^^^^^ - ->>> from markdown import markdown ->>> text = "The molecular composition of water is H~2~O." ->>> markdown(text, ['subscript']) -'

The molecular composition of water is H2O.

' - -Command Line -^^^^^^^^^^^^ - -:: - - $ echo 'The molecular composition of water is H~2~O.' > text.md - $ python -m markdown -o html5 -x 'subscript' -f text.html text.md - -.. _`Python Markdown`: https://pypi.python.org/pypi/Markdown -.. _`Simplified (2 Clause) BSD license`: http://choosealicense.com/licenses/bsd-2-clause/ diff --git a/HISTORY.rst b/HISTORY.rst new file mode 100644 index 0000000..e84e9b1 --- /dev/null +++ b/HISTORY.rst @@ -0,0 +1,20 @@ +2.0.0 (2017-04-17) +===== + - Add test/support for Python-Markdown 2.6 + - Drop Support For: + - Python 2.6 (EOL 2013) + - Python 3.2 (EOL 2016) + - Python-Markdown 2.4 (Superceded in 2014) + - Fix Issue #2 - Setup.py errors; Description.rst missing + +1.0.1 (2014-10-17) +===== + - Update for Python-Markdown 2.5 + +1.0.0 (2014-07-29) +====== + - Initial Release of Markdown Subscript Extension + - Compatible with: + - Python-Markdown 2.4 + - Python 2.6, 2.7 + - Python 3.2, 3.3, 3.4 diff --git a/LICENSE b/LICENSE index 3e270fc..c4a8b5c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2014, Andrew Pinkham +Copyright (c) 2014-2017, Andrew Pinkham All rights reserved. Redistribution and use in source and binary forms, with or without @@ -21,4 +21,3 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..337c8fe --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,6 @@ +include AUTHORS.rst +include README.rst + +include LICENSE + +recursive-include requirements *.txt diff --git a/Makefile b/Makefile index 51cf1ab..c6dcbfa 100644 --- a/Makefile +++ b/Makefile @@ -3,23 +3,28 @@ test: nosetests --with-coverage --cover-package=mdx_subscript +tox: + tox + description: - rst2html.py DESCRIPTION.rst > description.html + rst2html.py README.rst > readme.html check: python setup.py check dist: - python setup.py sdist --formats=gztar,zip bdist_wheel + python setup.py sdist --formats=gztar bdist_wheel gpg --armor --detach-sign -u 5878672C -a dist/MarkdownSubscript*.whl gpg --armor --detach-sign -u 5878672C -a dist/MarkdownSubscript*.tar.gz - gpg --armor --detach-sign -u 5878672C -a dist/MarkdownSubscript*.zip release: twine upload dist/* clean: - rm -rf __pycache__ + find . -name "*.pyc" -delete + find . -name "__pycache__" -delete + rm -rf *.egg-info + rm -rf .coverage + rm -rf .tox rm -rf build rm -rf dist - rm -rf *.egg-info diff --git a/README.md b/README.md deleted file mode 100644 index debc286..0000000 --- a/README.md +++ /dev/null @@ -1,69 +0,0 @@ -# Markdown Subscript - -[![Build Status](https://travis-ci.org/jambonrose/markdown_subscript_extension.svg?branch=master)](https://travis-ci.org/jambonrose/markdown_subscript_extension) -[![Coverage Status](https://img.shields.io/coveralls/jambonrose/markdown_subscript_extension.svg)](https://coveralls.io/r/jambonrose/markdown_subscript_extension) -[![PyPI Version](http://img.shields.io/pypi/v/MarkdownSubscript.svg)](https://pypi.python.org/pypi/MarkdownSubscript/) -[![License](http://img.shields.io/pypi/l/MarkdownSubscript.svg)](http://opensource.org/licenses/BSD-2-Clause) - -An extension to [Waylan Limberg](https://github.com/waylan)'s [Python Markdown](https://github.com/waylan/Python-Markdown) project ([documentation here](https://pythonhosted.org/Markdown/index.html)) that provides support for subscript text in Markdown. The extension treats `~` characters as tags, converting pairs into HTML `sub` tags. - -Given the text: - - The molecular composition of water is H~2~O. - -… using Markdown with this extension will output: - -

The molecular composition of water is H2O.

- -This project is provided under the [Simplified (2 Clause) BSD license](http://choosealicense.com/licenses/bsd-2-clause/), provided in full in the LICENSE file. - -## Installation - -Dependencies: - -- Python 2.6, 2.7, 3.2+ -- Markdown 2.4+ (Tested against 2.4.1, 2.5.1) - -To install the latest stable release (recommended): - -```bash -$ pip install MarkdownSubscript -``` - -To install the development version: - -```bash -$ pip install git+git://github.com/jambonrose/markdown_subscript_extension.git -``` - -## Basic Usage - -### Python - -```python ->>> from markdown import markdown ->>> text = "The molecular composition of water is H~2~O." ->>> markdown(text, ['subscript']) -'

The molecular composition of water is H2O.

' -``` - -### Command Line - -```bash -$ echo 'The molecular composition of water is H~2~O.' > text.md -$ python -m markdown -o html5 -x 'subscript' -f text.html text.md -``` - -## Development - -Development requires the installation of [Python](https://www.python.org/) and [Pip](https://pip.pypa.io/en/latest/installing.html). A virtual environment, such as [virtualenvwrapper](https://pypi.python.org/pypi/virtualenvwrapper) (used in the example below), is recommended. Once these are installed, the following steps may be taken: - -```bash -$ git clone https://github.com/jambonrose/markdown_subscript_extension.git -$ cd markdown_subscript_extension/ -$ mkvirtualenv markdown_subcript # recommended, but optional -$ cat requirements/* > requirements.txt -$ pip install -r requirements.txt -``` - -The `Makefile` provides the ability to run tests by invoking `$ make test`, which will invoke the nose package with the command `$ nosetests --with-coverage --cover-package=mdx_subscript` (incidentally, this is also the command used on [TravisCI](https://travis-ci.org/jambonrose/markdown_subscript_extension) and [Coveralls.io](https://coveralls.io/r/jambonrose/markdown_subscript_extension)). diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..7d45f65 --- /dev/null +++ b/README.rst @@ -0,0 +1,101 @@ +Latest Release: |Version| + +Compatibility: |Implementation| |Python| |License| + +Tests: |Build| |Coverage| |Requirements| + +.. |Version| image:: http://img.shields.io/pypi/v/MarkdownSubscript.svg + :target: https://pypi.python.org/pypi/MarkdownSubscript/ + :alt: PyPI Version + +.. |Implementation| image:: https://img.shields.io/pypi/implementation/MarkdownSubscript.svg + :target: https://pypi.python.org/pypi/MarkdownSubscript/ + :alt: Python Implementation Support + +.. |Python| image:: https://img.shields.io/pypi/pyversions/MarkdownSubscript.svg + :target: https://pypi.python.org/pypi/MarkdownSubscript/ + :alt: Python Support + +.. |License| image:: http://img.shields.io/pypi/l/MarkdownSubscript.svg + :target: http://opensource.org/licenses/BSD-2-Clause + :alt: License + +.. |Build| image:: https://travis-ci.org/jambonrose/markdown_subscript_extension.svg?branch=development + :target: https://travis-ci.org/jambonrose/markdown_subscript_extension + :alt: Build Status + +.. |Coverage| image:: https://img.shields.io/coveralls/jambonrose/markdown_subscript_extension.svg + :target: https://coveralls.io/r/jambonrose/markdown_subscript_extension + :alt: Coverage Status + +.. |Requirements| image:: https://requires.io/github/jambonrose/markdown_subscript_extension/requirements.svg?branch=development + :target: https://requires.io/github/jambonrose/markdown_subscript_extension/requirements/?branch=development + :alt: Requirements Status + +======= +Read Me +======= + +An extension to the `Python Markdown`_ project which adds the ability to +subscript text. To do so, the character :code:`~` becomes a Markdown tag +for text meant to be subscripted, and is replaced with the HTML +:code:`sub` tag. + +For example, given the text: :: + + The molecular composition of water is H~2~O. + +… using Markdown with this extension will output: + +.. code :: html + +

The molecular composition of water is H2O.

+ +This project is provided under the `Simplified (2 Clause) BSD license`_, +provided in full in the LICENSE file. + +.. _`Python Markdown`: https://pypi.python.org/pypi/Markdown +.. _`Simplified (2 Clause) BSD license`: http://choosealicense.com/licenses/bsd-2-clause/ + +Installation +------------ + +Dependencies: + +- Python 2.7, 3.3+ + +- Markdown 2.5+ + (Tested against latest patch version of Markdown 2.5 and 2.6) + +To install the latest stable release (recommended): + +.. code :: bash + + pip install MarkdownSubscript + +To install the development version: + +.. code :: bash + + pip install git+git://github.com/jambonrose/markdown_subscript_extension.git + +Basic Usage +----------- + +Python +^^^^^^ + +.. code :: pycon + + >>> from markdown import markdown + >>> text = "The molecular composition of water is H~2~O." + >>> markdown(text, ['subscript']) + '

The molecular composition of water is H2O.

' + +Command Line +^^^^^^^^^^^^ + +.. code :: bash + + $ echo 'The molecular composition of water is H~2~O.' > text.md + $ python -m markdown -o html5 -x 'subscript' -f text.html text.md diff --git a/mdx_subscript.py b/mdx_subscript.py index 93194b4..e143615 100644 --- a/mdx_subscript.py +++ b/mdx_subscript.py @@ -12,7 +12,7 @@

The molecular composition of water is H2O.

:website: https://github.com/jambonrose/markdown_subscript_extension -:copyright: Copyright 2014 Andrew Pinkham +:copyright: Copyright 2014-2017 Andrew Pinkham :license: Simplified BSD, see LICENSE for details. """ diff --git a/requirements/dev_requirements.txt b/requirements/dev_requirements.txt index 18c0be6..6e2e402 100644 --- a/requirements/dev_requirements.txt +++ b/requirements/dev_requirements.txt @@ -1,5 +1,6 @@ -docutils -flake8 -pylint -wheel -twine +bumpversion==0.5.3 +docutils==0.13.1 +flake8==3.3.0 +tox==2.7.0 +twine==1.8.1 +wheel==0.29.0 diff --git a/requirements/run_requirements.txt b/requirements/run_requirements.txt index 0f00a03..6e0e5ba 100644 --- a/requirements/run_requirements.txt +++ b/requirements/run_requirements.txt @@ -1 +1 @@ -Markdown>=2.0 +Markdown>=2.5,<2.7 diff --git a/requirements/test_requirements.txt b/requirements/test_requirements.txt index 60c9fa1..a547371 100644 --- a/requirements/test_requirements.txt +++ b/requirements/test_requirements.txt @@ -1,3 +1,3 @@ -nose -coverage -coveralls +codecov==2.0.5 +coverage==4.3.4 +nose==1.3.7 diff --git a/setup.cfg b/setup.cfg index 3c6e79c..2a9acf1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,2 @@ [bdist_wheel] -universal=1 +universal = 1 diff --git a/setup.py b/setup.py index 51ff2b9..6e14d82 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ ================================== :website: https://github.com/jambonrose/markdown_subscript_extension -:copyright: Copyright 2014 Andrew Pinkham +:copyright: Copyright 2014-2017 Andrew Pinkham :license: Simplified BSD, see LICENSE for details. """ @@ -18,19 +18,29 @@ HERE = path.abspath(path.dirname(__file__)) -# Get the long description from the relevant file -with codec_open(path.join(HERE, 'DESCRIPTION.rst'), encoding='utf-8') as f: - LONG_DESCRIPTION = f.read() +# Get the long description from the Read Me +with codec_open(path.join(HERE, 'README.rst'), encoding='utf-8') as f: + long_description = f.read() + +# Get runtime dependencies +run_reqs = 'requirements/run_requirements.txt' +with codec_open(path.join(HERE, run_reqs), encoding='utf-8') as f: + install_requires = f.read().splitlines() + +# Get test dependencies +test_reqs = 'requirements/test_requirements.txt' +with codec_open(path.join(HERE, test_reqs), encoding='utf-8') as f: + tests_require = f.read().splitlines() setup( name='MarkdownSubscript', - version='1.0.1', # PEP 440 Compliant Semantic Versioning + version='2.0.0', # PEP 440 Compliant Semantic Versioning - keywords='text filter markdown html subscript', + keywords=['text', 'filter', 'markdown', 'html', 'subscript'], description='Python-Markdown extension to allow for subscript text.', - long_description=LONG_DESCRIPTION, + long_description=long_description, author='Andrew Pinkham', author_email='hello at andrewsforge dot com', @@ -38,7 +48,9 @@ url='https://github.com/jambonrose/markdown_subscript_extension', py_modules=['mdx_subscript'], - install_requires=['Markdown>=2.4'], + install_requires=install_requires, + test_suite='tests', + tests_require=tests_require, license='Simplified BSD License', classifiers=[ @@ -48,13 +60,14 @@ 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', - 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: Implementation :: CPython', + 'Programming Language :: Python :: Implementation :: PyPy', 'Topic :: Software Development :: Libraries :: Python Modules', 'Topic :: Text Processing :: Filters', 'Topic :: Text Processing :: Markup :: HTML', diff --git a/tests/test_subscript.py b/tests/test_subscript.py index cb66e80..32cb876 100644 --- a/tests/test_subscript.py +++ b/tests/test_subscript.py @@ -5,7 +5,7 @@ ================================== :website: https://github.com/jambonrose/markdown_subscript_extension -:copyright: Copyright 2014 Andrew Pinkham +:copyright: Copyright 2014-2017 Andrew Pinkham :license: BSD, see LICENSE for details. """ diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..d0c6304 --- /dev/null +++ b/tox.ini @@ -0,0 +1,20 @@ +# Tox (http://tox.testrun.org/) is a tool for running tests +# in multiple virtualenvs. To use it, "pip install tox" +# and then run "tox" from this directory. + +[tox] +envlist = flake8,{py27,py33,py34,py35,py36,pypy}-markdown{25,26} + +[testenv:flake8] +basepython=python3 +deps=flake8 +commands=flake8 . + +[testenv] +setenv = + PYTHONPATH = {toxinidir}:{toxinidir} +deps = + markdown25: Markdown>=2.5,<2.6 + markdown26: Markdown>=2.6,<2.7 + -r{toxinidir}/requirements/test_requirements.txt +commands = nosetests --with-coverage --cover-branches --cover-package=mdx_subscript