Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Commit 7c7b1e4

Browse files
committed
PyPI/NPM packaging prep
1 parent a270a65 commit 7c7b1e4

File tree

4 files changed

+112
-5
lines changed

4 files changed

+112
-5
lines changed

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include README.md LICENSE.txt

jupyterlab_dash/__version__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = '0.1.0a1'

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jupyterlab-dash",
3-
"version": "0.1.0",
3+
"version": "0.1.0.alpha.1",
44
"description": "A JupyterLab extensions for rendering Plotly Dash apps",
55
"keywords": [
66
"jupyter",

setup.py

Lines changed: 109 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,113 @@
1-
from setuptools import setup
1+
import io
2+
import os
3+
import sys
4+
from shutil import rmtree
5+
from setuptools import setup, Command
26

7+
# Initialized with template at https://github.com/kennethreitz/setup.py
8+
#
9+
# Package meta-data.
10+
NAME = 'jupyterlab-dash'
11+
DESCRIPTION = 'My short description for my project.'
12+
URL = 'https://github.com/plotly/jupyterlab-dash'
13+
AUTHOR = 'Plotly'
14+
REQUIRES_PYTHON = '>=3.5.0'
15+
VERSION = None # See jupyterlab_dash/__version__.py
16+
17+
# What packages are required for this module to be executed?
18+
REQUIRED = ['dash', 'jupyter-server-proxy']
19+
20+
# What packages are optional?
21+
EXTRAS = {
22+
# 'fancy feature': ['django'],
23+
}
24+
25+
here = os.path.abspath(os.path.dirname(__file__))
26+
27+
# Import the README and use it as the long-description.
28+
# Note: this will only work if 'README.md' is present in the
29+
# MANIFEST.in file!
30+
try:
31+
with io.open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
32+
long_description = '\n' + f.read()
33+
except FileNotFoundError:
34+
long_description = DESCRIPTION
35+
36+
# Load the package's __version__.py module as a dictionary.
37+
about = {}
38+
if not VERSION:
39+
project_slug = NAME.lower().replace("-", "_").replace(" ", "_")
40+
with open(os.path.join(here, project_slug, '__version__.py')) as f:
41+
exec(f.read(), about)
42+
else:
43+
about['__version__'] = VERSION
44+
45+
46+
class UploadCommand(Command):
47+
"""Support setup.py upload."""
48+
49+
description = 'Build and publish the package.'
50+
user_options = []
51+
52+
@staticmethod
53+
def status(s):
54+
"""Prints things in bold."""
55+
print('\033[1m{0}\033[0m'.format(s))
56+
57+
def initialize_options(self):
58+
pass
59+
60+
def finalize_options(self):
61+
pass
62+
63+
def run(self):
64+
try:
65+
self.status('Removing previous builds…')
66+
rmtree(os.path.join(here, 'dist'))
67+
except OSError:
68+
pass
69+
70+
self.status('Building Source and Wheel (universal) distribution…')
71+
os.system('{0} setup.py sdist bdist_wheel --universal'.format(
72+
sys.executable))
73+
74+
self.status('Uploading the package to PyPI via Twine…')
75+
os.system('twine upload --repository-url https://test.pypi.org/legacy/ dist/*')
76+
77+
self.status('Pushing git tags…')
78+
os.system('git tag v{0}'.format(about['__version__']))
79+
os.system('git push --tags')
80+
81+
sys.exit()
82+
83+
84+
# Where the magic happens:
385
setup(
4-
name='jupyterlab-dash',
5-
version='0.1',
86+
name=NAME,
87+
version=about['__version__'],
88+
description=DESCRIPTION,
89+
long_description=long_description,
90+
long_description_content_type='text/markdown',
91+
author=AUTHOR,
92+
python_requires=REQUIRES_PYTHON,
93+
url=URL,
694
packages=['jupyterlab_dash'],
7-
install_requires=['dash', 'jupyter-server-proxy']
95+
install_requires=REQUIRED,
96+
extras_require=EXTRAS,
97+
include_package_data=True,
98+
license='MIT',
99+
classifiers=[
100+
# Trove classifiers
101+
# Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
102+
'License :: OSI Approved :: MIT License',
103+
'Programming Language :: Python',
104+
'Programming Language :: Python :: 3',
105+
'Programming Language :: Python :: 3.5',
106+
'Programming Language :: Python :: 3.6',
107+
'Programming Language :: Python :: Implementation :: CPython',
108+
],
109+
# $ setup.py publish support.
110+
cmdclass={
111+
'upload': UploadCommand,
112+
},
8113
)

0 commit comments

Comments
 (0)