-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #329 from aerospike/stage
PR: Python-Client stage to master merge for release 8.0.0
- Loading branch information
Showing
305 changed files
with
50,617 additions
and
50,468 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
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[flake8] | ||
max-line-length = 120 | ||
# For black compatibility: | ||
extend-ignore = E203 | ||
filename = | ||
./aerospike_helpers/**/*.py, | ||
./test/**/*.py |
This file was deleted.
Oops, something went wrong.
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,61 +1,92 @@ | ||
name: Pytest Tests | ||
name: PR pre-merge tests | ||
|
||
# Trigger test workflow whenever: | ||
# 1. A pull request is updated (e.g with new commits) | ||
# 2. Commits are pushed directly to the stage or master branch | ||
on: | ||
push: | ||
branches: ["stage", "master"] | ||
pull_request: | ||
branches: ["stage"] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
tests: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.9' | ||
architecture: 'x64' | ||
- name: Install linting dependencies | ||
run: python -m pip install flake8 | ||
- name: Lint Python code | ||
run: python -m flake8 | ||
- name: Lint C wrapper code | ||
uses: jidicula/[email protected] | ||
with: | ||
check-path: 'src' | ||
clang-format-version: 14 | ||
|
||
build-install-test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
py-version: [3.7, 3.8, 3.9] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
|
||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.py-version }} | ||
architecture: 'x64' | ||
|
||
- run: sudo apt update | ||
- name: Install build dependencies (apt packages) | ||
run: sudo apt install python3-dev libssl-dev -y | ||
- name: Install build dependencies (pip packages) | ||
run: python3 -m pip install build | ||
|
||
- name: Build client | ||
run: python3 -m build | ||
|
||
- name: Install client | ||
run: pip install . | ||
|
||
- name: Install test dependencies | ||
run: pip install -r test/requirements.txt | ||
|
||
- name: Set up Aerospike Database | ||
uses: reugn/github-action-aerospike@dev | ||
with: | ||
port: 3000 | ||
# config-file: 'test/test-instance-data/aerospike.conf' | ||
# feature-key-file: 'test/test-instance-data/features.conf' | ||
|
||
- name: Wait for database to be ready | ||
# Should be ready after 3 seconds | ||
run: sleep 3 | ||
|
||
- name: Run tests | ||
run: python -m pytest ./new_tests | ||
working-directory: test | ||
|
||
spellcheck-docs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.9' | ||
architecture: 'x64' | ||
- name: Print Python debug info | ||
run: python --version | ||
- name: Setup test config file | ||
run: | | ||
sudo apt-get install jq | ||
cd test | ||
CID=$(docker ps -a | grep 'aerospike-server' | awk 'NF>1{print $NF}') | ||
echo $CID | ||
CIP=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $CID) | ||
echo $CIP | ||
python - <<EOF | ||
import configparser | ||
config = configparser.ConfigParser(delimiters=(":")) | ||
config["enterprise-edition"] = {"hosts": "", "user": "", "password": ""} | ||
config["community-edition"] = {"hosts": "$CIP" + ":3000"} | ||
with open("config.conf", "w") as conf: | ||
config.write(conf) | ||
EOF | ||
cat ./config.conf | ||
cd .. | ||
- name: Print Docker debug info | ||
run: | | ||
docker inspect gha_aerospike | ||
docker ps | ||
docker ps -a | ||
docker logs --tail all gha_aerospike | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get install libssl-dev | ||
sudo apt-get install python3-dev | ||
python -m pip install pytest | ||
- name: Build client | ||
run: | | ||
python setup.py build --force | ||
- name: Install client | ||
run: | | ||
python setup.py install --force | ||
- name: Run tests | ||
run: | | ||
cd test | ||
python -m pytest ./new_tests | ||
- name: Install dependencies for checking spelling in docs | ||
# TODO: find way to split up dependencies | ||
run: python -m pip install -r doc/requirements.txt | ||
- name: Check spelling | ||
run: sphinx-build -b spelling . spelling -W --keep-going | ||
working-directory: doc |
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,5 +1,5 @@ | ||
[submodule "aerospike-client-c"] | ||
path = aerospike-client-c | ||
#url = [email protected]:aerospike/aerospike-client-c.git | ||
# url = [email protected]:aerospike/aerospike-client-c.git | ||
url = https://github.com/aerospike/aerospike-client-c.git | ||
branch = master |
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,10 +1,5 @@ | ||
# Manually Building the Python Client for Aerospike | ||
|
||
The Python client for Aerospike works with Python 3.6, 3.7, 3.8, 3.9 running on | ||
**64-bit** macOS 10.15+ and Linux. | ||
Python 3.6 hits [End of Life](https://endoflife.date/python) on December 23rd, | ||
2021, and is now deprecated. | ||
|
||
First clone this repository to get the necessary files. | ||
|
||
`git clone --recurse-submodules ...` | ||
|
@@ -74,39 +69,41 @@ The dependencies can be installed through the macOS package manager [Homebrew](h | |
brew install openssl@1 | ||
# brew uninstall openssl@3 | ||
|
||
### All distros | ||
|
||
Install `clang-format` for formatting the C source code: | ||
``` | ||
sudo apt install clang-format | ||
``` | ||
## Build | ||
export STATIC_SSL=1 | ||
# substitute the paths to your OpenSSL 1.1 library | ||
export SSL_LIB_PATH=/usr/local/Cellar/[email protected]/1.1.1l/lib/ | ||
export CPATH=/usr/local/Cellar/[email protected]/1.1.1l/include/ | ||
python setup.py build --force | ||
pip install build | ||
python3 -m build | ||
### Troubleshooting macOS | ||
In some versions of macOS, Python 2.7 is installed as ``python`` with | ||
``pip`` as its associated package manager, and Python 3 is installed as ``python3`` | ||
with ``pip3`` as the associated package manager. Make sure to use the ones that | ||
map to Python 3, such as `python3 setup.py build --force`. | ||
map to Python 3. | ||
Building on macOS versions >= 10.15 , may cause a few additional errors to be generated. If the build command fails with an | ||
error similar to: `error: could not create '/usr/local/aerospike/lua': Permission denied` there are a couple of options: | ||
- Rerun the build command with the additional command line flags `--user --prefix=` *Note that there are no charcters after the '='.* This will cause the library to only be installed for the current user, and store the library's data files in a user specific location. | ||
- rerun the command with sudo. | ||
If an error similar to `ld: targeted OS version does not support use of thread local variables` appears, it can be fixed by temporarily setting the `MACOSX_DEPLOYMENT_TARGET` environment variable to `'10.12'` e.g. | ||
|
||
```sh | ||
MACOSX_DEPLOYMENT_TARGET=10.12 python setup.py build --force | ||
MACOSX_DEPLOYMENT_TARGET=10.12 python setup.py install --force | ||
``` | ||
|
||
## Install | ||
Once the client is built: | ||
python setup.py install --force | ||
pip install . | ||
### Troubleshooting macOS | ||
|
@@ -135,6 +132,25 @@ Simply call `python` with the path to the example | |
python examples/client/kvs.py | ||
## Contributing | ||
### Codestyle | ||
All code in `aerospike_helpers` must pass a lint test using `flake8`: | ||
``` | ||
pip install flake8 | ||
``` | ||
The command is: | ||
``` | ||
python3 -m flake8 | ||
``` | ||
All C source code must be formatted with `clang-format`: | ||
``` | ||
clang-format -i <filename> | ||
``` | ||
## License | ||
The Aerospike Python Client is made availabled under the terms of the Apache License, Version 2, as stated in the file `LICENSE`. | ||
|
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.