Skip to content

Commit 04d4217

Browse files
committed
Update packaging to use setup.cfg
1 parent 3108308 commit 04d4217

File tree

5 files changed

+67
-126
lines changed

5 files changed

+67
-126
lines changed

ipywidgets/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@
1717
accessible as a `value` attribute.
1818
"""
1919

20-
import os
20+
# Must import __version__ first to avoid errors importing this file during the build process. See https://github.com/pypa/setuptools/issues/1724#issuecomment-627241822
21+
from ._version import __version__, __protocol_version__, __jupyter_widgets_controls_version__, __jupyter_widgets_base_version__
2122

23+
import os
2224
from IPython import get_ipython
23-
from ._version import version_info, __version__, __protocol_version__, __jupyter_widgets_controls_version__, __jupyter_widgets_base_version__
2425
from .widgets import *
2526
from traitlets import link, dlink
2627

ipywidgets/_version.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
# Copyright (c) Jupyter Development Team.
22
# Distributed under the terms of the Modified BSD License.
33

4-
5-
version_info = (8, 0, 0, 'alpha', 3)
6-
7-
_specifier_ = {'alpha': 'a', 'beta': 'b', 'candidate': 'rc', 'final': ''}
8-
9-
__version__ = '%s.%s.%s%s'%(version_info[0], version_info[1], version_info[2],
10-
'' if version_info[3]=='final' else _specifier_[version_info[3]]+str(version_info[4]))
4+
__version__ = '8.0.0a3'
115

126
__protocol_version__ = '2.0.0'
137

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[build-system]
2+
# These are the assumed default build requirements from pip:
3+
# https://pip.pypa.io/en/stable/reference/pip/#pep-517-and-518-support
4+
requires = ["setuptools>=40.8.0", "wheel"]
5+
build-backend = "setuptools.build_meta"

setup.cfg

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,57 @@
11
[metadata]
2+
name = ipywidgets
3+
version = attr: ipywidgets._version.__version__
4+
author = Jupyter Development Team
5+
author_email = [email protected]
26
license_file = LICENSE
7+
description = Jupyter interactive widgets
8+
long_description = file: README.md
9+
long_description_content_type = text/markdown
10+
url = http://jupyter.org
11+
keywords = Interactive, Interpreter, Shell, Web, ipython, widgets, Jupyter
12+
platforms = Linux, Mac OS X, Windows
13+
license = BSD 3-Clause License
14+
classifiers =
15+
Intended Audience :: Developers
16+
Intended Audience :: System Administrators
17+
Intended Audience :: Science/Research
18+
License :: OSI Approved :: BSD License
19+
Programming Language :: Python
20+
Programming Language :: Python :: 3
21+
Programming Language :: Python :: 3.6
22+
Programming Language :: Python :: 3.7
23+
Programming Language :: Python :: 3.8
24+
Programming Language :: Python :: 3.9
25+
Programming Language :: Python :: 3 :: Only
26+
Framework :: Jupyter
27+
28+
[options]
29+
python_requires = >=3.6
30+
31+
zip_safe = False
32+
# include_package_data = True
33+
packages = find:
34+
35+
# Requiring nbformat to specify bugfix version which is not required by
36+
# notebook - perhaps not needed anymore?
37+
install_requires =
38+
ipykernel>=4.5.1
39+
ipython>=6.1.0
40+
traitlets>=4.3.1
41+
nbformat>=4.2.0
42+
widgetsnbextension~=4.0a0
43+
jupyterlab_widgets~=2.0a0
44+
45+
[options.extras_require]
46+
test =
47+
pytest>=3.6.0
48+
pytest-cov
49+
50+
[options.package_data]
51+
ipywidgets =
52+
state.schema.json
53+
view.schema.json
54+
55+
# Test data needs to be packaged until tests are moved out of module
56+
ipywidgets.widgets.tests =
57+
data/jupyter-logo-transparent.png

setup.py

Lines changed: 3 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -1,122 +1,8 @@
11
#!/usr/bin/env python
22

3-
# Copyright (c) IPython Development Team.
3+
# Copyright (c) Jupyter Development Team.
44
# Distributed under the terms of the Modified BSD License.
55

6-
# the name of the package
7-
name = 'ipywidgets'
8-
9-
LONG_DESCRIPTION = """
10-
.. image:: https://img.shields.io/pypi/v/ipywidgets.svg
11-
:target: https://pypi.python.org/pypi/ipywidgets/
12-
:alt: Version Number
13-
14-
.. image:: https://img.shields.io/pypi/dm/ipywidgets.svg
15-
:target: https://pypi.python.org/pypi/ipywidgets/
16-
:alt: Number of PyPI downloads
17-
18-
Interactive HTML Widgets
19-
========================
20-
21-
Interactive HTML widgets for Jupyter notebooks and the IPython kernel.
22-
23-
Usage
24-
=====
25-
26-
.. code-block:: python
27-
28-
from ipywidgets import IntSlider
29-
IntSlider()
30-
"""
31-
32-
#-----------------------------------------------------------------------------
33-
# get on with it
34-
#-----------------------------------------------------------------------------
35-
36-
import sys
37-
import os
38-
from distutils.core import setup
39-
from distutils.command.build_py import build_py
40-
from distutils.command.sdist import sdist
41-
from os.path import join as pjoin
42-
43-
pjoin = os.path.join
44-
here = os.path.abspath(os.path.dirname(__file__))
45-
46-
packages = []
47-
for d, _, _ in os.walk(pjoin(here, name)):
48-
if os.path.exists(pjoin(d, '__init__.py')):
49-
packages.append(d[len(here)+1:].replace(os.path.sep, '.'))
50-
51-
version_ns = {}
52-
with open(pjoin(here, name, '_version.py')) as f:
53-
exec(f.read(), {}, version_ns)
54-
55-
56-
setup_args = dict(
57-
name = name,
58-
version = version_ns['__version__'],
59-
scripts = [],
60-
packages = packages,
61-
package_data = {
62-
'ipywidgets': [ 'state.schema.json', 'view.schema.json' ],
63-
# Test data needs to be packaged until tests are moved out of module
64-
'ipywidgets.widgets.tests': ['data/jupyter-logo-transparent.png']
65-
},
66-
description = "Jupyter interactive widgets",
67-
long_description = LONG_DESCRIPTION,
68-
author = 'Jupyter Development Team',
69-
author_email = '[email protected]',
70-
url = 'http://jupyter.org',
71-
license = 'BSD',
72-
platforms = "Linux, Mac OS X, Windows",
73-
keywords = ['Interactive', 'Interpreter', 'Shell', 'Web'],
74-
classifiers = [
75-
'Intended Audience :: Developers',
76-
'Intended Audience :: System Administrators',
77-
'Intended Audience :: Science/Research',
78-
'License :: OSI Approved :: BSD License',
79-
'Programming Language :: Python',
80-
'Programming Language :: Python :: 3',
81-
'Programming Language :: Python :: 3.6',
82-
'Programming Language :: Python :: 3.7',
83-
'Programming Language :: Python :: 3.8',
84-
'Programming Language :: Python :: 3.9',
85-
'Programming Language :: Python :: 3 :: Only',
86-
'Framework :: Jupyter'
87-
],
88-
cmdclass = {
89-
'build_py': build_py,
90-
'sdist': sdist,
91-
},
92-
python_requires = '>=3.6',
93-
)
94-
95-
if 'develop' in sys.argv or any(a.startswith('bdist') for a in sys.argv):
96-
import setuptools
97-
98-
setuptools_args = {}
99-
install_requires = setuptools_args['install_requires'] = [
100-
'ipykernel>=4.5.1',
101-
'ipython>=6.1.0', # to use _repr_mimebundle
102-
'traitlets>=4.3.1',
103-
# Requiring nbformat to specify bugfix version which is not required by
104-
# notebook.
105-
'nbformat>=4.2.0',
106-
# TODO: Dynamically add this dependency
107-
# only if notebook 4.x is installed in this
108-
# interpreter, to allow ipywidgets to be
109-
# installed on bare kernels.
110-
'widgetsnbextension~=4.0a0',
111-
'jupyterlab_widgets~=2.0a0'
112-
]
113-
114-
extras_require = setuptools_args['extras_require'] = {
115-
'test': ['pytest>=3.6.0', 'pytest-cov'],
116-
}
117-
118-
if 'setuptools' in sys.modules:
119-
setup_args.update(setuptools_args)
120-
6+
from setuptools import setup
1217
if __name__ == '__main__':
122-
setup(**setup_args)
8+
setup()

0 commit comments

Comments
 (0)