Skip to content

Commit 1d9ce61

Browse files
committed
build: clean up setuptools code
1 parent f0fa008 commit 1d9ce61

File tree

4 files changed

+10
-36
lines changed

4 files changed

+10
-36
lines changed

Apptainer.def

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Stage: runtime
2020

2121
%files
2222
./pyproject.toml /pysr/pyproject.toml
23-
./setup.py /pysr/setup.py
23+
./LICENSE /pysr/LICENSE
2424
./pysr /pysr/pysr
2525

2626
%post

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ WORKDIR /pysr
2020
# Install PySR:
2121
# We do a minimal copy so it doesn't need to rerun at every file change:
2222
ADD ./pyproject.toml /pysr/pyproject.toml
23-
ADD ./setup.py /pysr/setup.py
23+
ADD ./LICENSE /pysr/LICENSE
2424
ADD ./pysr /pysr/pysr
2525
RUN pip3 install --no-cache-dir .
2626

pysr/__init__.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
# old libraries:
2020
from .julia_import import jl, SymbolicRegression # isort:skip
2121

22+
# Get the version using importlib.metadata (Python >= 3.8 is required):
23+
from importlib.metadata import PackageNotFoundError, version
24+
2225
from . import sklearn_monkeypatch
2326
from .deprecated import best, best_callable, best_row, best_tex, install, pysr
2427
from .export_jax import sympy2jax
@@ -33,8 +36,11 @@
3336
from .logger_specs import AbstractLoggerSpec, TensorBoardLoggerSpec
3437
from .sr import PySRRegressor
3538

36-
# This file is created by setuptools_scm during the build process:
37-
from .version import __version__
39+
try:
40+
__version__ = version("pysr")
41+
except PackageNotFoundError: # pragma: no cover
42+
# package is not installed
43+
__version__ = "unknown"
3844

3945
__all__ = [
4046
"jl",

setup.py

-32
This file was deleted.

0 commit comments

Comments
 (0)