Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify setup.py #949

Merged
merged 3 commits into from
Feb 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ exclude codecov.yml

# Examples
graft examples
graft scripts

# docs subdirs we want to skip
prune docs/build
Expand Down
6 changes: 0 additions & 6 deletions scripts/jupyter-nbconvert

This file was deleted.

68 changes: 23 additions & 45 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,18 @@
#-----------------------------------------------------------------------------

import os
import setuptools
import io

from setuptools import setup
from setuptools.command.bdist_egg import bdist_egg
from setuptools.command.develop import develop

from glob import glob
from io import BytesIO
try:
from urllib.request import urlopen
except ImportError:
from urllib import urlopen

from distutils.core import setup
from distutils.cmd import Command
from distutils.command.build import build
from distutils.command.sdist import sdist
Expand Down Expand Up @@ -147,6 +146,7 @@ def run(self):

cmdclass['build'] = css_first(build)
cmdclass['sdist'] = css_first(sdist)
cmdclass['develop'] = css_first(develop)
cmdclass['bdist_egg'] = bdist_egg if 'bdist_egg' in sys.argv else bdist_egg_disabled

for d, _, _ in os.walk(pjoin(pkg_root, 'templates')):
Expand All @@ -160,25 +160,11 @@ def run(self):
with io.open(pjoin(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()

long_description="""

Nbconvert is a Command Line tool and Python library and API to process and
convert Jupyter notebook into a variety of other formats.

Using nbconvert enables:

- presentation of information in familiar formats, such as PDF.
- publishing of research using LaTeX and opens the door for embedding notebooks in papers.
- collaboration with others who may not use the notebook in their work.
- sharing contents with many people via the web using HTML.
"""

setup_args = dict(
name = name,
description = "Converting Jupyter Notebooks",
long_description_content_type = 'text/markdown',
version = version_ns['__version__'],
scripts = glob(pjoin('scripts', '*')),
packages = packages,
long_description= long_description,
package_data = package_data,
Expand Down Expand Up @@ -211,8 +197,7 @@ def run(self):
],
)

setuptools_args = {}
install_requires = setuptools_args['install_requires'] = [
setup_args['install_requires'] = [
'mistune>=0.8.1',
'jinja2',
'pygments',
Expand Down Expand Up @@ -241,32 +226,25 @@ def run(self):
}

extra_requirements['all'] = sum(extra_requirements.values(), [])
setuptools_args['extras_require'] = extra_requirements

if 'setuptools' in sys.modules:
from setuptools.command.develop import develop
cmdclass['develop'] = css_first(develop)
# force entrypoints with setuptools (needed for Windows, unconditional because of wheels)
setup_args['entry_points'] = {
'console_scripts': [
'jupyter-nbconvert = nbconvert.nbconvertapp:main',
],
"nbconvert.exporters" : [
'custom=nbconvert.exporters:TemplateExporter',
'html=nbconvert.exporters:HTMLExporter',
'slides=nbconvert.exporters:SlidesExporter',
'latex=nbconvert.exporters:LatexExporter',
'pdf=nbconvert.exporters:PDFExporter',
'markdown=nbconvert.exporters:MarkdownExporter',
'python=nbconvert.exporters:PythonExporter',
'rst=nbconvert.exporters:RSTExporter',
'notebook=nbconvert.exporters:NotebookExporter',
'asciidoc=nbconvert.exporters:ASCIIDocExporter',
'script=nbconvert.exporters:ScriptExporter']
}
setup_args.pop('scripts', None)

setup_args.update(setuptools_args)
setup_args['extras_require'] = extra_requirements

setup_args['entry_points'] = {
'console_scripts': [
'jupyter-nbconvert = nbconvert.nbconvertapp:main',
],
"nbconvert.exporters" : [
'custom=nbconvert.exporters:TemplateExporter',
'html=nbconvert.exporters:HTMLExporter',
'slides=nbconvert.exporters:SlidesExporter',
'latex=nbconvert.exporters:LatexExporter',
'pdf=nbconvert.exporters:PDFExporter',
'markdown=nbconvert.exporters:MarkdownExporter',
'python=nbconvert.exporters:PythonExporter',
'rst=nbconvert.exporters:RSTExporter',
'notebook=nbconvert.exporters:NotebookExporter',
'asciidoc=nbconvert.exporters:ASCIIDocExporter',
'script=nbconvert.exporters:ScriptExporter']
}

if __name__ == '__main__':
setup(**setup_args)