22
33## Getting Started
44
5- Create a virtualenv and install the dependencies:
5+ You will need [ Pixi ] ( https://pixi.sh/latest/ ) to build this project.
66
77``` bash
8- virtualenv env
9- source env/bin/activate
10- pip install -e " .[dev]"
8+ pixi run dev-install
119```
1210
13- The service is written using FastAPI and runs inside of Uvicorn. You can start a dev server quickly with the ` run.sh ` helper script :
11+ The service is written using FastAPI and runs inside of Uvicorn. You can start a dev server quickly with this command :
1412
15- ``` bash
16- ./run.sh
17- ```
18-
19- This is equivalent to running Uvicorn directly, like this:
13+ Then run the development server:
2014
2115``` bash
22- uvicorn x2s3.app:app --host 0.0.0.0 --port 8000 --workers 1 --access-log --reload
16+ pixi run dev-launch
2317```
2418
25- You can specify TLS certificates and increase the number of workers in order to scale the service :
19+ On a remote system, you may need SSL certs (e.g. for loading into Neuroglancer), which can be added like this (assuming your certificate is found at ` /opt/certs/cert.key ` and ` /opt/certs/cert.crt ` ) :
2620
2721``` bash
28- uvicorn x2s3.app:app --host 0.0.0.0 --port 8000 --workers 8 --access-log --ssl-keyfile /opt/tls/cert.key --ssl-certfile /opt/tls/cert.crt
22+ pixi run dev-launch-remote
2923```
3024
3125For production deployments, please refer to the main [ README] ( ../README.md ) file.
3226
3327
34- ## Freezing requirements
28+ ## Testing
29+
30+ To run the unit tests and produce a code coverage report:
3531
3632``` bash
37- pip freeze | grep -v ' ^-e ' > requirements.txt
33+ pixi run test
3834```
3935
36+ These tests are automatically run whenever changes are merged to the * main* branch.
4037
41- ## Testing
38+ ## Release
4239
43- To run the unit tests and produce a code coverage report:
40+ First, increment the version in ` pyproject.toml ` and push it to GitHub. Create a * Release* there and then publish it to PyPI as follows.
41+
42+ To create a Python source package (` .tar.gz ` ) and the binary package (` .whl ` ) in the ` dist/ ` directory, do:
4443
4544``` bash
46- python -m pytest --cov=x2s3 --cov-report html -W ignore::DeprecationWarning
45+ pixi run pypi-build
4746```
4847
49- These tests are automatically run whenever changes are merged to the * main * branch.
48+ To upload the package to the PyPI, you'll need one of the project owners to add you as a collaborator. After setting up your access token, do:
5049
50+ ``` bash
51+ pixi run pypi-upload
52+ ```
5153
52- ## Building the Docker container
54+ ### Building the Docker container
5355
5456Run the Docker build, replacing ` <version> ` with your version number:
5557
@@ -63,24 +65,14 @@ If you are using Podman, you can do something like this:
6365
6466``` bash
6567cd docker/
66- export VER =< version>
68+ export VERSION =< version>
6769export IMAGE=" ghcr.io/janeliascicomp/x2s3"
6870podman build --jobs=2 --platform=linux/amd64,linux/arm64 \
69- --manifest " $IMAGE :$VER " --tag " $IMAGE :latest" .
71+ --manifest " $IMAGE :$VERSION " --tag " $IMAGE :latest" .
7072```
7173
7274Push the images to GHCR:
7375```
74- podman manifest push --all "$IMAGE:$VER " "docker://$IMAGE:$VER "
76+ podman manifest push --all "$IMAGE:$VERSION " "docker://$IMAGE:$VERSION "
7577podman manifest push --all "$IMAGE:latest" "docker://$IMAGE:latest"
7678```
77-
78- ## Deploying to PyPI
79-
80- After creating a new release, remember to update the version in ` pyproject.toml ` , then:
81-
82- ``` bash
83- pip install build twine
84- python -m build
85- python -m twine upload dist/*
86- ```
0 commit comments