Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyproject.toml #1

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
4 changes: 0 additions & 4 deletions python/google/__init__.py

This file was deleted.

43 changes: 43 additions & 0 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[build-system]
requires = ["packaging", "setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "protobuf"
description = "Protocol Buffers are Google's data interchange format"
readme = "README.md"
requires-python = ">=3.8"
maintainers= [
{ email = "protobuf@googlegroups.com" }
]
license = { text = "BSD-3-Clause" }
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"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",
"Programming Language :: Python :: 3.12"
]
dependencies = [
"numpy<=1.26.1",
"setuptools<=68.2.2"
]
dynamic = ["version"]

[project.urls]
homepage = "https://developers.google.com/protocol-buffers/"
repository = "https://github.com/protocolbuffers/protobuf"
download = "https://github.com/protocolbuffers/protobuf/releases"

[tool.setuptools.dynamic]
version = { attr = "google.protobuf.__init__.__version__" }

[tool.setuptools.packages.find]
include = ["../src/google/protobuf.*"]
exclude = [
"import_test_package",
"protobuf_distutils"
]
2 changes: 0 additions & 2 deletions python/requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions python/setup.cfg

This file was deleted.

59 changes: 4 additions & 55 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import fnmatch
import glob
import os
import pkg_resources
import re
import shutil
import subprocess
Expand All @@ -23,10 +22,11 @@
# pylint:disable=g-importing-member
# pylint:disable=g-multiple-import

from setuptools import setup, Extension, find_packages

from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext as _build_ext
from setuptools.command.build_py import build_py as _build_py
from packaging import version


# Find the Protocol Compiler.
if 'PROTOC' in os.environ and os.path.exists(os.environ['PROTOC']):
Expand All @@ -47,21 +47,6 @@
protoc = shutil.which('protoc')


def GetVersion():
"""Reads and returns the version from google/protobuf/__init__.py.

Do not import google.protobuf.__init__ directly, because an installed
protobuf library may be loaded instead.

Returns:
The version.
"""

with open(os.path.join('google', 'protobuf', '__init__.py')) as version_file:
exec(version_file.read(), globals()) # pylint:disable=exec-used
return __version__ # pylint:disable=undefined-variable


def GenProto(source, require=True):
"""Generates a _pb2.py from the given .proto file.

Expand Down Expand Up @@ -339,8 +324,7 @@ def HasLibraryDirsOpt():
# deployment target of macOS 10.9 or later, or iOS 7 or later.
if sys.platform == 'darwin':
mac_target = str(sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET'))
if mac_target and (pkg_resources.parse_version(mac_target) <
pkg_resources.parse_version('10.9.0')):
if mac_target and (version.parse(mac_target) < version.parse('10.9.0')):
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.9'
os.environ['_PYTHON_HOST_PLATFORM'] = re.sub(
r'macosx-[0-9]+\.[0-9]+-(.+)',
Expand Down Expand Up @@ -389,47 +373,12 @@ def HasLibraryDirsOpt():
])
os.environ['PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION'] = 'cpp'

install_requires = []

setup(
name='protobuf',
version=GetVersion(),
description='Protocol Buffers',
download_url='https://github.com/protocolbuffers/protobuf/releases',
long_description="Protocol Buffers are Google's data interchange format",
url='https://developers.google.com/protocol-buffers/',
project_urls={
'Source': 'https://github.com/protocolbuffers/protobuf',
},
maintainer='protobuf@googlegroups.com',
maintainer_email='protobuf@googlegroups.com',
license='BSD-3-Clause',
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 3',
# LINT.IfChange
# Remove importlib fallback path when we drop Python 3.8 support.
'Programming Language :: Python :: 3.8',
# LINT.ThenChange(//depot/google3/google/protobuf/internal/test_util.py)
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
],
namespace_packages=['google'],
packages=find_packages(
exclude=[
'import_test_package',
'protobuf_distutils',
],
),
test_suite='google.protobuf.internal',
cmdclass={
'build_py': BuildPyCmd,
'build_ext': BuildExtCmd,
'test_conformance': TestConformanceCmd,
},
install_requires=install_requires,
ext_modules=ext_module_list,
python_requires='>=3.8',
)
Loading