Skip to content

Commit

Permalink
Modernize Python metadata (#791)
Browse files Browse the repository at this point in the history
* src/pyscipopt/_version.py: New, single-source the version from here

* pyproject.toml: Move metadata here from setup.py

---------

Co-authored-by: Mohammed Ghannam <[email protected]>
  • Loading branch information
mkoeppe and mmghannam authored Feb 25, 2024
1 parent e838781 commit 5a166be
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 31 deletions.
34 changes: 34 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,37 @@
[build-system]
requires = ['setuptools', 'cython >=0.21']
build-backend = "setuptools.build_meta"

[project]
name = "PySCIPOpt"
description = "Python interface and modeling environment for SCIP"
authors = [
{name = "Zuse Institute Berlin", email = "[email protected]"},
]
dependencies = []
requires-python = ">=3.8"
readme = "README.md"
license = {text = "MIT"}
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Programming Language :: Cython",
"Programming Language :: Python :: 3",
"Topic :: Scientific/Engineering :: Mathematics",
]
dynamic = ["version"]

[project.urls]
Homepage = "https://github.com/SCIP-Interfaces/PySCIPOpt"

[tool.pytest.ini_options]
norecursedirs = ["check"]
testpaths = ["tests"]

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

[tool.setuptools.dynamic]
version = {attr = "pyscipopt._version.__version__"}
4 changes: 0 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
[tool:pytest]
norecursedirs = check
testpaths = tests

[bdist_wheel]
universal = 1
26 changes: 0 additions & 26 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@

packagedir = os.path.join("src", "pyscipopt")

with open(os.path.join(packagedir, "__init__.py"), "r") as initfile:
version = re.search(
r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', initfile.read(), re.MULTILINE
).group(1)

try:
from Cython.Build import cythonize
except ImportError as err:
Expand Down Expand Up @@ -106,28 +101,7 @@
if use_cython:
extensions = cythonize(extensions, compiler_directives={"language_level": 3, "linetrace": on_github_actions})

with open("README.md") as f:
long_description = f.read()

setup(
name="PySCIPOpt",
version=version,
description="Python interface and modeling environment for SCIP",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/SCIP-Interfaces/PySCIPOpt",
author="Zuse Institute Berlin",
author_email="[email protected]",
license="MIT",
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"Intended Audience :: Education",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Cython",
"Topic :: Scientific/Engineering :: Mathematics",
],
ext_modules=extensions,
packages=["pyscipopt"],
package_dir={"pyscipopt": packagedir},
Expand Down
2 changes: 1 addition & 1 deletion src/pyscipopt/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '4.4.0'
from ._version import __version__

# required for Python 3.8 on Windows
import os
Expand Down
1 change: 1 addition & 0 deletions src/pyscipopt/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '4.4.0'

0 comments on commit 5a166be

Please sign in to comment.