Switch from pipenv to poetry

- dropped dev dependency on rope, isort & flake
- poetry doesn't support dev scripts like pipenv, so create a makefile instead
- Add pytest-cov
- Use tox for testing multiple python versions in CI
- Update README

Update ci workflow
This commit is contained in:
Nat Noordanus
2020-05-27 23:20:54 +02:00
parent a46979c8a6
commit 8edec81b11
11 changed files with 939 additions and 555 deletions

View File

@@ -46,10 +46,10 @@ First, install the package. Note that the `[compiler]` feature flag tells it to
```sh
# Install both the library and compiler
$ pip install "betterproto[compiler]"
pip install "betterproto[compiler]"
# Install just the library (to use the generated code output)
$ pip install betterproto
pip install betterproto
```
Now, given you installed the compiler and have a proto file, e.g `example.proto`:
@@ -68,7 +68,7 @@ message Greeting {
You can run the following:
```sh
$ protoc -I . --python_betterproto_out=. example.proto
protoc -I . --python_betterproto_out=. example.proto
```
This will generate `hello.py` which looks like:
@@ -299,25 +299,26 @@ datetime.datetime(2019, 1, 1, 11, 59, 58, 800000, tzinfo=datetime.timezone.utc)
Join us on [Slack](https://join.slack.com/t/betterproto/shared_invite/zt-f0n0uolx-iN8gBNrkPxtKHTLpG3o1OQ)!
First, make sure you have Python 3.6+ and `pipenv` installed, along with the official [Protobuf Compiler](https://github.com/protocolbuffers/protobuf/releases) for your platform. Then:
First, make sure you have Python 3.6+ and `poetry` installed, along with the official [Protobuf Compiler](https://github.com/protocolbuffers/protobuf/releases) for your platform. Then:
```sh
# Get set up with the virtual env & dependencies
$ pipenv install --dev
poetry install
# Link the local package
$ pipenv shell
$ pip install -e .
# Activate the poetry environment
poetry shell
```
To benefit from the collection of standard development tasks ensure you have make installed and run `make help` to see available tasks.
### Code style
This project enforces [black](https://github.com/psf/black) python code formatting.
Before commiting changes run:
```bash
pipenv run black .
```sh
make format
```
To avoid merge conflicts later, non-black formatted python code will fail in CI.
@@ -351,10 +352,16 @@ Here's how to run the tests.
```sh
# Generate assets from sample .proto files
$ pipenv run generate
make generate
# Run all tests
$ pipenv run test
make test
```
To run tests as they are run in CI (with tox) run:
```sh
make full-test
```
### (Re)compiling Google Well-known Types