Skip to content

Commit

Permalink
Add pyproject.toml (#471)
Browse files Browse the repository at this point in the history
* WIP: Add pyproject.toml and move config.

* WIP: Rm setuptools and wheel from CI env.

* Update minimum Python version in pyproject.

* CI: update macports recipe for pep517.

* Fix author spec in pyproject.toml.

* DOC: rm extraneous quotes from macports recipe.
  • Loading branch information
rossbar committed Dec 28, 2023
1 parent a74b8e1 commit c88c1e7
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 102 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:

- name: Install packages
run: |
pip install --upgrade pip wheel setuptools
pip install --upgrade pip
pip install -r requirements/test.txt
pip install .
pip list
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:

- name: Install packages
run: |
pip install --upgrade pip wheel setuptools
pip install --upgrade pip
pip install -r requirements/test.txt
pip install .
pip list
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:

- name: Install packages
run: |
pip install --upgrade pip wheel setuptools
pip install --upgrade pip
pip install -r requirements/test.txt
pip install .
pip list
Expand Down Expand Up @@ -144,11 +144,12 @@ jobs:

- name: Install packages
run: |
pip install --upgrade pip wheel setuptools
pip install --upgrade pip setuptools
pip install -r requirements/test.txt
pip install --global-option=build_ext \
--global-option="-I/opt/local/include/" \
--global-option="-L/opt/local/lib/" \
pip install --use-pep517 \
--config-settings="--global-option=build_ext" \
--config-settings="--global-option=-I/opt/local/include/" \
--config-settings="--global-option=-L/opt/local/lib/" \
.
pip list
Expand Down Expand Up @@ -189,7 +190,7 @@ jobs:
# We need ``python -m pip install -U pip`` b/c Windows won't modify running programs.
- name: Install packages
run: |
python -m pip install --upgrade pip wheel setuptools
python -m pip install --upgrade pip
python -m pip install -r requirements/test.txt
python -m pip install --use-pep517 `
--config-settings="--global-option=build_ext" `
Expand Down
4 changes: 2 additions & 2 deletions INSTALL.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ MacPorts
$ pip install pygraphviz
$ pip install --use-pep517 \
--config-settings="--global-option=build_ext" \
--config-settings="--global-option="-I/opt/local/include/" \
--config-settings="--global-option="-L/opt/local/lib/" \
--config-settings="--global-option=-I/opt/local/include/" \
--config-settings="--global-option=-L/opt/local/lib/" \
pygraphviz

Advanced
Expand Down
58 changes: 58 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[build-system]
build-backend = 'setuptools.build_meta'
requires = ['setuptools>=61.2']

[project]
name = "pygraphviz"
authors = [
{name = "Aric Hagberg", email = "aric.hagberg@gmail.com"},
{name = "Dan Schult", email = "dschult@colgate.edu"},
{name = "Manos Renieris"},
]
description = "Python interface to Graphviz"
readme = "README.rst"
requires-python = ">=3.10"
license = {text = "BSD-3-Clause"}
dynamic = ["version"]
keywords = [
"Networks",
"Graph Visualization",
"network",
"graph",
"graph drawing",
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Programming Language :: C",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Scientific/Engineering :: Information Analysis",
"Topic :: Scientific/Engineering :: Mathematics",
"Topic :: Scientific/Engineering :: Visualization",
]

[project.urls]
Homepage = "https://pygraphviz.github.io"
"Bug Tracker" = "https://github.com/pygraphviz/pygraphviz/issues/"
Documentation = "https://pygraphviz.github.io/documentation/stable/"
"Source Code" = "https://github.com/pygraphviz/pygraphviz/"
Download = "https://pypi.python.org/pypi/pygraphviz"

[tool.setuptools]
packages = ["pygraphviz", "pygraphviz.tests"]
platforms = ["Linux", "Mac OSX", "Windows"]

[tool.setuptools.package-data]
#"" = ["*.txt"]

[tool.setuptools.dynamic.version]
attr = "pygraphviz.__version__"
95 changes: 3 additions & 92 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,83 +1,15 @@
from glob import glob
import os
import sys
from setuptools import setup, Extension

if sys.version_info[:2] < (3, 10):
error = (
"PyGraphviz requires Python version 3.10 or later (%d.%d detected)."
% sys.version_info[:2]
)
sys.stderr.write(error + "\n")
sys.exit(-1)


name = "pygraphviz"
description = "Python interface to Graphviz"

with open("README.rst") as fh:
long_description = fh.read()

license = "BSD"
authors = {
"Hagberg": ("Aric Hagberg", "aric.hagberg@gmail.com"),
"Schult": ("Dan Schult", "dschult@colgate.edu"),
"Renieris": ("Manos Renieris", ""),
}
url = "http://pygraphviz.github.io"
project_urls = {
"Documentation": "https://pygraphviz.github.io/documentation/stable/",
"Source": "https://github.com/pygraphviz/pygraphviz",
}
download_url = "https://pypi.python.org/pypi/pygraphviz"
platforms = ["Linux", "Mac OSX", "Microsoft :: Windows"]
keywords = ["Networks", "Graph Visualization", "network", "graph", "graph drawing"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Programming Language :: C",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Scientific/Engineering :: Information Analysis",
"Topic :: Scientific/Engineering :: Mathematics",
"Topic :: Scientific/Engineering :: Visualization",
]

with open("pygraphviz/__init__.py") as fid:
for line in fid:
if line.startswith("__version__"):
version = line.strip().split()[-1][1:-1]
break

packages = ["pygraphviz", "pygraphviz.tests"]
docdirbase = f"share/doc/pygraphviz-{version}"
data = [
(docdirbase, glob("*.txt")),
(os.path.join(docdirbase, "examples"), glob("examples/*.py")),
(os.path.join(docdirbase, "examples"), glob("examples/*.dat")),
(os.path.join(docdirbase, "examples"), glob("examples/*.dat.gz")),
]
package_data = {
"": ["*.txt"],
}

if __name__ == "__main__":
define_macros = [("SWIG_PYTHON_STRICT_BYTE_CHAR", None)]
if sys.platform == "win32":
define_macros.append(("GVDLL", None))

extension = [
Extension(
"pygraphviz._graphviz",
["pygraphviz/graphviz_wrap.c"],
name="pygraphviz._graphviz",
sources=["pygraphviz/graphviz_wrap.c"],
include_dirs=[],
library_dirs=[],
# cdt does not link to cgraph, whereas cgraph links to cdt.
Expand All @@ -91,25 +23,4 @@
)
]

setup(
name=name,
version=version,
author=authors["Hagberg"][0],
author_email=authors["Hagberg"][1],
description=description,
keywords=keywords,
long_description=long_description,
license=license,
platforms=platforms,
url=url,
project_urls=project_urls,
download_url=download_url,
classifiers=classifiers,
packages=packages,
data_files=data,
ext_modules=extension,
package_data=package_data,
include_package_data=True,
python_requires=">=3.10",
tests_require=["pytest"],
)
setup(ext_modules=extension)

0 comments on commit c88c1e7

Please sign in to comment.