Skip to content

Commit a6d4719

Browse files
authored
Merge pull request #5 from vidartf/fixes
Fixes and cleanup
2 parents 7d71eee + 7ddd371 commit a6d4719

File tree

4 files changed

+52
-47
lines changed

4 files changed

+52
-47
lines changed

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
# opinionated-widget-cookiecutter
1+
# widget-ts-cookiecutter
2+
23
#### A cookiecutter template for creating a custom Jupyter widget project
34

45
A [cookiecutter](https://github.com/audreyr/cookiecutter) template for a custom
56
Jupyter widget project.
67

7-
## What is widget-cookiecutter?
8+
## What is widget-ts-cookiecutter?
89

9-
With **widget-cookiecutter** you can create a custom Jupyter interactive
10-
widget project with sensible defaults. widget-cookiecutter helps custom widget
10+
With **widget-ts-cookiecutter** you can create a custom Jupyter interactive
11+
widget project with sensible defaults. widget-ts-cookiecutter helps custom widget
1112
authors get started with best practices for the packaging and distribution
1213
of a custom Jupyter interactive widget library.
1314

@@ -17,11 +18,11 @@ Install [cookiecutter](https://github.com/audreyr/cookiecutter):
1718

1819
$ pip install cookiecutter
1920

20-
After installing cookiecutter, use the widget-cookiecutter:
21+
After installing cookiecutter, use widget-ts-cookiecutter:
2122

22-
$ cookiecutter https://github.com/vidartf/opinionated-widget-cookiecutter.git
23+
$ cookiecutter https://github.com/jupyter-widgets/widget-ts-cookiecutter.git
2324

24-
As widget-cookiecutter runs, you will be asked for basic information about
25+
As widget-ts-cookiecutter runs, you will be asked for basic information about
2526
your custom Jupyter widget project. You will be prompted for the following
2627
information:
2728

{{cookiecutter.github_project_name}}/LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 3-Clause License
22

3-
Copyright (c) 2017, {{ cookiecutter.author_name }}
3+
Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.author_name }}
44
All rights reserved.
55

66
Redistribution and use in source and binary forms, with or without

{{cookiecutter.github_project_name}}/setup.py

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@
77
from __future__ import print_function
88
from glob import glob
99
from os.path import join as pjoin
10-
import sys
10+
1111

1212
from setupbase import (
1313
create_cmdclass, install_npm, ensure_targets,
1414
find_packages, combine_commands, ensure_python,
15-
get_version, setup, HERE
15+
get_version, HERE
1616
)
1717

18+
from setuptools import setup
19+
1820

1921
# The name of the project
2022
name = '{{ cookiecutter.python_package_name }}'
@@ -80,33 +82,23 @@
8082
'Programming Language :: Python :: 3.6',
8183
'Framework :: Jupyter',
8284
],
83-
)
84-
85-
86-
setuptools_args = dict(include_package_data=True)
87-
install_requires = setuptools_args['install_requires'] = [
88-
'ipywidgets>=7.0.0',
89-
]
90-
91-
extras_require = setuptools_args['extras_require'] = {
92-
'test': [
93-
'pytest',
94-
'pytest-cov',
95-
'nbval',
85+
include_package_data = True,
86+
install_requires = [
87+
'ipywidgets>=7.0.0',
9688
],
97-
'docs': [
98-
'sphinx',
99-
'recommonmark',
100-
'sphinx_rtd_theme'
101-
],
102-
}
103-
104-
if 'setuptools' in sys.modules:
105-
setup_args.update(setuptools_args)
106-
107-
setup_args.pop('scripts', None)
108-
109-
setup_args.update(setuptools_args)
89+
extras_require = {
90+
'test': [
91+
'pytest',
92+
'pytest-cov',
93+
'nbval',
94+
],
95+
'examples': [
96+
# Any requirements for the examples to run
97+
],
98+
},
99+
entry_points = {
100+
},
101+
)
110102

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

{{cookiecutter.github_project_name}}/setupbase.py

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,14 @@
2525
if os.path.exists('MANIFEST'): os.remove('MANIFEST')
2626

2727

28-
from distutils.core import setup
2928
from distutils.cmd import Command
3029
from distutils.command.build_py import build_py
3130
from distutils.command.sdist import sdist
32-
from distutils.dist import Distribution
3331
from distutils import log
3432

33+
from setuptools.command.develop import develop
34+
from setuptools.command.bdist_egg import bdist_egg
35+
3536
try:
3637
from wheel.bdist_wheel import bdist_wheel
3738
except ImportError:
@@ -69,11 +70,6 @@ def list2cmdline(cmd_list):
6970
skip_npm = False
7071

7172

72-
# For some commands, use setuptools. Note that we do NOT list install here!
73-
if 'develop' in sys.argv or any(a.startswith('bdist') for a in sys.argv):
74-
import setuptools
75-
76-
7773
# ---------------------------------------------------------------------------
7874
# Public Functions
7975
# ---------------------------------------------------------------------------
@@ -127,6 +123,17 @@ def update_package_data(distribution):
127123
build_py.finalize_options()
128124

129125

126+
class bdist_egg_disabled(bdist_egg):
127+
"""Disabled version of bdist_egg
128+
129+
Prevents setup.py install performing setuptools' default easy_install,
130+
which it should never ever do.
131+
"""
132+
def run(self):
133+
sys.exit("Aborting implicit building of eggs. Use `pip install .` "
134+
" to install from source.")
135+
136+
130137
def create_cmdclass(prerelease_cmd=None, package_data_spec=None,
131138
data_files_spec=None):
132139
"""Create a command class with the given optional prerelease class.
@@ -162,18 +169,22 @@ def create_cmdclass(prerelease_cmd=None, package_data_spec=None,
162169
wrapper = functools.partial(_wrap_command, wrapped)
163170
handle_files = _get_file_handler(package_data_spec, data_files_spec)
164171

172+
if 'bdist_egg' in sys.argv:
173+
egg = wrapper(bdist_egg, strict=True)
174+
else:
175+
egg = bdist_egg_disabled
176+
165177
cmdclass = dict(
166178
build_py=wrapper(build_py, strict=is_repo),
179+
bdist_egg=egg,
167180
sdist=wrapper(sdist, strict=True),
168-
handle_files=handle_files
181+
handle_files=handle_files,
169182
)
170183

171184
if bdist_wheel:
172185
cmdclass['bdist_wheel'] = wrapper(bdist_wheel, strict=True)
173186

174-
if 'develop' in sys.argv:
175-
from setuptools.command.develop import develop
176-
cmdclass['develop'] = wrapper(develop, strict=True)
187+
cmdclass['develop'] = wrapper(develop, strict=True)
177188
return cmdclass
178189

179190

@@ -231,6 +242,7 @@ def combine_commands(*commands):
231242
"""Return a Command that combines several commands."""
232243

233244
class CombinedCommand(Command):
245+
user_options = []
234246

235247
def initialize_options(self):
236248
self.commands = []

0 commit comments

Comments
 (0)