From 61c39847394ee4956fc9decbd9d3287f02698d8a Mon Sep 17 00:00:00 2001 From: Matthew Seal Date: Tue, 4 Sep 2018 12:36:26 -0700 Subject: [PATCH 1/2] Added long description to setuptools for new pypi page --- setup.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/setup.py b/setup.py index 1fe339d07..282f6e6f4 100644 --- a/setup.py +++ b/setup.py @@ -74,10 +74,10 @@ class FetchCSS(Command): user_options = [] def initialize_options(self): pass - + def finalize_options(self): pass - + def _download(self): try: return urlopen(css_url).read() @@ -92,7 +92,7 @@ def _download(self): print("Failed, trying again with PycURL to avoid outdated SSL.", file=sys.stderr) return self._download_pycurl() raise e - + def _download_pycurl(self): """Download CSS with pycurl, in case of old SSL (e.g. Python < 2.7.9).""" import pycurl @@ -102,7 +102,7 @@ def _download_pycurl(self): c.setopt(c.WRITEDATA, buf) c.perform() return buf.getvalue() - + def run(self): dest = os.path.join('nbconvert', 'resources', 'style.min.css') if not os.path.exists('.git') and os.path.exists(dest): @@ -119,7 +119,7 @@ def run(self): else: raise OSError("Need Notebook CSS to proceed: %s" % dest) return - + with open(dest, 'wb') as f: f.write(css) print("Downloaded Notebook CSS to %s" % dest) @@ -128,7 +128,7 @@ def run(self): class bdist_egg_disabled(bdist_egg): """Disabled version of bdist_egg - + Prevents setup.py install performing setuptools' default easy_install, which it should never ever do. """ @@ -156,10 +156,14 @@ def run(self): with open(pjoin(here, name, '_version.py')) as f: exec(f.read(), {}, version_ns) +with open(pjoin(here, 'README.md'), encoding='utf-8') as f: + long_description = f.read() setup_args = dict( name = name, description = "Converting Jupyter Notebooks", + long_description = long_description, + long_description_content_type = 'text/markdown', version = version_ns['__version__'], scripts = glob(pjoin('scripts', '*')), packages = packages, @@ -206,9 +210,9 @@ def run(self): 'test': ['pytest', 'pytest-cov', 'ipykernel', jupyter_client_req], 'serve': ['tornado>=4.0'], 'execute': [jupyter_client_req], - 'docs': ['sphinx>=1.5.1', + 'docs': ['sphinx>=1.5.1', 'sphinx_rtd_theme', - 'nbsphinx>=0.2.12', + 'nbsphinx>=0.2.12', 'sphinxcontrib_github_alt', 'ipython', jupyter_client_req, @@ -237,7 +241,7 @@ def run(self): 'rst=nbconvert.exporters:RSTExporter', 'notebook=nbconvert.exporters:NotebookExporter', 'asciidoc=nbconvert.exporters:ASCIIDocExporter', - 'script=nbconvert.exporters:ScriptExporter'] + 'script=nbconvert.exporters:ScriptExporter'] } setup_args.pop('scripts', None) From f64febd39b1b29a97b07d9028d5f7974fa739e0a Mon Sep 17 00:00:00 2001 From: M Pacer Date: Tue, 4 Sep 2018 12:58:13 -0700 Subject: [PATCH 2/2] add io import and use io.open for specifying py2/3 compat encoding --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 282f6e6f4..d10f8f938 100644 --- a/setup.py +++ b/setup.py @@ -29,6 +29,7 @@ import os import setuptools +import io from setuptools.command.bdist_egg import bdist_egg @@ -156,7 +157,7 @@ def run(self): with open(pjoin(here, name, '_version.py')) as f: exec(f.read(), {}, version_ns) -with open(pjoin(here, 'README.md'), encoding='utf-8') as f: +with io.open(pjoin(here, 'README.md'), encoding='utf-8') as f: long_description = f.read() setup_args = dict(