| 
 | 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.  | 
0 commit comments