Skip to content
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/cd-pydgraph.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: cd-pydgraph
on:
workflow_dispatch:
inputs:
releasetag:
description: 'releasetag'
required: true
type: string
jobs:
pydgraph-build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
ref: '${{ github.event.inputs.releasetag }}'
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements_dev.txt
# use twine to upload to pypi
python -m pip install twine
- name: Verify that protobufs are checked in
run: |
# should be a no-op
python scripts/protogen.py
git diff --exit-code -- .
- name: Build pydgraph
run: |
rm -rf dist
# build binary wheel and a source tarball
python -m build
- name: Upload to PyPi
run: twine upload --username dgraph-io --password ${{ secrets.DGRAPH_PYPI_PASSWORD }} dist/*
3 changes: 1 addition & 2 deletions .github/workflows/ci-pydgraph-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ jobs:
run: |
cd pydgraph
python -m pip install --upgrade pip
# see https://github.com/pypa/pip/issues/8559
pip install -r requirements.txt --use-pep517
pip install -r requirements_dev.txt
- name: Run tests
run: cd pydgraph && bash scripts/local-test.sh
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ pydgraph.iml
# Python Virtual Environments
venv
.venv
pyvenv.cfg
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

58 changes: 7 additions & 51 deletions PUBLISHING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,58 +6,14 @@ This document contains instructions to publish pydgraph to [PyPI].

## Before deploying

- Get access to credentials for Dgraph's account on PyPI with username dgraph-io
- Setup you `~/.pypirc` file like this: (remember to replace `${password}` with
the actual password)

```
[distutils]
index-servers=
pypi
testpypi

[pypi]
username: dgraph-io
password: ${password}

[testpypi]
repository: https://test.pypi.org/legacy/
username: dgraph-io
password: ${password}
```
- Build pydgraph locally (see readme)
- Push to testpypi (`twine upload --repository testpypi dist/*`)
- Verify readme and metadata look correct

## Deploying

- Build and test the code that needs to be published
- Regenerate protobufs if api.proto was changed
- Bump version by modifying the `VERSION` variable in `pydgraph/meta.py` file
- If necessary, update the `CHANGELOG.md` file to reflect new changes
- Commit the changes
- Make sure you have [setuptools], [wheel], [twine], and [pypandoc]
installed. You can install them by running the following:

```
pip install -r publishing-requirements.txt
```
- Run the following commands:

```sh
# Remove build and dist directories
rm -rf build
rm -rf dist

# Package you project: source distribution and wheel
python setup.py sdist
python setup.py bdist_wheel

# Upload it to PyPI
twine upload dist/*
# For testing, try uploading to testpypi:
# twine upload --repository testpypi dist/*
```

- If necessary, create a new release tag on the Github repository

[setuptools]: https://pypi.org/project/setuptools/
[wheel]: https://pypi.org/project/wheel/
[twine]: https://pypi.org/project/twine/
[pypandoc]: https://pypi.org/project/pypandoc/
- Update the `CHANGELOG.md` file to reflect new changes
- Tag pydgraph locally (`git tag x.y.z`) and push to origin (`git push x.y.z`)
- Run CD pipeline
32 changes: 11 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ This is the official Dgraph database client implementation for Python (Python >=

This client follows the [Dgraph Go client][goclient] closely.

**Use [Discuss Issues](https://discuss.dgraph.io/c/issues/35/clients/46) to report issues about this repository.**

[goclient]: https://github.com/dgraph-io/dgo

Before using this client, we highly recommend that you read the [Dgraph Python
Expand Down Expand Up @@ -45,14 +43,6 @@ Install using pip:
pip install pydgraph
```

### Install Notes

To avoid issues when adding composite credentials or when using client authorization, please install gRPC version 1.19.0:

```sh
pip install grpcio==1.19.0
```

## Supported Versions

Depending on the version of Dgraph that you are connecting to, you will have to
Expand All @@ -63,6 +53,7 @@ use a different version of this client.
| 1.0.X | <= *1.2.0* |
| 1.1.X | >= *2.0.0* |
| 1.2.X | >= *2.0.0* |
| 23.X.Y | >= *23.0.0* |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't we need to follow calver for pydgraph. We should just do a minor release instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree it is not clean but unfortunately there are already calver releases for pydgraph: https://github.com/dgraph-io/pydgraph/releases

The latest release is v21.03.0. The table here was not updated.


## Quickstart

Expand Down Expand Up @@ -100,7 +91,7 @@ op = pydgraph.Operation(schema=schema)
client.alter(op)
```

Starting with Dgraph version 20.03.0, indexes can be computed in the background.
Indexes can be computed in the background.
You can set the `run_in_background` field of `pydgraph.Operation` to `True`
before passing it to the `Alter` function. You can find more details
[here](https://docs.dgraph.io/master/query-language/#indexes-in-background).
Expand Down Expand Up @@ -465,12 +456,13 @@ except Exception as e:

## Development

### Building the source
### Build from source

To build and install pydgraph locally, run

```sh
python setup.py install
# To install for the current user, use this instead:
# python setup.py install --user
python -m build
pip install -e .
```

If you have made changes to the `pydgraph/proto/api.proto` file, you need need
Expand All @@ -494,16 +486,14 @@ The required change is outlined below as a diff.

### Running tests

To run the tests in your local machine, install and run `tox`:
To run the tests in your local machine, run:

```bash
pip install tox
tox
bash scripts/local-test.sh
```

This script assumes Dgraph and [dgo](https://github.com/dgraph-io/dgo) (Go
client) are already built on the local machine and that their code is in
`$GOPATH/src`. It also requires that docker and docker-compose are installed in
This script assumes dgraph is located on your path. Dgraph release binaries can be found [here](https://github.com/dgraph-io/dgraph/releases).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

limit the line width

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

The test script also requires that `docker` and `docker compose` are installed on
your machine.

The script will take care of bringing up a Dgraph cluster and bringing it down
Expand Down
4 changes: 0 additions & 4 deletions publishing-requirements.txt

This file was deleted.

2 changes: 1 addition & 1 deletion pydgraph/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@

"""Metadata about this package."""

VERSION = '21.3.2'
VERSION = '23.0.0rc1'
Loading