Skip to content

Commit

Permalink
PROTON-2815: [Python] Use modern tooling to build python packages
Browse files Browse the repository at this point in the history
Also add license text to a bunch of Python files
  • Loading branch information
astitcher committed Apr 17, 2024
1 parent cafa64a commit 84570ec
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 79 deletions.
12 changes: 3 additions & 9 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -149,19 +149,13 @@ add_custom_command(OUTPUT ./tox.ini
# Make python source and binary packages if we have prerequisites
check_python_module("setuptools" SETUPTOOLS_MODULE_FOUND)
check_python_module("wheel" WHEEL_MODULE_FOUND)
check_python_module("build" BUILD_MODULE_FOUND)
check_python_module("cffi" CFFI_MODULE_FOUND)
if (SETUPTOOLS_MODULE_FOUND)
set (pydist_cmds sdist)
if (WHEEL_MODULE_FOUND AND CFFI_MODULE_FOUND)
set (pydist_cmds sdist bdist_wheel --py-limited-api=cp38)
endif()
endif()

if (pydist_cmds)
if (BUILD_MODULE_FOUND AND SETUPTOOLS_MODULE_FOUND AND WHEEL_MODULE_FOUND AND CFFI_MODULE_FOUND)
add_custom_command(OUTPUT .timestamp.dist
DEPENDS pysrc_copied
COMMAND ${CMAKE_COMMAND} -E remove -f .timestamp.dist
COMMAND ${Python_EXECUTABLE} setup.py ${pydist_cmds}
COMMAND ${Python_EXECUTABLE} -m build -n
COMMAND ${CMAKE_COMMAND} -E touch .timestamp.dist)
add_custom_target(pydist ALL DEPENDS .timestamp.dist)
endif ()
Expand Down
18 changes: 18 additions & 0 deletions python/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

include VERSION.txt
include ext_build.py
include cproton.h
Expand Down
97 changes: 57 additions & 40 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,44 +1,61 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

[build-system]
requires = ["setuptools", "cffi>=1.0.0"]
build-backend = "setuptools.build_meta"

# Commented out for present because support is beta in setuptools so we should just use setup.cfg
#[project]
#name = "python-qpid-proton"
#description = "An AMQP based messaging library."
#readme = "README.rst"
#license = {text = "Apache Software License"}
#classifiers = [
# "License :: OSI Approved :: Apache Software License",
# "Intended Audience :: Developers",
# "Programming Language :: Python",
# "Programming Language :: Python :: 3",
# "Programming Language :: Python :: 3 :: Only",
# "Programming Language :: Python :: 3.6",
# "Programming Language :: Python :: 3.7",
# "Programming Language :: Python :: 3.8",
# "Programming Language :: Python :: 3.9",
# "Programming Language :: Python :: 3.10",
# "Programming Language :: Python :: 3.11"
#]
#dependencies = [
# "cffi>=1.0.0"
#]
#authors = [
# {name = "Apache Qpid", email = "[email protected]"}
#]
#dynamic = ["version"]
#
#[project.urls]
#homepage = "http://qpid.apache.org/proton/"
#
#[project.optional-dependencies]
#opentracing = ["opentracing", "jaeger_client"]
#
#[tool.setuptools]
#packages = ["proton"]
#py-modules = ["cproton"]
## cffi-modules = "ext_build.py:ffibuilder"
#
#[tool.setuptools.dynamic]
#version = {file = "VERSION.txt"}
[project]
name = "python-qpid-proton"
description = "An AMQP based messaging library."
readme = "README.rst"
license = {text = "Apache Software License"}
classifiers = [
"License :: OSI Approved :: Apache Software License",
"Intended Audience :: Developers",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11"
]
dependencies = [
"cffi>=1.0.0"
]
authors = [
{name = "Apache Qpid", email = "[email protected]"}
]
dynamic = ["version"]

[project.urls]
homepage = "http://qpid.apache.org/proton/"

[project.optional-dependencies]
opentracing = ["opentracing", "jaeger_client"]

[tool.setuptools]
packages = ["proton"]
py-modules = ["cproton"]
# cffi-modules = "ext_build.py:ffibuilder"

[tool.setuptools.dynamic]
version = {file = "VERSION.txt"}
46 changes: 18 additions & 28 deletions python/setup.cfg
Original file line number Diff line number Diff line change
@@ -1,31 +1,21 @@
[metadata]
name = python-qpid-proton
version = file: VERSION.txt
description = An AMQP based messaging library.
long_description = file: README.rst
author = Apache Qpid
author_email = [email protected]
url = http://qpid.apache.org/proton/
license = Apache Software License
classifiers =
License :: OSI Approved :: Apache Software License
Intended Audience :: Developers
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12

[options]
packages = proton
py_modules = cproton
setup_requires = cffi>=1.0.0
install_requires = cffi>=1.0.0

[options.extras_require]
opentracing = opentracing; jaeger_client
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# Only here to configure flake8
[flake8]
max-line-length = 125
2 changes: 0 additions & 2 deletions python/setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
Expand All @@ -17,7 +16,6 @@
# specific language governing permissions and limitations
# under the License.


from setuptools import setup

setup(
Expand Down

0 comments on commit 84570ec

Please sign in to comment.