From 3dbc57ed126f6ec918d387a7efbad99aa685e515 Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Fri, 19 Oct 2018 14:58:01 -0400 Subject: [PATCH 1/8] Up version to 3.1.dev0 Also update to be PEP 440 compliant in preparation for #732. --- markdown/__init__.py | 34 ++++++++++++++++++++-------------- setup.py | 6 ++---- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/markdown/__init__.py b/markdown/__init__.py index 80434e96c..b39202d6b 100644 --- a/markdown/__init__.py +++ b/markdown/__init__.py @@ -23,36 +23,42 @@ from __future__ import absolute_import from __future__ import unicode_literals from .core import Markdown, markdown, markdownFromFile +from pkg_resources.extern import packaging # For backward compatibility as some extensions expect it... from .extensions import Extension # noqa __all__ = ['Markdown', 'markdown', 'markdownFromFile'] -# version_info should conform to PEP 386 -# (major, minor, micro, alpha/beta/rc/final, #) -# (1, 1, 2, 'alpha', 0) => "1.1.2.dev" +# version must conform to PEP 440 +# https://www.python.org/dev/peps/pep-0440/ + +# __version_info__ format: +# (major, minor, patch, dev/alpha/beta/rc/final, #) +# (1, 1, 2, 'dev', 0) => "1.1.2.dev0" +# (1, 1, 2, 'alpha', 1) => "1.1.2a1" # (1, 2, 0, 'beta', 2) => "1.2b2" -__version_info__ = (3, 0, 1, 'final', 0) +# (1, 2, 0, 'rc', 4) => "1.2rc4" +# (1, 2, 0, 'final', 0) => "1.2" +__version_info__ = (3, 1, 0, 'dev', 0) def _get_version(): # pragma: no cover - " Returns a PEP 386-compliant version number from version_info. " + " Returns a PEP 440-compliant version number from version_info. " assert len(__version_info__) == 5 - assert __version_info__[3] in ('alpha', 'beta', 'rc', 'final') + assert __version_info__[3] in ('dev', 'alpha', 'beta', 'rc', 'final') parts = 2 if __version_info__[2] == 0 else 3 - main = '.'.join(map(str, __version_info__[:parts])) + v = '.'.join(map(str, __version_info__[:parts])) - sub = '' - if __version_info__[3] == 'alpha' and __version_info__[4] == 0: - # TODO: maybe append some sort of git info here?? - sub = '.dev' + if __version_info__[3] == 'dev': + v += '.dev' + str(__version_info__[4]) elif __version_info__[3] != 'final': - mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c'} - sub = mapping[__version_info__[3]] + str(__version_info__[4]) + mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'rc'} + v += mapping[__version_info__[3]] + str(__version_info__[4]) - return str(main + sub) + # Ensure version is valid and normalized + return str(packaging.version.Version(v)) __version__ = _get_version() diff --git a/setup.py b/setup.py index f906389f4..db17abc68 100755 --- a/setup.py +++ b/setup.py @@ -28,15 +28,13 @@ # Get development Status for classifiers dev_status_map = { + 'dev': '2 - Pre-Alpha', 'alpha': '3 - Alpha', 'beta': '4 - Beta', 'rc': '4 - Beta', 'final': '5 - Production/Stable' } -if __version_info__[3] == 'alpha' and __version_info__[4] == 0: - DEVSTATUS = '2 - Pre-Alpha' -else: - DEVSTATUS = dev_status_map[__version_info__[3]] +DEVSTATUS = dev_status_map[__version_info__[3]] # The command line script name. Currently set to "markdown_py" so as not to # conflict with the perl implimentation (which uses "markdown"). From c4c7cf54a3984d5799b21aec3a8a0fb2a8a24903 Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Sun, 21 Oct 2018 14:15:52 -0400 Subject: [PATCH 2/8] Add pyproject.toml file --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..02caf492b --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +# Minimum requirements for the build system to execute. +requires = ["setuptools>=36", "wheel"] From 8ea39b52fa0a909caa5cd64ab9afb7e416e693fa Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Sun, 21 Oct 2018 14:59:31 -0400 Subject: [PATCH 3/8] tox.ini experimental tweaks --- tox.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tox.ini b/tox.ini index 42cdd50c3..8dd72c8b6 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,7 @@ [tox] envlist = py27, py34, py35, py36, py37, pypy, pypy3, flake8, checkspelling +requires = setuptools>=36 +isolated_build = True [testenv] deps = -rtest-requirements.txt From 2b746cf71b33296e61649ce973064150f5fc85cc Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Sun, 21 Oct 2018 15:03:08 -0400 Subject: [PATCH 4/8] Add build-backend key to project.toml --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 02caf492b..a1d0683e2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,4 @@ [build-system] # Minimum requirements for the build system to execute. requires = ["setuptools>=36", "wheel"] +build-backend = "setuptools.build_meta" From e660f5b4a1186f0aa1c2dcc8acf937eafe58f3b0 Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Sun, 21 Oct 2018 15:10:40 -0400 Subject: [PATCH 5/8] Update travis.yml --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 01bdbd682..c050aced8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,6 +30,7 @@ addons: - aspell-en install: + - pip install 'setuptools>=36' - pip install tox - pip install 'coverage<4.0' - pip install codecov From f1e4f2290fde09e7114d11707ae465e93f0b2d63 Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Sun, 21 Oct 2018 15:14:21 -0400 Subject: [PATCH 6/8] More tox tweaks --- tox.ini | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 8dd72c8b6..0e130aebf 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,10 @@ requires = setuptools>=36 isolated_build = True [testenv] -deps = -rtest-requirements.txt +deps = + coverage<4.0 + pyyaml + pytidylib commands = coverage run --source=markdown -m unittest discover {toxinidir}/tests coverage report --show-missing From 53ee6a7263dcaf8690cce34f771deeeb89e9142a Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Sun, 21 Oct 2018 15:35:54 -0400 Subject: [PATCH 7/8] Add install_requires to setup.py --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index db17abc68..f32f105cc 100755 --- a/setup.py +++ b/setup.py @@ -77,6 +77,7 @@ license='BSD License', packages=['markdown', 'markdown.extensions'], python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*', + install_requires=['setuptools=>36'], entry_points={ 'console_scripts': [ '%s = markdown.__main__:run' % SCRIPT_NAME, From 12d51e8725bdb6a4c1e762674bf40191d5361aa7 Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Sun, 21 Oct 2018 15:54:08 -0400 Subject: [PATCH 8/8] fix formatting --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index f32f105cc..938defa20 100755 --- a/setup.py +++ b/setup.py @@ -77,7 +77,7 @@ license='BSD License', packages=['markdown', 'markdown.extensions'], python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*', - install_requires=['setuptools=>36'], + install_requires=['setuptools >= 36'], entry_points={ 'console_scripts': [ '%s = markdown.__main__:run' % SCRIPT_NAME,