Skip to content

Commit d0c7d91

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

File tree

3 files changed

+43
-9
lines changed

3 files changed

+43
-9
lines changed

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+
Homepage = "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)