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

Install setup requirements on-the-fly #101

Merged
merged 14 commits into from
Mar 11, 2021
25 changes: 18 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@

from setuptools import setup
from setuptools.extension import Extension

# install requirements before import
from setuptools import dist
SETUP_REQUIRES = [
"cython >= 0.26",
"numpy >= 1.15",
]
dist.Distribution().fetch_build_eggs(SETUP_REQUIRES)

from Cython.Distutils import build_ext
import numpy as np

Expand All @@ -41,12 +50,13 @@
AUTHOR = "Matthias Kümmerer"
EMAIL = "[email protected]"
URL = "https://github.com/matthias-k/cyipopt"
DEPENDENCIES = ["numpy>=1.15",
"cython>=0.26",
"future>=0.15",
"setuptools>=39.0",
"six>=1.11"
]
INSTALL_REQUIRES = [
"numpy>=1.15",
"cython>=0.26",
"future>=0.15",
"setuptools>=39.0",
"six>=1.11",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is likely that cython and setuptools are not needed to run the library. We'd need to double check.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Cython could be removed here, but not necessarily numpy. Shouldn't setuptools be a build dep then too? I don't see it used anywhere but setup.py.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true ... I did not want to meddle too much with the build, but certainly possible that cython/numpy can be removed under install_requires (here I did not change those dependencies at all).

setuptools should technically be a build dep too, however I guess that would only work via pyproject.toml or setup.cfg, as setup.py is completely based on setuptools. afaik, it is usually pre-installed on python distros.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood. The file requires an import of setuptools itself, so it has to be pre-installed. We can leave this as is.

]
LICENSE = "EPL-1.0"
CLASSIFIERS = [
"Development Status :: 4 - Beta",
Expand Down Expand Up @@ -195,7 +205,8 @@ def handle_ext_modules_general_os():
license=LICENSE,
classifiers=CLASSIFIERS,
packages=[PACKAGE_NAME, DEPRECATED_PACKAGE_NAME],
install_requires=DEPENDENCIES,
setup_requires=SETUP_REQUIRES,
install_requires=INSTALL_REQUIRES,
include_package_data=include_package_data,
data_files=DATA_FILES,
zip_safe=False, # required for Py27 on Windows to work
Expand Down