Skip to content

Commit

Permalink
Add docs for publishing to PyPI
Browse files Browse the repository at this point in the history
  • Loading branch information
wwwillchen committed Feb 17, 2024
1 parent 9e19d11 commit fb2dbcf
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
67 changes: 67 additions & 0 deletions docs/internal/publishing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Publishing

Follow these instructions for releasing a new version of Mesop publicly via PyPI (e.g. `pip install mesop`).

## Bump the version

Update `mesop/pip_package/setup.py` version field to the next version.

## Install locally

```sh
rm -rf /tmp/mesoprelease-test && \
bazel clean --expunge && \
virtualenv --python python3 /tmp/mesoprelease-test/venv-test && \
source /tmp/mesoprelease-test/venv-test/bin/activate && \
pip install --upgrade pip && \
pip install -r mesop/pip_package/requirements.txt --no-binary pydantic && \
pip uninstall -y mesop && \
bazel run //mesop/pip_package:build_pip_package -- /tmp/mesoprelease-test/mesop.tar.gz && \
cd /tmp/mesoprelease-test/ && \
tar -xzf mesop.tar.gz && \
pip install --upgrade /tmp/mesoprelease-test/mesop*.whl
```

## Testing locally

Create a simple hello world Mesop app to make sure it works:

```py
import mesop as me


@me.page()
def app():
me.text("Hello world")


if __name__ == "__main__":
me.run()
```

> Note: you want to make sure that
## Upload to PyPI

```sh
rm -rf /tmp/mesoprelease-test/venv-twine \
&& virtualenv --python python3 /tmp/mesoprelease-test/venv-twine \
&& source /tmp/mesoprelease-test/venv-twine/bin/activate \
&& pip install --upgrade pip \
&& pip install twine \
&& twine upload mesop*.whl
```

Visit [https://pypi.org/project/mesop/](https://pypi.org/project/mesop/) to see that the new version has been published.

## First-time upload setup

Create a file `~/.pypirc`:

```yaml
[pypi]
username = __token__
password = {{password}}
```

You will need to get a PyPI token generated by one of the project maintainers.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ nav:
- Type checking: internal/type_checking.md
- CI: internal/ci.md
- Build / Toolchain: internal/toolchain.md
- Publishing: internal/publishing.md
theme:
name: material
logo: assets/logo.png
Expand Down

0 comments on commit fb2dbcf

Please sign in to comment.