Skip to content

Commit

Permalink
Merge pull request #329 from aerospike/stage
Browse files Browse the repository at this point in the history
PR: Python-Client stage to master merge for release 8.0.0
  • Loading branch information
juliannguyen4 authored Nov 18, 2022
2 parents c1bac59 + ebcf661 commit 7f90073
Show file tree
Hide file tree
Showing 305 changed files with 50,617 additions and 50,468 deletions.
3 changes: 2 additions & 1 deletion .build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ name: aerospike-client-python
container:
- base:
- docker.qe.aerospike.com/build/aerospike-client-python:manylinux2014
- docker.qe.aerospike.com/build/aerospike-client-python:arm-manylinux2014

build:
- name: build
environment:
PYTHONS: /opt/python/cp36-cp36m/bin,/opt/python/cp37-cp37m/bin,/opt/python/cp38-cp38/bin,/opt/python/cp39-cp39/bin
PYTHONS: /opt/python/cp37-cp37m/bin,/opt/python/cp38-cp38/bin,/opt/python/cp39-cp39/bin
script:
- scripts/manylinux2014build.sh
artifact:
Expand Down
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ StatementMacros:
- Py_END_ALLOW_THREADS
TabWidth: 4
UseCRLF: false
UseTab: Always
UseTab: Never
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
Expand Down
7 changes: 7 additions & 0 deletions .flake8
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
65 changes: 0 additions & 65 deletions .github/workflows/manual.yml

This file was deleted.

121 changes: 76 additions & 45 deletions .github/workflows/tests.yml
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
2 changes: 1 addition & 1 deletion .gitmodules
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
46 changes: 31 additions & 15 deletions BUILD.md
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 ...`
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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`.
Expand Down
5 changes: 1 addition & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@ Aerospike Python Client
Compatibility
-------------

The Python client for Aerospike works with Python 3.6, 3.7, 3.8, 3.9 running on
The Python client for Aerospike works with Python 3.7, 3.8, 3.9 running on
**64-bit** macOS 10.15+ and Linux (RHEL/CentOS 7 & 8; Debian 8, 9 & 10; Ubuntu
18.04 & 20.04).

Python 3.6 hits `End of Life <https://endoflife.date/python>`__ on December 23rd,
2021, and is now deprecated.

**NOTE:** Aerospike Python client 5.0.0 and up MUST be used with Aerospike server 4.9 or later.
If you see the error "-10, ‘Failed to connect’", please make sure you are using server 4.9 or later.

Expand Down
Loading

0 comments on commit 7f90073

Please sign in to comment.