Skip to content

Commit d4fe2aa

Browse files
committed
Make numba optional dependecy and update build system
1 parent e8eea8b commit d4fe2aa

File tree

4 files changed

+45
-11
lines changed

4 files changed

+45
-11
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ The supported levels - from least to most verbose - are: `ERROR`, `WARN`, `INFO`
161161
162162
## Contributing
163163
164-
Contributions are welcome. If you want to contribute, please follow the [Contribution guidelines](CONTRIBUTING.md).
164+
Contributions are welcome. If you want to contribute, please follow the [Contribution guidelines](https://github.com/cms-patatrack/The-Optimizer/blob/main/CONTRIBUTING.md).
165165
166166
## License
167167
168-
The Optimizer is distributed under the [MPL 2.0 License](LICENSE). Feel free to use, modify, and distribute the code following the terms of the license.
168+
The Optimizer is distributed under the [MPL 2.0 License](https://github.com/cms-patatrack/The-Optimizer/blob/main/LICENSE). Feel free to use, modify, and distribute the code following the terms of the license.

optimizer/util.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,16 @@
44
import logging
55
import pickle
66
import numpy as np
7-
from numba import njit
7+
8+
# If numba is installed import it and use njit decorator otherwise use a dummy decorator
9+
try:
10+
from numba import njit
11+
except ImportError:
12+
def njit(*args, **kwargs):
13+
def dummy_decorator(func):
14+
return func
15+
return dummy_decorator
16+
817

918

1019
class CustomFormatter(logging.Formatter):

pyproject.toml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[build-system]
2+
requires = ["setuptools>=64", "setuptools-scm>=8", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "TheOptimizer"
7+
dynamic = ["version"]
8+
dependencies = [
9+
"scikit-learn",
10+
"numpy",
11+
"matplotlib",
12+
"pandas"
13+
]
14+
readme = "README.md"
15+
description = "A optimization library for multi-objective optimization problems."
16+
classifiers = [
17+
"Programming Language :: Python :: 3",
18+
"Operating System :: OS Independent",
19+
"License :: OSI Approved :: MIT License",
20+
]
21+
22+
[project.optional-dependencies]
23+
numba = ["numba"]
24+
25+
[project.urls]
26+
"Source Code" = "https://github.com/cms-patatrack/The-Optimizer"
27+
"Issues" = "https://github.com/cms-patatrack/The-Optimizer/issues"
28+
29+
30+
[tool.setuptools.packages.find]
31+
where = ["optimizer", "optimizer.mopso"]
32+
33+
[tool.setuptools_scm]

setup.py

-8
This file was deleted.

0 commit comments

Comments
 (0)