Skip to content

PYTHON-2965 Migrate to a PEP517 compliant build system #1252

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

Merged
merged 8 commits into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .evergreen/build-mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ PYTHON=/Library/Frameworks/Python.framework/Versions/$VERSION/bin/python3
rm -rf build

createvirtualenv $PYTHON releasevenv
python -m pip install --upgrade wheel
python -m pip install setuptools==63.2.0
python setup.py bdist_wheel
python -m pip install build
python -m build --wheel .
deactivate || true
rm -rf releasevenv

Expand Down
3 changes: 2 additions & 1 deletion .evergreen/build-manylinux-internal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ for PYTHON in /opt/python/*/bin/python; do
fi
# https://github.com/pypa/manylinux/issues/49
rm -rf build
$PYTHON setup.py bdist_wheel
$PYTHON -m pip install build
$PYTHON -m build --wheel .
rm -rf build

# Audit wheels and write manylinux tag
Expand Down
3 changes: 2 additions & 1 deletion .evergreen/build-windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ for VERSION in 37 38 39 310 311; do
"C:/Python/32/Python${VERSION}/python.exe")
for PYTHON in "${_pythons[@]}"; do
rm -rf build
$PYTHON setup.py bdist_wheel
$PYTHON -m pip install build
$PYTHON -m build --wheel .

# Test that each wheel is installable.
for release in dist/*; do
Expand Down
3 changes: 2 additions & 1 deletion .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,8 @@ functions:
done
# Build source distribution.
cd src/
/opt/python/3.7/bin/python3 setup.py sdist
/opt/python/3.7/bin/python3 -m pip install build
/opt/python/3.7/bin/python3 -m build --sdist .
cp dist/* ../releases
- command: archive.targz_pack
params:
Expand Down
4 changes: 2 additions & 2 deletions .evergreen/run-doctests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
set -o xtrace
set -o errexit

${PYTHON_BINARY} setup.py clean
${PYTHON_BINARY} setup.py doc -t
${PYTHON_BINARY} -m pip install tox
${PYTHON_BINARY} -m tox -e doc-test
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Or ``easy_install`` from

You can also download the project source and do::

$ python setup.py install
$ pip install .

Do **not** install the "bson" package from pypi. PyMongo comes with its own
bson package; doing "easy_install bson" installs a third-party package that
Expand Down
2 changes: 1 addition & 1 deletion RELEASE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Doing a Release
To test locally, ``python3 setup.py test`` will build the C extensions and
test. ``python3 tools/clean.py`` will remove the extensions,
and then ``python3 setup.py --no_ext test`` will run the tests without
them. You can also run the doctests: ``python3 setup.py doc -t``.
them. You can also run the doctests: ``tox -e doc-test``.

2. Check Jira to ensure all the tickets in this version have been completed.

Expand Down
3 changes: 2 additions & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ following command from the root directory of the **PyMongo** source:

.. code-block:: bash

$ python setup.py doc
$ pip install tox
$ tox -e docs

Indices and tables
------------------
Expand Down
4 changes: 2 additions & 2 deletions doc/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ latest source from GitHub and install the driver from the resulting tree::

$ git clone https://github.com/mongodb/mongo-python-driver.git pymongo
$ cd pymongo/
$ python3 setup.py install
$ pip install .

Installing from source on Unix
..............................
Expand Down Expand Up @@ -186,7 +186,7 @@ If you wish to install PyMongo without the C extensions, even if the
extensions build properly, it can be done using a command line option to
*setup.py*::

$ python3 setup.py --no_ext install
$ NO_EXT=1 python -m pip install .

Installing a beta or release candidate
--------------------------------------
Expand Down
93 changes: 93 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
[build-system]
requires = ["setuptools>=63.0"]
build-backend = "setuptools.build_meta"

[project]
name = "pymongo"
dynamic = ["version"]
description = "Python driver for MongoDB <http://www.mongodb.org>"
readme = "README.rst"
license = {file="LICENSE"}
requires-python = ">=3.7"
authors = [
{ name = "The MongoDB Python Team" },
]
keywords = [
"bson",
"gridfs",
"mongo",
"mongodb",
"pymongo",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"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",
"Topic :: Database",
"Typing :: Typed",
]
dependencies = [
"dnspython>=1.16.0,<3.0.0",
]

[project.optional-dependencies]
aws = [
"pymongo-auth-aws<2.0.0",
]
encryption = [
"pymongo[aws]",
"pymongocrypt>=1.6.0,<2.0.0",
]
gssapi = [
"pykerberos;os.name!='nt'",
"winkerberos>=0.5.0;os.name=='nt'"
]
# PyOpenSSL 17.0.0 introduced support for OCSP. 17.1.0 introduced
# a related feature we need. 17.2.0 fixes a bug
# in set_default_verify_paths we should really avoid.
# service_identity 18.1.0 introduced support for IP addr matching.
# Fallback to certifi on Windows if we can't load CA certs from the system
# store and just use certifi on macOS.
# https://www.pyopenssl.org/en/stable/api/ssl.html#OpenSSL.SSL.Context.set_default_verify_paths
ocsp = [
"certifi;os.name=='nt' or sys_platform=='darwin'",
"pyopenssl>=17.2.0",
"requests<3.0.0",
"service_identity>=18.1.0",
]
snappy = [
"python-snappy",
]
# PYTHON-3423 Removed in 4.3 but kept here to avoid pip warnings.
srv = []
tls = []
# PYTHON-2133 Removed in 4.0 but kept here to avoid pip warnings.
zstd = [
"zstandard",
]

[project.urls]
Homepage = "http://github.com/mongodb/mongo-python-driver"

[tool.setuptools.dynamic]
version = {attr = "pymongo._version.__version__"}

[tool.setuptools.packages.find]
include = ["bson","gridfs", "pymongo"]

[tool.setuptools.package-data]
bson=["py.typed", "*.pyi"]
pymongo=["py.typed", "*.pyi"]
gridfs=["py.typed", "*.pyi"]
Loading