Skip to content

Commit f97a9c2

Browse files
rnpridgeonRyan P
authored andcommitted
Move depenndencies to requirements files, update build config
1 parent 021537d commit f97a9c2

File tree

12 files changed

+113
-60
lines changed

12 files changed

+113
-60
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,7 @@ dl-*
2222
.pytest_cache
2323
staging
2424
tests/docker/conf/tls/*
25-
.idea
2625
.python-version
26+
.DS_Store
27+
.idea
28+
tmp-KafkaCluster

.travis.yml

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,14 @@ matrix:
1818
# Source package verification with Python 2.7
1919
- os: osx
2020
python: "2.7"
21-
env: DYLD_LIBRARY_PATH="$PWD/tmp-build/lib"
22-
before_install:
23-
- pip install -U pip && pip install virtualenv
24-
- pyenv install -f 2.7.15
25-
- pip install virtualenv
26-
- virtualenv -p ~/.pyenv/versions/2.7.15/bin/python ./env
27-
- source env/bin/activate
21+
env: DYLD_LIBRARY_PATH="$PWD/tmp-build/lib" INTERPRETER_VERSION="2.7.17"
2822
# Source package verification with Python 3.6
2923
- os: osx
3024
python: "3.6"
31-
env: DYLD_LIBRARY_PATH="$PWD/tmp-build/lib" MK_DOCS="y" EXTRA_PKGS="sphinx sphinx_rtd_theme avro-python3"
32-
before_install:
33-
- pip install -U pip && pip install virtualenv
34-
- pyenv install -f 3.6.5
35-
- pip install virtualenv
36-
- virtualenv -p ~/.pyenv/versions/3.6.5/bin/python ./env
37-
- source env/bin/activate
25+
env: DYLD_LIBRARY_PATH="$PWD/tmp-build/lib" MK_DOCS="y" INTERPRETER_VERSION="3.6.5"
3826
# cibuildwheel for osx
3927
- os: osx
40-
env: CIBW_BEFORE_BUILD="tools/bootstrap-librdkafka.sh --require-ssl ${LIBRDKAFKA_VERSION} tmp" CFLAGS="-Itmp/include" LDFLAGS="-Ltmp/lib"
41-
before_install:
42-
- pip install virtualenv
28+
env: CIBW_BEFORE_BUILD="tools/bootstrap-librdkafka.sh --require-ssl ${LIBRDKAFKA_VERSION} tmp" CFLAGS="-Itmp/include" LDFLAGS="-Ltmp/lib" INTERPRETER_VERSION="2.7.17"
4329
# cibuildwheel for manylinux
4430
- os: linux
4531
dist: trusty
@@ -49,30 +35,45 @@ matrix:
4935
- PYTHON_CONFIGURE_OPTS="--enable-unicode=ucs4 --with-wide-unicode"
5036
- CIBW_MANYLINUX_X86_64_IMAGE="manylinux1"
5137
- CIBW_MANYLINUX_I686_IMAGE="manylinux1
38+
- INTERPRETER_VERSION="2.7.17"
5239
language: python
5340
python: "2.7"
5441
services: docker
5542

43+
# See https://cibuildwheel.readthedocs.io/en/latest/options/ for CIBW* vars
44+
45+
# Install test dependencies unconditionally
46+
# Travis OSX envs requires some setup; see tools/prepare-osx.sh
47+
# Install cibuildwheel if this is a tagged PR
48+
before_install:
49+
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then tools/prepare-osx.sh ${INTERPRETER_VERSION} /tmp/venv && source /tmp/venv/bin/activate; fi
50+
- if [[ -n $TRAVIS_TAG && -n $CIBW_BEFORE_BUILD ]]; then pip install cibuildwheel --force-reinstall; fi
51+
52+
# Install interceptors
53+
# Install librdkafka if not CIBW_BEFORE_BUILD
54+
# Install confluent_kafka[avro] if not CIBW_BEFORE_BUILD
5655
install:
5756
- tools/install-interceptors.sh
58-
- pip install -U pip && pip install virtualenv
59-
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then python -m ensurepip && virtualenv /tmp/venv && source /tmp/venv/bin/activate ; fi
60-
- if [[ -z $CIBW_BEFORE_BUILD ]]; then pip install pytest-timeout flake8 trivup; fi
61-
- if [[ -z $CIBW_BEFORE_BUILD ]]; then rm -rf tmp-build ; tools/bootstrap-librdkafka.sh --require-ssl ${LIBRDKAFKA_VERSION} tmp-build ; fi
62-
- if [[ -n $TRAVIS_TAG && -n $CIBW_BEFORE_BUILD ]]; then pip install cibuildwheel --force-reinstall; fi
63-
- if [[ ! -z $EXTRA_PKGS ]]; then pip install $(echo $EXTRA_PKGS) ; fi
57+
- pip install -r tests/requirements.txt
58+
- flake8
59+
- if [[ $MK_DOCS == y ]]; then pip install -r docs/requirements.txt; fi
60+
- if [[ -z $CIBW_BEFORE_BUILD ]]; then tools/bootstrap-librdkafka.sh --require-ssl ${LIBRDKAFKA_VERSION} tmp-build && pip install --global-option=build_ext --global-option="-Itmp-build/include/" --global-option="-Ltmp-build/lib" . .[avro]; fi
6461

62+
# Build wheels
6563
script:
66-
- if [[ -z $CIBW_BEFORE_BUILD ]]; then pip install --global-option=build_ext --global-option="-Itmp-build/include/" --global-option="-Ltmp-build/lib" . .[avro] ; fi
67-
- if [[ -z $CIBW_BEFORE_BUILD ]]; then flake8 ; fi
68-
# Make plugins available for tests
64+
- if [[ -n $TRAVIS_TAG && -n $CIBW_BEFORE_BUILD ]]; then cibuildwheel --output-dir wheelhouse1 && tools/fixup-wheels.sh wheelhouse1 wheelhouse; fi
65+
66+
# Make plugins available for tests
67+
# Execute tests if not CIBW_BEFORE_BUILD [osx, linux]
68+
# Execute integration tests if CIBW_BEFORE_BUILD
69+
# Build docs if MK_DOCS
70+
after_script:
6971
- ldd staging/libs/* || otool -L staging/libs/* || true
70-
- if [[ -z $CIBW_BEFORE_BUILD && $TRAVIS_OS_NAME == "osx" ]]; then DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:staging/libs py.test -v --timeout=60 --ignore=tmp-build --import-mode append ; fi
71-
- if [[ -z $CIBW_BEFORE_BUILD && $TRAVIS_OS_NAME == "linux" ]]; then LD_LIBRARY_PATH=$LD_LIBRARY_PATH:staging/libs py.test -v --timeout=60 --ignore=tmp-build --import-mode append ; fi
72-
- if [[ -n $TRAVIS_TAG && -n $CIBW_BEFORE_BUILD ]]; then cibuildwheel --output-dir wheelhouse1 && tools/fixup-wheels.sh wheelhouse1 wheelhouse ; fi
73-
- if [[ -n $TRAVIS_TAG && $TRAVIS_OS_NAME == linux && -n $CIBW_BEFORE_BUILD ]]; then tools/test-manylinux.sh ; fi
72+
- if [[ -z $CIBW_BEFORE_BUILD && $TRAVIS_OS_NAME == "osx" ]]; then DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:staging/libs py.test --timeout=60 --ignore=tmp-build --import-mode append; fi
73+
- if [[ -z $CIBW_BEFORE_BUILD && $TRAVIS_OS_NAME == "linux" ]]; then LD_LIBRARY_PATH=$LD_LIBRARY_PATH:staging/libs py.test --timeout=60 --ignore=tmp-build --import-mode append; fi
74+
- if [[ -n $TRAVIS_TAG && $TRAVIS_OS_NAME == linux && -n $CIBW_BEFORE_BUILD ]];then tools/test-manylinux.sh; fi
7475
- if [[ -n $TRAVIS_TAG && $TRAVIS_OS_NAME == osx && -n $CIBW_BEFORE_BUILD ]]; then tools/test-osx.sh; fi
75-
- if [[ $MK_DOCS == y ]]; then make docs ; fi
76+
- if [[ $MK_DOCS == y ]]; then make docs; fi
7677

7778
deploy:
7879
provider: s3

confluent_kafka/avro/requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
fastavro
2+
requests
3+
avro==1.9.2;python_version<='3.0'
4+
avro-python3==1.9.2.1;python_version>='3.0'

confluent_kafka/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
enum34;python_version<"3.4"
2+
futures;python_version<"3.2"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
fastavro>=0.23.0
2+
jsonschema
3+
protobuf
4+
requests

docs/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
sphinx
2+
sphinx-rtd-theme

examples/requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
confluent-kafka[examples]
2+
fastapi
3+
pydantic
4+
uvicorn
5+
six

setup.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,24 @@
55
from distutils.core import Extension
66
import platform
77

8-
INSTALL_REQUIRES = [
9-
'futures;python_version<"3.2"',
10-
'enum34;python_version<"3.4"',
11-
]
8+
work_dir = os.path.dirname(os.path.realpath(__file__))
9+
mod_dir = os.path.join(work_dir, 'confluent_kafka')
10+
ext_dir = os.path.join(mod_dir, 'src')
1211

13-
AVRO_REQUIRES = [
14-
'fastavro',
15-
'requests',
16-
'avro==1.9.2;python_version<"3.0"',
17-
'avro-python3==1.9.2.1;python_version>"3.0"'
18-
]
12+
with open(os.path.join(mod_dir, 'requirements.txt')) as f:
13+
INSTALL_REQUIRES = f.read().split()
1914

20-
TEST_REQUIRES = [
21-
'pytest==4.6.4;python_version<"3.0"',
22-
'pytest;python_version>="3.0"',
23-
'pytest-timeout',
24-
'trivup',
25-
'flake8'
26-
]
15+
with open(os.path.join(mod_dir, 'schema_registry', 'requirements.txt')) as f:
16+
INSTALL_REQUIRES += f.read().split()
17+
18+
with open(os.path.join(mod_dir, 'avro', 'requirements.txt')) as f:
19+
AVRO_REQUIRES = f.read().splitlines()
20+
21+
with open(os.path.join(work_dir, 'tests', 'requirements.txt')) as f:
22+
TEST_REQUIRES = f.read().splitlines()
23+
24+
with open(os.path.join(work_dir, 'docs', 'requirements.txt')) as f:
25+
DOC_REQUIRES = f.read().splitlines()
2726

2827
# On Un*x the library is linked as -lrdkafka,
2928
# while on windows we need the full librdkafka name.
@@ -34,12 +33,12 @@
3433

3534
module = Extension('confluent_kafka.cimpl',
3635
libraries=[librdkafka_libname],
37-
sources=['confluent_kafka/src/confluent_kafka.c',
38-
'confluent_kafka/src/Producer.c',
39-
'confluent_kafka/src/Consumer.c',
40-
'confluent_kafka/src/Metadata.c',
41-
'confluent_kafka/src/AdminTypes.c',
42-
'confluent_kafka/src/Admin.c'])
36+
sources=[os.path.join(ext_dir, 'confluent_kafka.c'),
37+
os.path.join(ext_dir, 'Producer.c'),
38+
os.path.join(ext_dir, 'Consumer.c'),
39+
os.path.join(ext_dir, 'Metadata.c'),
40+
os.path.join(ext_dir, 'AdminTypes.c'),
41+
os.path.join(ext_dir, 'Admin.c')])
4342

4443

4544
def get_install_requirements(path):
@@ -61,9 +60,10 @@ def get_install_requirements(path):
6160
url='https://github.com/confluentinc/confluent-kafka-python',
6261
ext_modules=[module],
6362
packages=find_packages(exclude=("tests", "tests.*")),
64-
data_files=[('', ['LICENSE.txt'])],
63+
data_files=[('', [os.path.join(work_dir, 'LICENSE.txt')])],
6564
install_requires=INSTALL_REQUIRES,
6665
extras_require={
6766
'avro': AVRO_REQUIRES,
68-
'dev': TEST_REQUIRES + AVRO_REQUIRES
67+
'dev': TEST_REQUIRES + AVRO_REQUIRES,
68+
'doc': DOC_REQUIRES + AVRO_REQUIRES
6969
})

tests/requirements.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
flake8
2+
pytest==4.6.9;python_version<="3.0"
3+
pytest;python_version>="3.0"
4+
pytest-timeout
5+
requests-mock
6+
trivup

tools/fixup-wheels.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ fixup_wheel () {
128128
build_patchelf () {
129129
# Download, build and install patchelf from source.
130130

131-
curl -l https://nixos.org/releases/patchelf/patchelf-0.9/patchelf-0.9.tar.gz | tar xzf -
131+
curl -l https://releases.nixos.org/patchelf/patchelf-0.9/patchelf-0.9.tar.gz | tar xzf -
132132
pushd patchelf-0.9
133133
./configure
134134
make -j

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy