diff --git a/README.md b/README.md index 6b56f33..f0973dd 100644 --- a/README.md +++ b/README.md @@ -57,22 +57,3 @@ To use this solver (backend) with [`MixedIntegerLinearProgram`](http://doc.sagem sage: M.get_backend() -Setting it as the default backend for `MixedIntegerLinearProgram`, as of SageMath 9.0.beta10, requires some trickery: - - sage: import sage_numerical_backends_coin.coin_backend as coin_backend, sage.numerical.backends as backends, sys - sage: sys.modules['sage.numerical.backends.coin_backend'] = backends.coin_backend = coin_backend - sage: default_mip_solver('Coin') - -To patch this in permanently (at your own risk): - - $ sage -c 'import os; import sage.numerical.backends as dm; import sage_numerical_backends_coin.coin_backend as sm; s = sm.__file__; f = os.path.basename(s); d = os.path.join(dm.__path__[0], f); (os.path.exists(d) or os.path.lexists(d)) and os.remove(d); os.symlink(s, d);' - -Or use the script [`patch_into_sage_module.py`](patch_into_sage_module.py) in the source distribution that does the same: - - $ sage -c 'load("patch_into_sage_module.py")' - Success: Patched in the module as sage.numerical.backends.coin_backend - -Verify with [`check_get_solver_with_name.py`](check_get_solver_with_name.py) that the patching script has worked: - - $ sage -c 'load("check_get_solver_with_name.py")' - Success: get_solver(solver='coin') gives diff --git a/check_get_solver_with_name.py b/check_get_solver_with_name.py index 1ecf193..8d4f717 100644 --- a/check_get_solver_with_name.py +++ b/check_get_solver_with_name.py @@ -1,7 +1,7 @@ from __future__ import print_function # Check that the backend can be obtained by passing solver='coin' to get_solver. from sage.numerical.backends.generic_backend import get_solver -from sage_numerical_backends_coin.coin_backend import CoinBackend +from sage.numerical.backends.coin_backend import CoinBackend b = get_solver(solver='coin') assert type(b) == CoinBackend, "get_solver(solver='coin') does not give an instance of sage_numerical_backends_coin.coin_backend.CoinBackend" print("Success: get_solver(solver='coin') gives {}".format(b)) diff --git a/sage_numerical_backends_coin/coin_backend.pxd b/sage/numerical/backends/coin_backend.pxd similarity index 100% rename from sage_numerical_backends_coin/coin_backend.pxd rename to sage/numerical/backends/coin_backend.pxd diff --git a/sage_numerical_backends_coin/coin_backend.pyx b/sage/numerical/backends/coin_backend.pyx similarity index 100% rename from sage_numerical_backends_coin/coin_backend.pyx rename to sage/numerical/backends/coin_backend.pyx diff --git a/sage_numerical_backends_coin/__init__.py b/sage_numerical_backends_coin/__init__.py deleted file mode 100644 index ffeb2db..0000000 --- a/sage_numerical_backends_coin/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# not an empty file diff --git a/setup.py b/setup.py index 176e75e..6dcffe2 100755 --- a/setup.py +++ b/setup.py @@ -44,8 +44,8 @@ def readfile(filename): cbc_include_dirs = cbc_pc['include_dirs'] -ext_modules = [Extension('sage_numerical_backends_coin.coin_backend', - sources=[os.path.join('sage_numerical_backends_coin', +ext_modules = [Extension('sage.numerical.backends.coin_backend', + sources=[os.path.join('sage/numerical/backends', 'coin_backend.pyx')], libraries=cbc_libs, include_dirs=sage_include_directories() + cbc_include_dirs, @@ -81,7 +81,7 @@ def readfile(filename): print("Using compile_time_env: {}".format(compile_time_env), file=sys.stderr) setup( - name="sage_numerical_backends_coin", + name="sage.numerical.backends.coin_backend", version=readfile("VERSION").strip(), description="COIN-OR backend for Sage MixedIntegerLinearProgram", long_description = readfile("README.md"), # get the long description from the README @@ -109,9 +109,8 @@ def readfile(filename): compile_time_env=compile_time_env), cmdclass = {'test': SageTest}, # adding a special setup command for tests keywords=['milp', 'linear-programming', 'optimization'], - packages=['sage_numerical_backends_coin'], - package_dir={'sage_numerical_backends_coin': 'sage_numerical_backends_coin'}, - package_data={'sage_numerical_backends_coin': ['*.pxd']}, + packages=['sage.numerical.backends'], + package_data={'sage.numerical.backends': ['*.pxd']}, install_requires = [# 'sage>=8', ### On too many distributions, sage is actually not known as a pip package 'sphinx'], setup_requires = ['pkgconfig'],