Skip to content
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

Use pyproject for everything but cython #8

Merged
merged 6 commits into from
Mar 16, 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: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ pip install -e .[dev]

> Only for maintainers

bump the version in both `setup.py` and `__init__.py` (unless you later
setup auto versioning), and commit it. Then create an annotated tag with:
Bump the version in `__init__.py` and commit it.

Then create an annotated tag with:

```bash
git tag -a vX.Y.Z -m "vX.Y.Z"
Expand Down
27 changes: 27 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,30 @@
[build-system]
requires = ["setuptools", "Cython"]
build-backend = "setuptools.build_meta"

# https://peps.python.org/pep-0621/
[project]
name = "ilpy"
description = "Python wrappers for popular MIP solvers."
requires-python = ">=3.8"
license = { text = "MIT" }
authors = [{ email = "funkej@janelia.hhmi.org", name = "Jan Funke" }]
dynamic = ["version", "readme"]
dependencies = []

# extras
# https://peps.python.org/pep-0621/#dependencies-optional-dependencies
[project.optional-dependencies]
dev = ["flake8", "pytest", "pytest-cov"]

[project.urls]
homepage = "https://github.com/funkelab/ilpy"
repository = "https://github.com/funkelab/ilpy"

[tool.setuptools]
packages = ["ilpy"]
package-data = { "ilpy" = ["py.typed", "*.pyi"] }

[tool.setuptools.dynamic]
version = { attr = "ilpy.__version__" }
readme = { file = ["README.md"] }
43 changes: 12 additions & 31 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from setuptools.extension import Extension

libraries = ["libscip"] if os.name == "nt" else ["scip"]
include_dirs = ['ilpy/impl']
include_dirs = ["ilpy/impl"]
library_dirs = []
compile_args = ["-O3", "-std=c++11", "-DHAVE_SCIP"]

Expand All @@ -21,7 +21,7 @@
# look for various gurobi versions, which are annoyingly
# suffixed with the version number, and wildcards don't work
for v in ["100"]:
GUROBI_LIB = f"libgurobi{v}" if os.name == 'nt' else f"gurobi{v}"
GUROBI_LIB = f"libgurobi{v}" if os.name == "nt" else f"gurobi{v}"
if (gurolib := util.find_library(GUROBI_LIB)) is not None:
print("FOUND GUROBI library: ", gurolib)
libraries.append(GUROBI_LIB)
Expand All @@ -31,33 +31,14 @@
print("WARNING: GUROBI library not found")


setup(
name='ilpy',
version='0.2.3',
description='Python wrappers for popular MIP solvers.',
url='https://github.com/funkelab/ilpy',
author='Jan Funke',
author_email='funkej@janelia.hhmi.org',
license='MIT',
packages=[
'ilpy'
],
ext_modules=cythonize([
Extension(
'ilpy.wrapper',
sources=[
'ilpy/wrapper.pyx',
],
extra_compile_args=compile_args,
include_dirs=include_dirs,
libraries=libraries,
library_dirs=library_dirs,
language='c++')
]),
extras_require={
"dev": ["flake8", "pytest", "pytest-cov"],
},
package_data={
"ilpy": ["py.typed", "*.pyi"]
},
wrapper = Extension(
"ilpy.wrapper",
sources=["ilpy/wrapper.pyx"],
extra_compile_args=compile_args,
include_dirs=include_dirs,
libraries=libraries,
library_dirs=library_dirs,
language="c++",
)

setup(ext_modules=cythonize([wrapper]))