Skip to content

Commit 5a166be

Browse files
mkoeppemmghannam
andauthored
Modernize Python metadata (#791)
* src/pyscipopt/_version.py: New, single-source the version from here * pyproject.toml: Move metadata here from setup.py --------- Co-authored-by: Mohammed Ghannam <mohammad.m.ghannam@gmail.com>
1 parent e838781 commit 5a166be

File tree

5 files changed

+36
-31
lines changed

5 files changed

+36
-31
lines changed

pyproject.toml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,37 @@
11
[build-system]
22
requires = ['setuptools', 'cython >=0.21']
33
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "PySCIPOpt"
7+
description = "Python interface and modeling environment for SCIP"
8+
authors = [
9+
{name = "Zuse Institute Berlin", email = "scip@zib.de"},
10+
]
11+
dependencies = []
12+
requires-python = ">=3.8"
13+
readme = "README.md"
14+
license = {text = "MIT"}
15+
classifiers = [
16+
"Development Status :: 4 - Beta",
17+
"Intended Audience :: Education",
18+
"Intended Audience :: Science/Research",
19+
"License :: OSI Approved :: MIT License",
20+
"Programming Language :: Cython",
21+
"Programming Language :: Python :: 3",
22+
"Topic :: Scientific/Engineering :: Mathematics",
23+
]
24+
dynamic = ["version"]
25+
26+
[project.urls]
27+
Homepage = "https://github.com/SCIP-Interfaces/PySCIPOpt"
28+
29+
[tool.pytest.ini_options]
30+
norecursedirs = ["check"]
31+
testpaths = ["tests"]
32+
33+
[tool.setuptools]
34+
include-package-data = false
35+
36+
[tool.setuptools.dynamic]
37+
version = {attr = "pyscipopt._version.__version__"}

setup.cfg

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
1-
[tool:pytest]
2-
norecursedirs = check
3-
testpaths = tests
4-
51
[bdist_wheel]
62
universal = 1

setup.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,6 @@
6969

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

72-
with open(os.path.join(packagedir, "__init__.py"), "r") as initfile:
73-
version = re.search(
74-
r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', initfile.read(), re.MULTILINE
75-
).group(1)
76-
7772
try:
7873
from Cython.Build import cythonize
7974
except ImportError as err:
@@ -106,28 +101,7 @@
106101
if use_cython:
107102
extensions = cythonize(extensions, compiler_directives={"language_level": 3, "linetrace": on_github_actions})
108103

109-
with open("README.md") as f:
110-
long_description = f.read()
111-
112104
setup(
113-
name="PySCIPOpt",
114-
version=version,
115-
description="Python interface and modeling environment for SCIP",
116-
long_description=long_description,
117-
long_description_content_type="text/markdown",
118-
url="https://github.com/SCIP-Interfaces/PySCIPOpt",
119-
author="Zuse Institute Berlin",
120-
author_email="scip@zib.de",
121-
license="MIT",
122-
classifiers=[
123-
"Development Status :: 4 - Beta",
124-
"Intended Audience :: Science/Research",
125-
"Intended Audience :: Education",
126-
"License :: OSI Approved :: MIT License",
127-
"Programming Language :: Python :: 3",
128-
"Programming Language :: Cython",
129-
"Topic :: Scientific/Engineering :: Mathematics",
130-
],
131105
ext_modules=extensions,
132106
packages=["pyscipopt"],
133107
package_dir={"pyscipopt": packagedir},

src/pyscipopt/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = '4.4.0'
1+
from ._version import __version__
22

33
# required for Python 3.8 on Windows
44
import os

src/pyscipopt/_version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = '4.4.0'

0 commit comments

Comments
 (0)