diff --git a/README.md b/README.md index ae8f08b..1d8fba0 100644 --- a/README.md +++ b/README.md @@ -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" diff --git a/pyproject.toml b/pyproject.toml index 056f67a..38fdfb8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"] } diff --git a/setup.py b/setup.py index a004cc9..3b3f496 100644 --- a/setup.py +++ b/setup.py @@ -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"] @@ -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) @@ -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]))