From 08b0d798166a985ce1a8edfd25bc417a920c54a4 Mon Sep 17 00:00:00 2001 From: mpacer Date: Tue, 23 May 2017 15:57:54 -0700 Subject: [PATCH 01/14] Improve CONTRIBUTING.md and surface nbconvert[all] --- CONTRIBUTING.md | 15 +++++++++++++++ setup.py | 11 +++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d6aaa7326..5d91a5bab 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,3 +3,18 @@ We follow the [Jupyter Contribution Workflow](https://jupyter.readthedocs.io/en/latest/contributor/content-contributor.html) and the [IPython Contributing Guide](https://github.com/ipython/ipython/blob/master/CONTRIBUTING.md). + +# Testing + +In order to test all the features of nbconvert you need to have `pandoc` and +`TexLive` installed. + +In your environment `pip install nbconvert[all]` will be needed to be able to +run all of the tests and to test all of the features. + +If you only want to run some of the tests run `pip install nbconvert[test]`. + +# Releasing + +If you are going to release a version of `nbconvert` you should also be capable +of testing it. Please follow the instructions in [Testing](#testing). diff --git a/setup.py b/setup.py index 08fbbe1d4..093c7371e 100644 --- a/setup.py +++ b/setup.py @@ -197,13 +197,20 @@ def run(self): 'testpath', ] -extras_require = setuptools_args['extras_require'] = { +extra_requirements = { # FIXME: tests still require nose for some utility calls, # but we are running with pytest - 'test': ['pytest', 'pytest-cov', 'nose', 'ipykernel', 'jupyter_client'], + 'test': ['pytest', 'pytest-cov', 'nose', 'ipykernel', 'jupyter_client>=4.2'], 'serve': ['tornado>=4.0'], 'execute': ['jupyter_client>=4.2'], } +s = [] +[s.extend(values) for values in extra_requirements.values()] +extra_requirements['all'] = list(set(s)) + +extras_require = setuptools_args['extras_require'] = { + **extra_requirements +} if 'setuptools' in sys.modules: from setuptools.command.develop import develop From 82f87ea85061893fd14f07d1d6390c36c7300667 Mon Sep 17 00:00:00 2001 From: mpacer Date: Tue, 23 May 2017 18:45:10 -0700 Subject: [PATCH 02/14] add release instructions ala notebook --- docs/source/development_release.rst | 80 +++++++++++++++++++++++++++++ docs/source/index.rst | 1 + 2 files changed, 81 insertions(+) create mode 100644 docs/source/development_release.rst diff --git a/docs/source/development_release.rst b/docs/source/development_release.rst new file mode 100644 index 000000000..8224b05bf --- /dev/null +++ b/docs/source/development_release.rst @@ -0,0 +1,80 @@ +.. _nbconvert_release: + +Making an ``nbconvert`` release +=============================== + +This document guides a contributor through creating a release of ``nbconvert``. + + +Assign all merged PRs to milestones +----------------------------------- + +Go to GitHub and assign all PRs that have been merged to milestones. +This will be helpful when you update the changelog. + +Check installed tools +--------------------- + +Review ``CONTRIBUTING.md``, particularly the testing and release sections. + +Clean the repository +-------------------- + +You can remove all non-tracked files with: + +.. code:: bash + + git clean -xfdi + +This would ask you for confirmation before removing all untracked files. + +Make sure the ``dist/`` folder is clean and avoid stale builds from +previous attempts. + +Create the release +------------------ + +#. Update the changelog to account for all the PRs assigned to this milestone. + +#. Update version number in ``notebook/_version.py``. + +#. Commit and tag the release with the current version number: + + .. code:: bash + + git commit -am "release $VERSION" + git tag $VERSION + +#. You are now ready to build the ``sdist`` and ``wheel``: + + .. code:: bash + + python setup.py sdist + python setup.py bdist_wheel + +#. You can now test the ``wheel`` and the ``sdist`` locally before uploading + to PyPI. Make sure to use `twine `_ to + upload the archives over SSL. + + .. code:: bash + + twine upload dist/* + +Release the new version +----------------------- + +#. Push directly on master, including --tags separately + + .. code:: bash + + git push upstream + git push upstream --tags + +#. Push tages on master forgetting to push ``--tags`` too. + + +Return to development state +--------------------------- + +#. If all went well, change the ``notebook/_version.py`` back adding the + ``.dev`` suffix. \ No newline at end of file diff --git a/docs/source/index.rst b/docs/source/index.rst index 332087f89..6208c47f6 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -54,6 +54,7 @@ batch of notebook files to another format. architecture api/index + development_release .. toctree:: :maxdepth: 2 From f1a8e8fc3bc77269faeff82d61650f36352a809d Mon Sep 17 00:00:00 2001 From: mpacer Date: Tue, 23 May 2017 19:29:15 -0700 Subject: [PATCH 03/14] add better version number checking --- nbconvert/_version.py | 58 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/nbconvert/_version.py b/nbconvert/_version.py index 89c237dc6..a4c804a5f 100644 --- a/nbconvert/_version.py +++ b/nbconvert/_version.py @@ -1,2 +1,56 @@ -version_info = (5, 2, 0,'.dev') -__version__ = '.'.join(map(str, version_info[0:3])) + ''.join(version_info[3:]) +import pep440 + + +def create_valid_version(release_info, epoch=None, pre_input='', dev_input=''): + ''' + Creates a pep440 valid version of version number given a tuple integers + and optional epoch, prerelease and developmental info. + + Parameters + ---------- + release_info : Tuple(Int) + epoch : Int, default None + pre_input : Str, default '' + dev_input : Str, default '' + ''' + + pep440_err = "The version number is not a pep 440 compliant version number" + + + if epoch is not None: + epoch_seg = str(epoch) + '!' + else: + epoch_seg = '' + + release_seg = '.'.join(map(str, release_info)) + + _magic_pre = ['a','b','rc'] + if pre_input!='' and not any([pre_input.startswith(prefix) for prefix in _magic_pre]): + raise ValueError(pep440_err + "\n please fix your prerelease segment.") + else: + pre_seg = pre_input + + if dev_input!='' and (not dev_input.startswith('.') and dev_input.startswith('dev')): + dev_seg = ''.join(['.', dev_input]) + elif dev_input=='' or dev_input.startswith('.dev'): + dev_seg = dev_input + elif dev_input!='': + print(dev_input) + raise ValueError(pep440_err + "\n please fix your development segment.") + + out_version = ''.join([epoch_seg, release_seg, pre_seg, dev_seg]) + + print(out_version) + if pep440.is_canonical(out_version): + return out_version + else: + raise ValueError(pep440_err) + + + +version_info = (5, 2, 0) +pre_info = '' +dev_info = '.dev0' +__version__ = create_valid_version(version_info, pre_input=pre_info, dev_input=dev_info) + + From 6503dd4e24e5026b56abc06d06dbd70c9b69fe6e Mon Sep 17 00:00:00 2001 From: mpacer Date: Tue, 23 May 2017 19:31:55 -0700 Subject: [PATCH 04/14] add pep440 to setup.py requirements --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 093c7371e..71a394309 100644 --- a/setup.py +++ b/setup.py @@ -195,6 +195,7 @@ def run(self): 'bleach', 'pandocfilters>=1.4.1', 'testpath', + 'pep440' ] extra_requirements = { From 696b08cd9b59440aba6195c68cfc7b6d5ef765d8 Mon Sep 17 00:00:00 2001 From: mpacer Date: Tue, 23 May 2017 19:44:36 -0700 Subject: [PATCH 05/14] take into account the nonneed to pass in an integer at dev_seg --- nbconvert/_version.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/nbconvert/_version.py b/nbconvert/_version.py index a4c804a5f..58fa7ff45 100644 --- a/nbconvert/_version.py +++ b/nbconvert/_version.py @@ -29,18 +29,21 @@ def create_valid_version(release_info, epoch=None, pre_input='', dev_input=''): raise ValueError(pep440_err + "\n please fix your prerelease segment.") else: pre_seg = pre_input - - if dev_input!='' and (not dev_input.startswith('.') and dev_input.startswith('dev')): + + if dev_input=='': + dev_seg = dev_input + elif not dev_input.startswith('.') and dev_input.startswith('dev'): dev_seg = ''.join(['.', dev_input]) - elif dev_input=='' or dev_input.startswith('.dev'): + elif dev_input.startswith('.dev'): dev_seg = dev_input elif dev_input!='': - print(dev_input) raise ValueError(pep440_err + "\n please fix your development segment.") + + if dev_input!='' and not any([dev_seg.endswith(str(n)) for n in range(10)]): + dev_seg = ''.join([dev_seg,'0']) out_version = ''.join([epoch_seg, release_seg, pre_seg, dev_seg]) - print(out_version) if pep440.is_canonical(out_version): return out_version else: @@ -50,7 +53,7 @@ def create_valid_version(release_info, epoch=None, pre_input='', dev_input=''): version_info = (5, 2, 0) pre_info = '' -dev_info = '.dev0' +dev_info = '.dev' __version__ = create_valid_version(version_info, pre_input=pre_info, dev_input=dev_info) From 044cc7fcc900d0b01df04be563d7e55b6bc3dcc2 Mon Sep 17 00:00:00 2001 From: mpacer Date: Tue, 23 May 2017 19:55:23 -0700 Subject: [PATCH 06/14] Ok, just grab all the things from pep440 --- nbconvert/_version.py | 40 ++++++++++++++++++++++++++++++++++------ setup.py | 1 - 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/nbconvert/_version.py b/nbconvert/_version.py index 58fa7ff45..c32151a3b 100644 --- a/nbconvert/_version.py +++ b/nbconvert/_version.py @@ -1,5 +1,9 @@ -import pep440 +# import pep440 # cannot be imported as described below +version_info = (5, 2, 0) +pre_info = '' +dev_info = '.dev' +__version__ = create_valid_version(version_info, pre_input=pre_info, dev_input=dev_info) def create_valid_version(release_info, epoch=None, pre_input='', dev_input=''): ''' @@ -44,16 +48,40 @@ def create_valid_version(release_info, epoch=None, pre_input='', dev_input=''): out_version = ''.join([epoch_seg, release_seg, pre_seg, dev_seg]) - if pep440.is_canonical(out_version): + if is_canonical(out_version): return out_version else: raise ValueError(pep440_err) +# This has been ported directly from the pep440 package since it cannot be +# installed as part of a setuptools based install without using pyproject.toml +posint = '(0|[1-9]\d*)' + +# 0!0.0.0rc0.post0.dev0 + +tpl_string_re = ('^' # Start + '([1-9]\d*!)?' # [N!] + '{posint}' # N + '(\.{posint})*' # (.N)* + '((a|b|rc){posint})?' # [{a|b|rc}N] + '(\.post{posint})?' # [.postN] + '(\.dev{postdev})?' # [.devN] + '$') +string_re = tpl_string_re.format(posint=posint, postdev=posint) +loose440re = re.compile(tpl_string_re.format(posint=posint, postdev=(posint+'?'))) +pep440re = re.compile(string_re) + +def is_canonical(version, loosedev=False): + """ + Return whether or not the version string is canonical according to Pep 440 + """ + if loosedev: + return loose440re.match(version) is not None + return pep440re.match(version) is not None + + +# this is the end of the direct port from pep440 -version_info = (5, 2, 0) -pre_info = '' -dev_info = '.dev' -__version__ = create_valid_version(version_info, pre_input=pre_info, dev_input=dev_info) diff --git a/setup.py b/setup.py index 71a394309..093c7371e 100644 --- a/setup.py +++ b/setup.py @@ -195,7 +195,6 @@ def run(self): 'bleach', 'pandocfilters>=1.4.1', 'testpath', - 'pep440' ] extra_requirements = { From c43eff339d16a7ed8585fc59e681f4965668d5d2 Mon Sep 17 00:00:00 2001 From: mpacer Date: Tue, 23 May 2017 20:01:14 -0700 Subject: [PATCH 07/14] move _version_tools into their own place and leave _version somewhat isolated --- nbconvert/_version.py | 82 +----------------------------------- nbconvert/_version_tools.py | 83 +++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 81 deletions(-) create mode 100644 nbconvert/_version_tools.py diff --git a/nbconvert/_version.py b/nbconvert/_version.py index c32151a3b..3e0449251 100644 --- a/nbconvert/_version.py +++ b/nbconvert/_version.py @@ -1,87 +1,7 @@ -# import pep440 # cannot be imported as described below +from nbconvert._version_tools import create_valid_version version_info = (5, 2, 0) pre_info = '' dev_info = '.dev' __version__ = create_valid_version(version_info, pre_input=pre_info, dev_input=dev_info) -def create_valid_version(release_info, epoch=None, pre_input='', dev_input=''): - ''' - Creates a pep440 valid version of version number given a tuple integers - and optional epoch, prerelease and developmental info. - - Parameters - ---------- - release_info : Tuple(Int) - epoch : Int, default None - pre_input : Str, default '' - dev_input : Str, default '' - ''' - - pep440_err = "The version number is not a pep 440 compliant version number" - - - if epoch is not None: - epoch_seg = str(epoch) + '!' - else: - epoch_seg = '' - - release_seg = '.'.join(map(str, release_info)) - - _magic_pre = ['a','b','rc'] - if pre_input!='' and not any([pre_input.startswith(prefix) for prefix in _magic_pre]): - raise ValueError(pep440_err + "\n please fix your prerelease segment.") - else: - pre_seg = pre_input - - if dev_input=='': - dev_seg = dev_input - elif not dev_input.startswith('.') and dev_input.startswith('dev'): - dev_seg = ''.join(['.', dev_input]) - elif dev_input.startswith('.dev'): - dev_seg = dev_input - elif dev_input!='': - raise ValueError(pep440_err + "\n please fix your development segment.") - - if dev_input!='' and not any([dev_seg.endswith(str(n)) for n in range(10)]): - dev_seg = ''.join([dev_seg,'0']) - - out_version = ''.join([epoch_seg, release_seg, pre_seg, dev_seg]) - - if is_canonical(out_version): - return out_version - else: - raise ValueError(pep440_err) - -# This has been ported directly from the pep440 package since it cannot be -# installed as part of a setuptools based install without using pyproject.toml - -posint = '(0|[1-9]\d*)' - -# 0!0.0.0rc0.post0.dev0 - -tpl_string_re = ('^' # Start - '([1-9]\d*!)?' # [N!] - '{posint}' # N - '(\.{posint})*' # (.N)* - '((a|b|rc){posint})?' # [{a|b|rc}N] - '(\.post{posint})?' # [.postN] - '(\.dev{postdev})?' # [.devN] - '$') -string_re = tpl_string_re.format(posint=posint, postdev=posint) -loose440re = re.compile(tpl_string_re.format(posint=posint, postdev=(posint+'?'))) -pep440re = re.compile(string_re) - -def is_canonical(version, loosedev=False): - """ - Return whether or not the version string is canonical according to Pep 440 - """ - if loosedev: - return loose440re.match(version) is not None - return pep440re.match(version) is not None - - -# this is the end of the direct port from pep440 - - - diff --git a/nbconvert/_version_tools.py b/nbconvert/_version_tools.py new file mode 100644 index 000000000..a98461ee1 --- /dev/null +++ b/nbconvert/_version_tools.py @@ -0,0 +1,83 @@ +# import pep440 # cannot be imported as described below +import re + +def create_valid_version(release_info, epoch=None, pre_input='', dev_input=''): + ''' + Creates a pep440 valid version of version number given a tuple integers + and optional epoch, prerelease and developmental info. + + Parameters + ---------- + release_info : Tuple(Int) + epoch : Int, default None + pre_input : Str, default '' + dev_input : Str, default '' + ''' + + pep440_err = "The version number is not a pep 440 compliant version number" + + + if epoch is not None: + epoch_seg = str(epoch) + '!' + else: + epoch_seg = '' + + release_seg = '.'.join(map(str, release_info)) + + _magic_pre = ['a','b','rc'] + if pre_input!='' and not any([pre_input.startswith(prefix) for prefix in _magic_pre]): + raise ValueError(pep440_err + "\n please fix your prerelease segment.") + else: + pre_seg = pre_input + + if dev_input=='': + dev_seg = dev_input + elif not dev_input.startswith('.') and dev_input.startswith('dev'): + dev_seg = ''.join(['.', dev_input]) + elif dev_input.startswith('.dev'): + dev_seg = dev_input + elif dev_input!='': + raise ValueError(pep440_err + "\n please fix your development segment.") + + if dev_input!='' and not any([dev_seg.endswith(str(n)) for n in range(10)]): + dev_seg = ''.join([dev_seg,'0']) + + out_version = ''.join([epoch_seg, release_seg, pre_seg, dev_seg]) + + if is_canonical(out_version): + return out_version + else: + raise ValueError(pep440_err) + +# This has been ported directly from the pep440 package since it cannot be +# installed as part of a setuptools based install without using pyproject.toml + +posint = '(0|[1-9]\d*)' + +# 0!0.0.0rc0.post0.dev0 + +tpl_string_re = ('^' # Start + '([1-9]\d*!)?' # [N!] + '{posint}' # N + '(\.{posint})*' # (.N)* + '((a|b|rc){posint})?' # [{a|b|rc}N] + '(\.post{posint})?' # [.postN] + '(\.dev{postdev})?' # [.devN] + '$') +string_re = tpl_string_re.format(posint=posint, postdev=posint) +loose440re = re.compile(tpl_string_re.format(posint=posint, postdev=(posint+'?'))) +pep440re = re.compile(string_re) + +def is_canonical(version, loosedev=False): + """ + Return whether or not the version string is canonical according to Pep 440 + """ + if loosedev: + return loose440re.match(version) is not None + return pep440re.match(version) is not None + + +# this is the end of the direct port from pep440 + + + From b3193e422417a2165a95f333932ea7a3452d8652 Mon Sep 17 00:00:00 2001 From: mpacer Date: Wed, 24 May 2017 09:10:05 -0700 Subject: [PATCH 08/14] move functions back into _version.py, explicitly cite pep440's GitHub --- nbconvert/_version.py | 86 ++++++++++++++++++++++++++++++++++++- nbconvert/_version_tools.py | 83 ----------------------------------- 2 files changed, 84 insertions(+), 85 deletions(-) delete mode 100644 nbconvert/_version_tools.py diff --git a/nbconvert/_version.py b/nbconvert/_version.py index 3e0449251..0d7894b4b 100644 --- a/nbconvert/_version.py +++ b/nbconvert/_version.py @@ -1,7 +1,89 @@ -from nbconvert._version_tools import create_valid_version +# import pep440 # replace once the import issue is resolved, origin https://github.com/Carreau/pep440 +import re version_info = (5, 2, 0) pre_info = '' dev_info = '.dev' -__version__ = create_valid_version(version_info, pre_input=pre_info, dev_input=dev_info) +def create_valid_version(release_info, epoch=None, pre_input='', dev_input=''): + ''' + Creates a pep440 valid version of version number given a tuple integers + and optional epoch, prerelease and developmental info. + + Parameters + ---------- + release_info : Tuple(Int) + epoch : Int, default None + pre_input : Str, default '' + dev_input : Str, default '' + ''' + + pep440_err = "The version number is not a pep 440 compliant version number" + + + if epoch is not None: + epoch_seg = str(epoch) + '!' + else: + epoch_seg = '' + + release_seg = '.'.join(map(str, release_info)) + + _magic_pre = ['a','b','rc'] + if pre_input!='' and not any([pre_input.startswith(prefix) for prefix in _magic_pre]): + raise ValueError(pep440_err + "\n please fix your prerelease segment.") + else: + pre_seg = pre_input + + if dev_input=='': + dev_seg = dev_input + elif not dev_input.startswith('.') and dev_input.startswith('dev'): + dev_seg = ''.join(['.', dev_input]) + elif dev_input.startswith('.dev'): + dev_seg = dev_input + elif dev_input!='': + raise ValueError(pep440_err + "\n please fix your development segment.") + + if dev_input!='' and not any([dev_seg.endswith(str(n)) for n in range(10)]): + dev_seg = ''.join([dev_seg,'0']) + + out_version = ''.join([epoch_seg, release_seg, pre_seg, dev_seg]) + + if is_canonical(out_version): + return out_version + else: + raise ValueError(pep440_err) + +# This has been ported directly from the pep440 package since it cannot be +# installed as part of a setuptools based install without using pyproject.toml +# You can find the source at +# https://github.com/Carreau/pep440/blob/b2b8daf90522f368446d8da0cce2701459f86929/pep440/__init__.py +# It is licensed with an MIT license, Copyright (c) 2015 Matthias Bussonnier +# When you can, just use pep440 + +posint = '(0|[1-9]\d*)' + + +tpl_string_re = ('^' # Start + '([1-9]\d*!)?' # [N!] + '{posint}' # N + '(\.{posint})*' # (.N)* + '((a|b|rc){posint})?' # [{a|b|rc}N] + '(\.post{posint})?' # [.postN] + '(\.dev{postdev})?' # [.devN] + '$') +string_re = tpl_string_re.format(posint=posint, postdev=posint) +loose440re = re.compile(tpl_string_re.format(posint=posint, postdev=(posint+'?'))) +pep440re = re.compile(string_re) + +def is_canonical(version, loosedev=False): + """ + Return whether or not the version string is canonical according to Pep 440 + """ + if loosedev: + return loose440re.match(version) is not None + return pep440re.match(version) is not None + + +# this is the end of the direct port from pep440 + +__version__ = create_valid_version(version_info, pre_input=pre_info, dev_input=dev_info) diff --git a/nbconvert/_version_tools.py b/nbconvert/_version_tools.py deleted file mode 100644 index a98461ee1..000000000 --- a/nbconvert/_version_tools.py +++ /dev/null @@ -1,83 +0,0 @@ -# import pep440 # cannot be imported as described below -import re - -def create_valid_version(release_info, epoch=None, pre_input='', dev_input=''): - ''' - Creates a pep440 valid version of version number given a tuple integers - and optional epoch, prerelease and developmental info. - - Parameters - ---------- - release_info : Tuple(Int) - epoch : Int, default None - pre_input : Str, default '' - dev_input : Str, default '' - ''' - - pep440_err = "The version number is not a pep 440 compliant version number" - - - if epoch is not None: - epoch_seg = str(epoch) + '!' - else: - epoch_seg = '' - - release_seg = '.'.join(map(str, release_info)) - - _magic_pre = ['a','b','rc'] - if pre_input!='' and not any([pre_input.startswith(prefix) for prefix in _magic_pre]): - raise ValueError(pep440_err + "\n please fix your prerelease segment.") - else: - pre_seg = pre_input - - if dev_input=='': - dev_seg = dev_input - elif not dev_input.startswith('.') and dev_input.startswith('dev'): - dev_seg = ''.join(['.', dev_input]) - elif dev_input.startswith('.dev'): - dev_seg = dev_input - elif dev_input!='': - raise ValueError(pep440_err + "\n please fix your development segment.") - - if dev_input!='' and not any([dev_seg.endswith(str(n)) for n in range(10)]): - dev_seg = ''.join([dev_seg,'0']) - - out_version = ''.join([epoch_seg, release_seg, pre_seg, dev_seg]) - - if is_canonical(out_version): - return out_version - else: - raise ValueError(pep440_err) - -# This has been ported directly from the pep440 package since it cannot be -# installed as part of a setuptools based install without using pyproject.toml - -posint = '(0|[1-9]\d*)' - -# 0!0.0.0rc0.post0.dev0 - -tpl_string_re = ('^' # Start - '([1-9]\d*!)?' # [N!] - '{posint}' # N - '(\.{posint})*' # (.N)* - '((a|b|rc){posint})?' # [{a|b|rc}N] - '(\.post{posint})?' # [.postN] - '(\.dev{postdev})?' # [.devN] - '$') -string_re = tpl_string_re.format(posint=posint, postdev=posint) -loose440re = re.compile(tpl_string_re.format(posint=posint, postdev=(posint+'?'))) -pep440re = re.compile(string_re) - -def is_canonical(version, loosedev=False): - """ - Return whether or not the version string is canonical according to Pep 440 - """ - if loosedev: - return loose440re.match(version) is not None - return pep440re.match(version) is not None - - -# this is the end of the direct port from pep440 - - - From a7625284fdf8e6c1e4484e7a74b909e57a1d9405 Mon Sep 17 00:00:00 2001 From: mpacer Date: Wed, 24 May 2017 09:39:13 -0700 Subject: [PATCH 09/14] improve docs per suggestions --- docs/source/changelog.rst | 2 ++ docs/source/development_release.rst | 17 +++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index f7f4109a0..2112d400c 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -1,3 +1,5 @@ +.. _changelog: + Changes in nbconvert ==================== diff --git a/docs/source/development_release.rst b/docs/source/development_release.rst index 8224b05bf..ac395042a 100644 --- a/docs/source/development_release.rst +++ b/docs/source/development_release.rst @@ -9,8 +9,11 @@ This document guides a contributor through creating a release of ``nbconvert``. Assign all merged PRs to milestones ----------------------------------- -Go to GitHub and assign all PRs that have been merged to milestones. -This will be helpful when you update the changelog. +Go to GitHub and assign all PRs that have been merged to milestones. This will +be helpful when you update the changelog. If you go to this `GitHub page `_ you will find all the PRs that currently have no milestones. + +.. _GitHub no milestones: https://github.com/jupyter/nbconvert/pulls?utf8=%E2%9C%93&q=is%3Amerged%20is%3Apr%20no%3Amilestone%20` Check installed tools --------------------- @@ -34,7 +37,7 @@ previous attempts. Create the release ------------------ -#. Update the changelog to account for all the PRs assigned to this milestone. +#. Update the :doc:`changelog ` to account for all the PRs assigned to this milestone. #. Update version number in ``notebook/_version.py``. @@ -63,18 +66,16 @@ Create the release Release the new version ----------------------- -#. Push directly on master, including --tags separately +Push directly on master, including --tags separately .. code:: bash git push upstream git push upstream --tags -#. Push tages on master forgetting to push ``--tags`` too. - Return to development state --------------------------- -#. If all went well, change the ``notebook/_version.py`` back adding the - ``.dev`` suffix. \ No newline at end of file +If all went well, change the ``notebook/_version.py`` back adding the + ``.dev`` suffix. From ab3715e865180ba3073ecb3d5ec43168ee5cc757 Mon Sep 17 00:00:00 2001 From: mpacer Date: Wed, 24 May 2017 09:44:01 -0700 Subject: [PATCH 10/14] ok apparently it needs to be entirely within the function to work. I'm extremely confused. --- nbconvert/_version.py | 70 +++++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 33 deletions(-) diff --git a/nbconvert/_version.py b/nbconvert/_version.py index 0d7894b4b..0551b4cca 100644 --- a/nbconvert/_version.py +++ b/nbconvert/_version.py @@ -1,5 +1,5 @@ # import pep440 # replace once the import issue is resolved, origin https://github.com/Carreau/pep440 -import re + version_info = (5, 2, 0) pre_info = '' @@ -48,42 +48,46 @@ def create_valid_version(release_info, epoch=None, pre_input='', dev_input=''): out_version = ''.join([epoch_seg, release_seg, pre_seg, dev_seg]) + # This has been ported directly from the pep440 package since it cannot be + # installed as part of a setuptools based install without using pyproject.toml + # You can find the source at + # https://github.com/Carreau/pep440/blob/b2b8daf90522f368446d8da0cce2701459f86929/pep440/__init__.py + # It is licensed with an MIT license, Copyright (c) 2015 Matthias Bussonnier + # When you can, just use pep440 + + import re + + posint = '(0|[1-9]\d*)' + + + tpl_string_re = ('^' # Start + '([1-9]\d*!)?' # [N!] + '{posint}' # N + '(\.{posint})*' # (.N)* + '((a|b|rc){posint})?' # [{a|b|rc}N] + '(\.post{posint})?' # [.postN] + '(\.dev{postdev})?' # [.devN] + '$') + string_re = tpl_string_re.format(posint=posint, postdev=posint) + loose440re = re.compile(tpl_string_re.format(posint=posint, postdev=(posint+'?'))) + pep440re = re.compile(string_re) + + def is_canonical(version, loosedev=False): + """ + Return whether or not the version string is canonical according to Pep 440 + """ + if loosedev: + return loose440re.match(version) is not None + return pep440re.match(version) is not None + + +# this is the end of the direct port from pep440 + + if is_canonical(out_version): return out_version else: raise ValueError(pep440_err) -# This has been ported directly from the pep440 package since it cannot be -# installed as part of a setuptools based install without using pyproject.toml -# You can find the source at -# https://github.com/Carreau/pep440/blob/b2b8daf90522f368446d8da0cce2701459f86929/pep440/__init__.py -# It is licensed with an MIT license, Copyright (c) 2015 Matthias Bussonnier -# When you can, just use pep440 - -posint = '(0|[1-9]\d*)' - - -tpl_string_re = ('^' # Start - '([1-9]\d*!)?' # [N!] - '{posint}' # N - '(\.{posint})*' # (.N)* - '((a|b|rc){posint})?' # [{a|b|rc}N] - '(\.post{posint})?' # [.postN] - '(\.dev{postdev})?' # [.devN] - '$') -string_re = tpl_string_re.format(posint=posint, postdev=posint) -loose440re = re.compile(tpl_string_re.format(posint=posint, postdev=(posint+'?'))) -pep440re = re.compile(string_re) - -def is_canonical(version, loosedev=False): - """ - Return whether or not the version string is canonical according to Pep 440 - """ - if loosedev: - return loose440re.match(version) is not None - return pep440re.match(version) is not None - - -# this is the end of the direct port from pep440 __version__ = create_valid_version(version_info, pre_input=pre_info, dev_input=dev_info) From 601174c3a5fe61e96edaec5db52dbf1c27567b0c Mon Sep 17 00:00:00 2001 From: mpacer Date: Wed, 24 May 2017 09:46:39 -0700 Subject: [PATCH 11/14] add nicer way of specifying extra_requirements --- setup.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/setup.py b/setup.py index 093c7371e..94857aba5 100644 --- a/setup.py +++ b/setup.py @@ -204,13 +204,8 @@ def run(self): 'serve': ['tornado>=4.0'], 'execute': ['jupyter_client>=4.2'], } -s = [] -[s.extend(values) for values in extra_requirements.values()] -extra_requirements['all'] = list(set(s)) - -extras_require = setuptools_args['extras_require'] = { - **extra_requirements -} +extra_requirements['all'] = sum(extra_requirements.values(), []) +extras_require = setuptools_args['extras_require'] = extra_requirements if 'setuptools' in sys.modules: from setuptools.command.develop import develop From 45f44ce4ae4e8221ec56bb541fa1272102c740df Mon Sep 17 00:00:00 2001 From: mpacer Date: Wed, 24 May 2017 11:09:12 -0700 Subject: [PATCH 12/14] remove unnecessary extras_require --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 94857aba5..93f861993 100644 --- a/setup.py +++ b/setup.py @@ -205,7 +205,7 @@ def run(self): 'execute': ['jupyter_client>=4.2'], } extra_requirements['all'] = sum(extra_requirements.values(), []) -extras_require = setuptools_args['extras_require'] = extra_requirements +setuptools_args['extras_require'] = extra_requirements if 'setuptools' in sys.modules: from setuptools.command.develop import develop From 911065c4c67b76ad047e6f222e104f5dbc982921 Mon Sep 17 00:00:00 2001 From: mpacer Date: Wed, 24 May 2017 13:50:54 -0700 Subject: [PATCH 13/14] used appendix B from pep440 --- nbconvert/_version.py | 46 ++++++++----------------------------------- 1 file changed, 8 insertions(+), 38 deletions(-) diff --git a/nbconvert/_version.py b/nbconvert/_version.py index 0551b4cca..9089715bb 100644 --- a/nbconvert/_version.py +++ b/nbconvert/_version.py @@ -1,6 +1,3 @@ -# import pep440 # replace once the import issue is resolved, origin https://github.com/Carreau/pep440 - - version_info = (5, 2, 0) pre_info = '' dev_info = '.dev' @@ -48,42 +45,15 @@ def create_valid_version(release_info, epoch=None, pre_input='', dev_input=''): out_version = ''.join([epoch_seg, release_seg, pre_seg, dev_seg]) - # This has been ported directly from the pep440 package since it cannot be - # installed as part of a setuptools based install without using pyproject.toml - # You can find the source at - # https://github.com/Carreau/pep440/blob/b2b8daf90522f368446d8da0cce2701459f86929/pep440/__init__.py - # It is licensed with an MIT license, Copyright (c) 2015 Matthias Bussonnier - # When you can, just use pep440 - - import re - - posint = '(0|[1-9]\d*)' - - - tpl_string_re = ('^' # Start - '([1-9]\d*!)?' # [N!] - '{posint}' # N - '(\.{posint})*' # (.N)* - '((a|b|rc){posint})?' # [{a|b|rc}N] - '(\.post{posint})?' # [.postN] - '(\.dev{postdev})?' # [.devN] - '$') - string_re = tpl_string_re.format(posint=posint, postdev=posint) - loose440re = re.compile(tpl_string_re.format(posint=posint, postdev=(posint+'?'))) - pep440re = re.compile(string_re) - - def is_canonical(version, loosedev=False): - """ - Return whether or not the version string is canonical according to Pep 440 - """ - if loosedev: - return loose440re.match(version) is not None - return pep440re.match(version) is not None - - -# this is the end of the direct port from pep440 - + import re + def is_canonical(version): + return re.match(r'^([1-9]\d*!)?(0|[1-9]\d*)' + r'(\.(0|[1-9]\d*))*((a|b|rc)(0|[1-9]\d*))?' + r'(\.post(0|[1-9]\d*))?(\.dev(0|[1-9]\d*))?$', + version + ) is not None + if is_canonical(out_version): return out_version else: From fa4959a55f8c4aa89d451186471cc1f83dd0826d Mon Sep 17 00:00:00 2001 From: mpacer Date: Wed, 24 May 2017 13:56:59 -0700 Subject: [PATCH 14/14] fix backtick in link --- docs/source/development_release.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/development_release.rst b/docs/source/development_release.rst index ac395042a..838069942 100644 --- a/docs/source/development_release.rst +++ b/docs/source/development_release.rst @@ -13,7 +13,7 @@ Go to GitHub and assign all PRs that have been merged to milestones. This will be helpful when you update the changelog. If you go to this `GitHub page `_ you will find all the PRs that currently have no milestones. -.. _GitHub no milestones: https://github.com/jupyter/nbconvert/pulls?utf8=%E2%9C%93&q=is%3Amerged%20is%3Apr%20no%3Amilestone%20` +.. _GitHub no milestones: https://github.com/jupyter/nbconvert/pulls?utf8=%E2%9C%93&q=is%3Amerged%20is%3Apr%20no%3Amilestone%20 Check installed tools ---------------------