-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(grpc-asyncio): replace hatch with poetry
Since poetry is used in our other python libraries, and hatch is hard to understand (and to get working), we replace hatch with poetry. As a nifty side-effect, the Docker container is now executed as a user with the same uid/gid as the host user, resulting in files created with the correct permissions in the mounted host volume.
- Loading branch information
1 parent
9783b46
commit d5b5a49
Showing
16 changed files
with
1,351 additions
and
299 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,72 @@ | ||
# RemotiveLabs Python libraries | ||
# RemotiveLabs Broker API Python SDK | ||
|
||
## Usage | ||
`remotivelabs-broker` - Python SDK for interacting with the RemotiveLabs Broker. | ||
|
||
Python RemotiveBroker API | ||
Published to PyPI on [https://pypi.org/project/remotivelabs-broker/](https://pypi.org/project/remotivelabs-broker/) | ||
|
||
https://pypi.org/project/remotivelabs-broker/ | ||
## Getting started | ||
|
||
Published on [PyPi](https://pypi.org/) with the prefix `remotivelabs-` and with the user [remotivelabs](https://pypi.org/user/remotivelabs/). | ||
All packages use [Hatch](https://hatch.pypa.io/) for packaging and publishing. | ||
Prerequisites: | ||
|
||
```bash | ||
# Install poetry (and optionally poe plugin) | ||
pipx install poetry | ||
poetry self add 'poethepoet[poetry_plugin]' | ||
``` | ||
|
||
Build and run: | ||
|
||
## Development | ||
```bash | ||
cd python/remotivelabs-broker | ||
|
||
Install hatch on your development computer: | ||
# Install dependencies in a virtualenv | ||
poetry install | ||
|
||
pip install hatch | ||
# Build the library (output in dist/) | ||
poetry build | ||
|
||
Any project related information is stored in `pyproject.toml`. | ||
# test local (local test does not require a running broker) | ||
poetry poe test-local | ||
|
||
Hatch supplies a basic set of tools for development. | ||
All operations should be done in an virtual environment created by hatch. | ||
# test server (server test requires a running broker) | ||
poetry poe test-server | ||
|
||
Go to the directory of the module which you are going to be working on. | ||
For example: | ||
# test all | ||
poetry poe test | ||
``` | ||
|
||
cd python/remotivelabs-broker | ||
If you need to (re)generate protobuf stubs, see [Building](#building). | ||
|
||
Create a local environment. | ||
## Building | ||
|
||
hatch env create | ||
Building the complete package, including protobuf stubs and documentation, is done using a docker container: | ||
|
||
Start a shell in the environment. | ||
```bash | ||
cd python/remotivelabs-broker | ||
./docker-build.sh | ||
``` | ||
|
||
hatch shell | ||
## Versioning | ||
|
||
While in this virtual environment the library is available as a python module without needing to be installed. | ||
Update the package version by editing the following files: | ||
- `pyproject.toml` | ||
- `remotivelabs/broker/__about__.py` | ||
|
||
Build the library: | ||
Follow [Semantic versioning](https://semver.org/). Beta versions should be suffixed with `b*`, example `0.2.0b1`. | ||
|
||
hatch build | ||
## Publishing | ||
|
||
Update the package version by editing the file `__about__.py`. | ||
This version stamp will be used in Pypi. | ||
Follow [Semantic versioning](https://semver.org/). | ||
Published to PyPI on [https://pypi.org/project/remotivelabs-broker/](https://pypi.org/project/remotivelabs-broker/): | ||
|
||
Testing, with coverage: | ||
All RemotiveLabs libraries: | ||
- share the same `remotivelabs` [namespace package](https://peps.python.org/pep-0420/). | ||
- use the `remotivelabs-` prefix in the library name. | ||
- are published with the [remotivelabs](https://pypi.org/user/remotivelabs/) user. | ||
|
||
hatch run cov | ||
|
||
Without coverage: | ||
|
||
hatch run no-cov | ||
|
||
While in the hatch virtual environment. | ||
Run the Python debugger: | ||
|
||
python -m pdb ... | ||
```bash | ||
# Get token from Johan Rask | ||
poetry config pypi-token.pypi <my-token> | ||
|
||
# find username and password in less secret location | ||
poetry publish | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.