Skip to content

Commit

Permalink
Apply PEP621 (#388)
Browse files Browse the repository at this point in the history
PEP 621 (https://peps.python.org/pep-0621/) defines using the `pyproject.toml` file to store project metadata in the [project] table. This has several advantages over using `setup.cfg` or `setup.py` to store the project metadata, namely:

* consolidates metadata and configuration into one file; `pyproject.toml` is required by PEP 517 (https://peps.python.org/pep-0517/) and many third party tools use it to store their configuration
* allows alternate build tools other than `setuptools` (such as hatch or meson) to read the same project metadata
  • Loading branch information
zacharyburnett authored Nov 7, 2024
1 parent ca1f341 commit 0fb1b8a
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 28 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ Mike Playle <mike@mythik.co.uk>
Phil Elson <pelson.pub@gmail.com>
Robert Coup <robert.coup@koordinates.com>
Tiago Brito <tiago.brito@90poe.io>
Zachary Burnett <zachary.r.burnett@gmail.com>
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,23 +205,22 @@ even 2.0.
Python 3 is required.

### Creating wheels
First, make a virtual environment and install `cmake_build_extension` and `wheel`
into it:
First, make a virtual environment and install `build` into it:
```
python3 -m venv venv
source venv/bin/activate
pip install cmake_build_extension wheel
pip install build
```

Then build the wheel:
```
python setup.py bdist_wheel
python -m build
```

The resulting wheel will be in the `dist` directory.

> If OpenSSL is in a non-standard location make sure to set `OPENSSL_ROOT_DIR`
> when calling `setup.py`, see above for more information.
> If OpenSSL is in a non-standard location make sure to set `OPENSSL_ROOT_DIR`;
> see above for more information.
## Other S2 implementations

Expand Down
50 changes: 50 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
[project]
name = "s2geometry"
description = "Computational geometry and spatial indexing on the sphere"
authors = [
{ name = "Dan Larkin-York", email = "dan@arangodb.com" },
{ name = "Eric Veach", email = "ericv@google.com" },
{ name = "Jesse Rosenstock", email = "jmr@google.com" },
{ name = "Julien Basch", email = "julienbasch@google.com" },
{ name = "Mike Playle", email = "mike@mythik.co.uk" },
{ name = "Phil Elson", email = "pelson.pub@gmail.com" },
{ name = "Robert Coup", email = "robert.coup@koordinates.com" },
{ name = "Tiago Brito", email = "tiago.brito@90poe.io" },
{ name = "Zachary Burnett", email = "zachary.r.burnett@gmail.com" },
]
requires-python = ">=3.7"
classifiers = [
"Programming Language :: Python :: 3",
"Operating System :: POSIX",
"License :: OSI Approved :: Apache Software License",
]
dynamic = [
"version",
]

[project.license]
file = "LICENSE"
content-type = "text/plain"

[project.urls]
Source = "https://github.com/google/s2geometry"

[project.optional-dependencies]
test = [
"pytest",
]

[build-system]
requires = [
"wheel",
Expand All @@ -6,3 +42,17 @@ requires = [
"cmake_build_extension",
]
build-backend = "setuptools.build_meta"

[tool.setuptools]
zip-safe = false
include-package-data = false

[tool.setuptools.packages.find]
where = [
"src",
]
namespaces = false

[tool.setuptools.package-dir]
"" = "src"

22 changes: 0 additions & 22 deletions setup.cfg

This file was deleted.

0 comments on commit 0fb1b8a

Please sign in to comment.