Skip to content

Commit fb2dbcf

Browse files
committed
Add docs for publishing to PyPI
1 parent 9e19d11 commit fb2dbcf

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

docs/internal/publishing.md

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Publishing
2+
3+
Follow these instructions for releasing a new version of Mesop publicly via PyPI (e.g. `pip install mesop`).
4+
5+
## Bump the version
6+
7+
Update `mesop/pip_package/setup.py` version field to the next version.
8+
9+
## Install locally
10+
11+
```sh
12+
rm -rf /tmp/mesoprelease-test && \
13+
bazel clean --expunge && \
14+
virtualenv --python python3 /tmp/mesoprelease-test/venv-test && \
15+
source /tmp/mesoprelease-test/venv-test/bin/activate && \
16+
pip install --upgrade pip && \
17+
pip install -r mesop/pip_package/requirements.txt --no-binary pydantic && \
18+
pip uninstall -y mesop && \
19+
bazel run //mesop/pip_package:build_pip_package -- /tmp/mesoprelease-test/mesop.tar.gz && \
20+
cd /tmp/mesoprelease-test/ && \
21+
tar -xzf mesop.tar.gz && \
22+
pip install --upgrade /tmp/mesoprelease-test/mesop*.whl
23+
```
24+
25+
## Testing locally
26+
27+
Create a simple hello world Mesop app to make sure it works:
28+
29+
```py
30+
import mesop as me
31+
32+
33+
@me.page()
34+
def app():
35+
me.text("Hello world")
36+
37+
38+
if __name__ == "__main__":
39+
me.run()
40+
```
41+
42+
> Note: you want to make sure that
43+
44+
## Upload to PyPI
45+
46+
```sh
47+
rm -rf /tmp/mesoprelease-test/venv-twine \
48+
&& virtualenv --python python3 /tmp/mesoprelease-test/venv-twine \
49+
&& source /tmp/mesoprelease-test/venv-twine/bin/activate \
50+
&& pip install --upgrade pip \
51+
&& pip install twine \
52+
&& twine upload mesop*.whl
53+
```
54+
55+
Visit [https://pypi.org/project/mesop/](https://pypi.org/project/mesop/) to see that the new version has been published.
56+
57+
## First-time upload setup
58+
59+
Create a file `~/.pypirc`:
60+
61+
```yaml
62+
[pypi]
63+
username = __token__
64+
password = {{password}}
65+
```
66+
67+
You will need to get a PyPI token generated by one of the project maintainers.

mkdocs.yml

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ nav:
5858
- Type checking: internal/type_checking.md
5959
- CI: internal/ci.md
6060
- Build / Toolchain: internal/toolchain.md
61+
- Publishing: internal/publishing.md
6162
theme:
6263
name: material
6364
logo: assets/logo.png

0 commit comments

Comments
 (0)