Skip to content

Commit cf0784e

Browse files
committed
Modernize / update build using uv
* Specify cpu / cuda extras to control which xgboost variant is installed
1 parent 1bca6c6 commit cf0784e

File tree

6 files changed

+2166
-52
lines changed

6 files changed

+2166
-52
lines changed

.github/workflows/publish_package.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,12 @@ jobs:
2020
- name: Install dependencies
2121
run: |
2222
python -m pip install --upgrade pip
23-
pip install build twine
23+
curl -sSL https://install.python-poetry.org | python3 -
2424
2525
- name: Build package
26-
run: python -m build
26+
run: poetry build
2727

2828
- name: Upload to PyPI
2929
env:
30-
TWINE_USERNAME: __token__
31-
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
32-
run: twine upload dist/*
33-
30+
POETRY_PYPI_TOKEN_POETRY: ${{ secrets.PYPI_API_TOKEN }}
31+
run: poetry publish

.github/workflows/tests.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ jobs:
2121
- name: Install dependencies
2222
run: |
2323
python -m pip install --upgrade pip
24-
pip install tox tox-gh-actions
24+
sudo apt-get update
25+
sudo apt-get install -y --no-install-recommends curl gcc
26+
curl -sSL https://install.python-poetry.org | python3 -
27+
export PATH="/root/.local/bin:$PATH"
28+
poetry install --extras cpu --with dev,github-ci
2529
- name: Test with tox
26-
run: tox
30+
run: poetry run tox

pyproject.toml

Lines changed: 40 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
[build-system]
2-
requires = ["setuptools>=61", "setuptools_scm>=7.0", "wheel"]
2+
requires = ["setuptools>=64", "setuptools-scm>=8"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "TPOT"
77
description = "Tree-based Pipeline Optimization Tool"
8+
dynamic = ["version"]
9+
# TODO: this doesn't seem to match code comments
10+
authors = [{ name = "Pedro Ribioro", email = "[email protected]" }]
811
readme = "README.md"
9-
requires-python = ">=3.10,<3.14"
10-
license = { text = "LGPL-3.0" }
11-
authors = [
12-
{ name = "Pedro Ribeiro" }
12+
classifiers=[
13+
"Intended Audience :: Science/Research",
14+
"Programming Language :: Python :: 3.10",
15+
"Programming Language :: Python :: 3.11",
16+
"Programming Language :: Python :: 3.12",
17+
"Programming Language :: Python :: 3.13",
18+
"Topic :: Scientific/Engineering :: Artificial Intelligence"
1319
]
1420
keywords = [
1521
"pipeline optimization",
@@ -19,42 +25,28 @@ keywords = [
1925
"genetic programming",
2026
"evolutionary computation"
2127
]
22-
classifiers = [
23-
"Intended Audience :: Science/Research",
24-
"Programming Language :: Python :: 3.10",
25-
"Programming Language :: Python :: 3.11",
26-
"Programming Language :: Python :: 3.12",
27-
"Programming Language :: Python :: 3.13",
28-
"Topic :: Scientific/Engineering :: Artificial Intelligence"
29-
]
28+
license = "LGPL-3.0-only"
29+
requires-python=">=3.10.0,<3.14.0"
30+
3031
dependencies = [
32+
"ConfigSpace>=1.1.1",
33+
"distributed>=2024.4.2",
34+
"func_timeout>=4.3.5",
35+
"joblib>=1.1.1",
36+
"lightgbm>=3.3.3",
37+
"networkx>=3.0",
38+
"nose",
3139
"numpy>=1.26.4",
32-
"scipy>=1.3.1",
40+
"pandas>=2.2.0",
3341
"scikit-learn>=1.6",
34-
"update_checker>=0.16",
35-
"tqdm>=4.36.1",
42+
"scipy>=1.3.1",
43+
# see [tool.uv.sources] below, upstream using deprecated pkg_resources
3644
"stopit>=1.1.1",
37-
"pandas>=2.2.0",
38-
"joblib>=1.1.1",
39-
"xgboost>=3.0.0",
40-
"matplotlib>=3.6.2",
45+
"tqdm>=4.36.1",
4146
"traitlets>=5.8.0",
42-
"lightgbm>=3.3.3",
43-
"optuna>=3.0.5",
44-
"networkx>=3.0",
45-
"dask>=2024.4.2",
46-
"distributed>=2024.4.2",
47-
"dask-expr>=1.0.12",
48-
"dask-jobqueue>=0.8.5",
49-
"func_timeout>=4.3.5",
50-
"configspace>=1.1.1",
51-
"dill>=0.3.9",
52-
"seaborn>=0.13.2",
5347
]
5448

55-
dynamic = ["version"]
56-
57-
[project.optional-dependencies]
49+
[dependency-groups]
5850
skrebate = ["skrebate>=0.3.4"]
5951
mdr = ["scikit-mdr>=0.4.4"]
6052
sklearnex = ["scikit-learn-intelex>=2023.2.1"]
@@ -66,9 +58,14 @@ testing = [
6658
"flake8>=3.9",
6759
"tox>=3.24"
6860
]
61+
cpu = ["xgboost-cpu (>=3.0) ; extra != 'cuda'"]
62+
cuda = ["xgboost (>=3.0) ; extra != 'cpu'"]
63+
nn = ["torch"]
64+
plot = ["matplotlib>=3.6.2"]
6965

7066
[project.urls]
71-
Homepage = "https://github.com/EpistasisLab/tpot"
67+
Repository = "https://github.com/EpistasisLab/tpot"
68+
Documentation = "https://epistasislab.github.io/tpot/"
7269

7370
[project.scripts]
7471
tpot = "tpot:main"
@@ -86,3 +83,11 @@ max-line-length = 120
8683
[tool.setuptools_scm]
8784
# setuptools_scm gets the version from Git tags, e.g git tag v1.1.0
8885
# then python -m build embeds the version into the package
86+
87+
[[tool.uv.index]]
88+
name = "pypi"
89+
url = "https://pypi.org/simple"
90+
publish-url = "https://upload.pypi.org/tpot/"
91+
92+
[tool.uv.sources]
93+
stopit = { git = "https://github.com/jikamens/stopit" }

tox.ini

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@ python =
1818
setenv =
1919
PYTHONPATH = {toxinidir}
2020
extras = testing
21-
deps =
22-
setuptools>=65.0.0
23-
commands =
24-
pytest --basetemp={envtmpdir}
21+
deps = setuptools>=65.0.0,uv
22+
commands = pytest --basetemp={envtmpdir}
2523

2624
[testenv:flake8]
2725
basepython = python3.10
@@ -31,6 +29,7 @@ commands = flake8 tpot
3129
[testenv:mypy]
3230
basepython = python3.10
3331
extras = testing
34-
deps =
35-
setuptools>=65.0.0
32+
deps = setuptools>=65.0.0,uv
33+
commands_pre =
34+
uv sync --with cpu,dev,github-ci
3635
commands = mypy tpot

tpot/__init__.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
#TODO: are all the imports in the init files done correctly?
3838
#TODO clean up import organization
3939

40+
import warnings
41+
4042
from .individual import BaseIndividual
4143

4244
from .graphsklearn import GraphPipeline
@@ -54,6 +56,15 @@
5456

5557
from .tpot_estimator import TPOTClassifier, TPOTRegressor, TPOTEstimator, TPOTEstimatorSteadyState
5658

57-
from update_checker import update_check
58-
from ._version import __version__
59-
update_check("tpot",__version__)
59+
# Optionally import update_checker and use it to noisily complain if this isn't exactly the latest
60+
# TPOT release.
61+
try:
62+
from update_checker import update_check
63+
from ._version import __version__
64+
update_check("tpot",__version__)
65+
except ImportError:
66+
warnings.warn(
67+
ImportWarning(
68+
"Optional update_check import is missing. Recency of TPOT version won't be checked."
69+
)
70+
)

0 commit comments

Comments
 (0)