Skip to content

Commit b1f8720

Browse files
committed
Merge pull request #1 from plotly/publish-py-package
Add PyPi package configuration
1 parent 2fa35ed commit b1f8720

File tree

7 files changed

+59
-1
lines changed

7 files changed

+59
-1
lines changed
+2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
build/
2+
dist/
23
lib/
34
node_modules/
45
.npm
56
vv/
67
venv/
78
*.pyc
9+
*.egg-info
810
*.log
911
.DS_Store
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include lib/metadata.json

packages/dash-html-components/README.md

+32-1
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,25 @@ Now you should be able to restart the webpack process (in `dash2/renderer`:
5555
`ctrl-c`, `npm start`), after which webpack will automatically pick up new
5656
changes to the component suite.
5757

58+
## Installing python package locally
59+
60+
You don't need publishing access to test the module locally.
61+
62+
```sh
63+
# Install in `site-packages` on your machine
64+
$ python setup.py install
65+
```
66+
5867
## Publishing
5968

60-
Ask @coopy or @chriddyp to be added to the [NPM package authors][].
69+
For now, two different workflows are necessary for publishing to NPM and PyPi,
70+
respectively. TODO:
71+
[#5](https://github.com/plotly/dash-components-archetype/issues/5) will roll up
72+
publishing steps into one workflow.
73+
74+
Ask @chriddyp to be added to the [NPM package authors][] or to [PyPi][].
75+
76+
### Publishing to NPM
6177

6278
```sh
6379
# Bump the package version
@@ -70,6 +86,20 @@ $ git push --follow-tags
7086
$ npm publish
7187
```
7288

89+
### Publishing to PyPi
90+
91+
```sh
92+
# Bump the package version
93+
$ vi setup.py
94+
95+
# Commit to github
96+
$ git add setup.py
97+
$ git commit -m "Bump pypi package version to vx.x.x"
98+
99+
# Publish to PyPi
100+
$ npm run publish-pypi
101+
```
102+
73103
## Builder / Archetype
74104

75105
We use [Builder][] to centrally manage build configuration, dependencies, and
@@ -81,4 +111,5 @@ scripts. See the [dash-components-archetype][] repo for more information.
81111
[dash-components-archetype]: https://github.com/plotly/dash-components-archetype
82112
[MDN HTML attribute reference]: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
83113
[NPM package authors]: https://www.npmjs.com/package/dash-html-components/access
114+
[PyPi]: https://pypi.python.org/pypi
84115

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import dash as _dash
2+
import sys as _sys
3+
4+
_dash.development.component_loader.load_components(
5+
'../lib/metadata.json',
6+
['content', 'id', 'key', 'className', 'style', 'dependencies'],
7+
globals(),
8+
_sys._getframe(1).f_globals.get('__name__', '__main__')
9+
)

packages/dash-html-components/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"homepage": "https://github.com/plotly/dash-html-components",
1515
"scripts": {
1616
"prepublish": "npm test",
17+
"publish-pypi": "python setup.py sdist upload",
1718
"start": "builder run transpile-dev-watch",
1819
"test": "builder run check"
1920
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--index-url https://pypi.python.org/simple/
2+
3+
-e .
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from setuptools import setup
2+
3+
setup(
4+
name='dash_html_components',
5+
version='0.1.0',
6+
author='plotly',
7+
packages=['dash_html_components'],
8+
license='MIT',
9+
description='Dash UI component suite',
10+
install_requires=['flask', 'plotly', 'flask-cors', 'dash.ly']
11+
)

0 commit comments

Comments
 (0)