Skip to content

Commit fea7154

Browse files
committed
Introduced pyproject.toml and moved static metadata from setup.py
1 parent a27d113 commit fea7154

File tree

17 files changed

+80
-103
lines changed

17 files changed

+80
-103
lines changed

DEVELOPER.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ This document provides information useful to developers working on confluent-kaf
55

66
## Build
77

8-
$ python setup.py build
8+
$ python -m build
99

1010
If librdkafka is installed in a non-standard location provide the include and library directories with:
1111

12-
$ C_INCLUDE_PATH=/path/to/include LIBRARY_PATH=/path/to/lib python setup.py ...
12+
$ C_INCLUDE_PATH=/path/to/include LIBRARY_PATH=/path/to/lib python -m build
1313

1414
**Note**: On Windows the variables for Visual Studio are named INCLUDE and LIB
1515

LICENSE.txt renamed to LICENSE

File renamed without changes.

MANIFEST.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
include README.md
2-
include LICENSE.txt
3-
include test-requirements.txt
42
include src/confluent_kafka/src/*.[ch]
3+
prune tests
4+
prune docs

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ all:
66

77
clean:
88
python setup.py clean
9+
rm -rf dist
910
make -C docs clean
1011

1112
.PHONY: docs

examples/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ need to have a C compiler and librdkafka installed
4242
```
4343
$ python3 -m venv venv_examples
4444
$ source venv_examples/bin/activate
45-
$ python setup.py develop
45+
$ rm -rf dist
46+
$ python -m build
47+
$ pip install -e dist/confluent_kafka*whl
4648
$ cd examples
4749
$ pip install -r requirements.txt
4850
```

examples/docker/Dockerfile.alpine

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,10 @@ RUN \
7373
mkdir -p /usr/src/confluent-kafka-python && \
7474
cd /usr/src/confluent-kafka-python && \
7575
rm -rf build && \
76-
python3 setup.py clean -a && \
77-
python3 setup.py build && \
78-
python3 setup.py install && \
76+
rm -rf dist && \
77+
python3 -m pip install build \
78+
python3 -m build && \
79+
python3 -m pip install dist/confluent_kafka*whl && \
7980
cd / && \
8081
rm -rf /usr/src/confluent-kafka-python
8182

pyproject.toml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[build-system]
2+
requires = [ "setuptools>=62", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "confluent-kafka"
7+
version = "2.1.1"
8+
description = "\"Confluent's Python client for Apache Kafka\""
9+
classifiers = [
10+
"Development Status :: 5 - Production/Stable",
11+
"Intended Audience :: Developers",
12+
"License :: OSI Approved :: Apache Software License",
13+
"Programming Language :: Python",
14+
"Programming Language :: Python :: 3",
15+
"Topic :: Software Development :: Libraries :: Python Modules"]
16+
dependencies = [ "futures;python_version<\"3.2\"", "enum34;python_version<\"3.4\"",]
17+
readme = "README.md"
18+
license = { file = "LICENSE" }
19+
requires-python = ">=3.7"
20+
21+
[[project.authors]]
22+
name = "\"Confluent Inc\""
23+
email = "support@confluent.io"
24+
25+
[project.urls]
26+
Homepage = "https://github.com/confluentinc/confluent-kafka-python"
27+
28+
[project.optional-dependencies]
29+
schema-registry = [ "requests",]
30+
avro = [ "fastavro>=0.23.0,<1.0;python_version<\"3.0\"", "fastavro>=1.0;python_version>\"3.0\"", "avro>=1.11.1,<2", "requests",]
31+
json = [ "pyrsistent==0.16.1;python_version<\"3.0\"", "pyrsistent;python_version>\"3.0\"", "jsonschema", "requests",]
32+
protobuf = [ "protobuf", "requests",]
33+
dev = [ "pytest==4.6.4;python_version<\"3.0\"", "pytest;python_version>=\"3.0\"", "pytest-timeout", "flake8", "fastavro>=0.23.0,<1.0;python_version<\"3.0\"", "fastavro>=1.0;python_version>\"3.0\"", "avro>=1.11.1,<2", "requests",]
34+
doc = [ "sphinx", "sphinx-rtd-theme", "fastavro>=0.23.0,<1.0;python_version<\"3.0\"", "fastavro>=1.0;python_version>\"3.0\"", "avro>=1.11.1,<2", "requests",]
35+
36+
[tool.setuptools]
37+
include-package-data = false

setup.py

Lines changed: 3 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,13 @@
11
#!/usr/bin/env python
22

33
import os
4-
from setuptools import setup, find_packages
4+
from setuptools import setup
55
from distutils.core import Extension
66
import platform
77

8-
work_dir = os.path.dirname(os.path.realpath(__file__))
9-
mod_dir = os.path.join(work_dir, 'src', 'confluent_kafka')
8+
mod_dir = os.path.join('src', 'confluent_kafka')
109
ext_dir = os.path.join(mod_dir, 'src')
1110

12-
INSTALL_REQUIRES = [
13-
'futures;python_version<"3.2"',
14-
'enum34;python_version<"3.4"',
15-
]
16-
17-
TEST_REQUIRES = [
18-
'pytest==4.6.4;python_version<"3.0"',
19-
'pytest;python_version>="3.0"',
20-
'pytest-timeout',
21-
'flake8'
22-
]
23-
24-
DOC_REQUIRES = ['sphinx', 'sphinx-rtd-theme']
25-
26-
SCHEMA_REGISTRY_REQUIRES = ['requests']
27-
28-
AVRO_REQUIRES = ['fastavro>=0.23.0,<1.0;python_version<"3.0"',
29-
'fastavro>=1.0;python_version>"3.0"',
30-
'avro>=1.11.1,<2',
31-
] + SCHEMA_REGISTRY_REQUIRES
32-
33-
JSON_REQUIRES = ['pyrsistent==0.16.1;python_version<"3.0"',
34-
'pyrsistent;python_version>"3.0"',
35-
'jsonschema'] + SCHEMA_REGISTRY_REQUIRES
36-
37-
PROTO_REQUIRES = ['protobuf'] + SCHEMA_REGISTRY_REQUIRES
38-
3911
# On Un*x the library is linked as -lrdkafka,
4012
# while on windows we need the full librdkafka name.
4113
if platform.system() == 'Windows':
@@ -52,45 +24,4 @@
5224
os.path.join(ext_dir, 'AdminTypes.c'),
5325
os.path.join(ext_dir, 'Admin.c')])
5426

55-
56-
def get_install_requirements(path):
57-
content = open(os.path.join(os.path.dirname(__file__), path)).read()
58-
return [
59-
req
60-
for req in content.split("\n")
61-
if req != '' and not req.startswith('#')
62-
]
63-
64-
65-
trove_classifiers = [
66-
'Development Status :: 5 - Production/Stable',
67-
'Intended Audience :: Developers',
68-
'License :: OSI Approved :: Apache Software License',
69-
'Programming Language :: Python',
70-
'Programming Language :: Python :: 2.7',
71-
'Programming Language :: Python :: 3',
72-
'Topic :: Software Development :: Libraries :: Python Modules',
73-
]
74-
75-
setup(name='confluent-kafka',
76-
# Make sure to bump CFL_VERSION* in confluent_kafka/src/confluent_kafka.h
77-
# and version in docs/conf.py.
78-
version='2.3.0',
79-
description='Confluent\'s Python client for Apache Kafka',
80-
author='Confluent Inc',
81-
author_email='support@confluent.io',
82-
url='https://github.com/confluentinc/confluent-kafka-python',
83-
ext_modules=[module],
84-
packages=find_packages('src'),
85-
package_dir={'': 'src'},
86-
data_files=[('', [os.path.join(work_dir, 'LICENSE.txt')])],
87-
install_requires=INSTALL_REQUIRES,
88-
classifiers=trove_classifiers,
89-
extras_require={
90-
'schema-registry': SCHEMA_REGISTRY_REQUIRES,
91-
'avro': AVRO_REQUIRES,
92-
'json': JSON_REQUIRES,
93-
'protobuf': PROTO_REQUIRES,
94-
'dev': TEST_REQUIRES + AVRO_REQUIRES,
95-
'doc': DOC_REQUIRES + AVRO_REQUIRES
96-
})
27+
setup(ext_modules=[module])

src/confluent_kafka/src/confluent_kafka.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737

3838
/**
39-
* @brief confluent-kafka-python version, must match that of setup.py.
39+
* @brief confluent-kafka-python version, must match that of pyproject.toml.
4040
*
4141
* Hex version representation:
4242
* 0xMMmmRRPP

tests/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ A python3 env suitable for running tests:
1919
$ python3 -m venv venv_test
2020
$ source venv_test/bin/activate
2121
$ pip install -r tests/requirements.txt
22-
$ python setup.py build
23-
$ python setup.py install
22+
$ python3 -m pip install .
2423

2524
When you're finished with it:
2625

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