Skip to content

Commit 8be21af

Browse files
committed
Switch to new packaging structure
1 parent 219c4bb commit 8be21af

7 files changed

Lines changed: 165 additions & 111 deletions

File tree

.envs/testenv-linux.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ dependencies:
1010
- pytest # dev, tests
1111
- pytest-cov # tests
1212
- pytest-xdist # dev, tests
13-
- optimagic>=0.5.0 # run, tests
13+
- pytest-timeout # dev, tests
14+
- joblib # run, tests
1415
- numba # run, tests
16+
- optimagic>=0.5.0 # tests
1517
- numpy>=1.17.0 # run, tests
1618
- pandas # run, tests
1719
- plotly # run, tests

.envs/testenv-others.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ dependencies:
99
- pytest # dev, tests
1010
- pytest-cov # tests
1111
- pytest-xdist # dev, tests
12-
- optimagic>=0.5.0 # run, tests
12+
- pytest-timeout # dev, tests
13+
- joblib # run, tests
1314
- numba # run, tests
15+
- optimagic>=0.5.0 # tests
1416
- numpy>=1.17.0 # run, tests
1517
- pandas # run, tests
1618
- plotly # run, tests

environment.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ channels:
66
dependencies:
77
- python=3.10 # dev
88
- jupyterlab # dev, docs
9-
- nb_black # dev, docs
10-
- pdbpp # dev
119
- pip # dev, tests, docs
1210
- pytest # dev, tests
1311
- pytest-cov # tests
1412
- pytest-xdist # dev, tests
15-
- setuptools_scm # dev
13+
- pytest-timeout # dev, tests
14+
- hatch # dev
1615
- toml # dev
17-
- optimagic>=0.5.0 # run, tests
16+
- joblib # run, tests
1817
- numba # run, tests
18+
- optimagic>=0.5.0 # tests
1919
- numpy>=1.17.0 # run, tests
2020
- pandas # run, tests
2121
- plotly # run, tests
@@ -27,8 +27,7 @@ dependencies:
2727
- sphinx-panels # docs
2828
- sphinxcontrib-bibtex # docs
2929
- pip: # dev, tests, docs
30-
- black # dev
31-
- blackcellmagic # dev
3230
- kaleido # dev, tests
3331
- pre-commit # dev
32+
- pdbp # dev
3433
- -e . # dev

pyproject.toml

Lines changed: 147 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,164 @@
1+
# ======================================================================================
2+
# Project metadata
3+
# ======================================================================================
4+
[project]
5+
name = "tranquilo"
6+
description = "Trust-region optimizer for scalar, least-square and noisy problems."
7+
requires-python = ">=3.10"
8+
dependencies = [
9+
"joblib",
10+
"numba",
11+
"numpy>=1.17.0",
12+
"pandas",
13+
"scipy>=1.2.1",
14+
]
15+
dynamic = ["version"]
16+
keywords = [
17+
"optimization",
18+
"dfo",
19+
"derivative free optimization",
20+
"noisy optimization",
21+
"parallel optimization",
22+
"numerical optimization",
23+
"trust region",
24+
]
25+
classifiers = [
26+
"Development Status :: 3 - Alpha",
27+
"Intended Audience :: Science/Research",
28+
"License :: OSI Approved :: MIT License",
29+
"Operating System :: MacOS :: MacOS X",
30+
"Operating System :: Microsoft :: Windows",
31+
"Operating System :: POSIX",
32+
"Programming Language :: Python :: 3",
33+
"Programming Language :: Python :: 3.10",
34+
"Programming Language :: Python :: 3.11",
35+
"Programming Language :: Python :: 3.12",
36+
"Programming Language :: Python :: 3.13",
37+
"Topic :: Scientific/Engineering",
38+
]
39+
authors = [
40+
{ name = "Janos Gabler", email = "janos.gabler@gmail.com" },
41+
]
42+
maintainers = [
43+
{ name = "Janos Gabler", email = "janos.gabler@gmail.com" },
44+
{ name = "Tim Mensinger", email = "mensingertim@gmail.com" },
45+
]
46+
47+
[project.readme]
48+
file = "README.md"
49+
content-type = "text/markdown"
50+
51+
[project.license]
52+
text = "MIT"
53+
54+
[project.urls]
55+
Repository = "https://github.com/OpenSourceEconomics/tranquilo"
56+
Github = "https://github.com/OpenSourceEconomics/tranquilo"
57+
Tracker = "https://github.com/OpenSourceEconomics/tranquilo/issues"
58+
59+
[project.optional-dependencies]
60+
plotly = ["plotly"]
61+
62+
63+
# ======================================================================================
64+
# Build system configuration
65+
# ======================================================================================
166
[build-system]
2-
requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.0"]
3-
build-backend = "setuptools.build_meta"
67+
requires = ["hatchling", "hatch_vcs"]
68+
build-backend = "hatchling.build"
69+
70+
[tool.hatch.build.hooks.vcs]
71+
version-file = "src/tranquilo/_version.py"
72+
73+
[tool.hatch.build.targets.sdist]
74+
exclude = ["tests"]
75+
only-packages = true
476

77+
[tool.hatch.build.targets.wheel]
78+
only-include = ["src"]
79+
sources = ["src"]
580

6-
[tool.setuptools_scm]
7-
write_to = "src/tranquilo/_version.py"
81+
[tool.hatch.version]
82+
source = "vcs"
883

84+
[tool.hatch.metadata]
85+
allow-direct-references = true
986

87+
88+
# ======================================================================================
89+
# Ruff configuration
90+
# ======================================================================================
1091
[tool.ruff]
11-
target-version = "py37"
92+
target-version = "py310"
1293
fix = true
1394

95+
[tool.ruff.lint]
1496
select = [
15-
# pyflakes
16-
"F",
17-
# pycodestyle
18-
"E",
19-
"W",
20-
# flake8-2020
21-
"YTT",
22-
# flake8-bugbear
23-
"B",
24-
# flake8-quotes
25-
"Q",
26-
# pylint
27-
"PLE", "PLR", "PLW",
28-
# misc lints
29-
"PIE",
30-
# tidy imports
31-
"TID",
32-
# implicit string concatenation
33-
"ISC",
97+
# isort
98+
"I",
99+
# pyflakes
100+
"F",
101+
# pycodestyle
102+
"E",
103+
"W",
104+
# flake8-2020
105+
"YTT",
106+
# flake8-bugbear
107+
"B",
108+
# flake8-quotes
109+
"Q",
110+
# pylint
111+
"PLE",
112+
"PLR",
113+
"PLW",
114+
# misc lints
115+
"PIE",
116+
# tidy imports
117+
"TID",
118+
# implicit string concatenation
119+
"ISC",
34120
]
35121

36122
extend-ignore = [
37-
38-
# allow module import not at top of file, important for notebooks
39-
"E402",
40-
# do not assign a lambda expression, use a def
41-
"E731",
42-
# Too many arguments to function call
43-
"PLR0913",
44-
# Too many returns
45-
"PLR0911",
46-
# Too many branches
47-
"PLR0912",
48-
# Too many statements
49-
"PLR0915",
50-
# Magic number
51-
"PLR2004",
52-
# Consider `elif` instead of `else` then `if` to remove indentation level
53-
"PLR5501",
54-
# For calls to warnings.warn(): No explicit `stacklevel` keyword argument found
55-
"B028",
123+
# allow module import not at top of file, important for notebooks
124+
"E402",
125+
# do not assign a lambda expression, use a def
126+
"E731",
127+
# Too many arguments to function call
128+
"PLR0913",
129+
# Too many returns
130+
"PLR0911",
131+
# Too many branches
132+
"PLR0912",
133+
# Too many statements
134+
"PLR0915",
135+
# Magic number
136+
"PLR2004",
137+
# Consider `elif` instead of `else` then `if` to remove indentation level
138+
"PLR5501",
139+
# For calls to warnings.warn(): No explicit `stacklevel` keyword argument found
140+
"B028",
141+
# Incompatible with formatting
142+
"ISC001",
56143
]
57144

58-
[tool.ruff.per-file-ignores]
145+
[tool.ruff.lint.per-file-ignores]
59146
"docs/source/conf.py" = ["E501", "ERA001", "DTZ005"]
60147
"docs/source/*" = ["B018"]
61148

62-
[tool.ruff.pydocstyle]
149+
[tool.ruff.lint.pydocstyle]
63150
convention = "google"
64151

65-
[tool.nbqa.config]
66-
black = "pyproject.toml"
67-
68-
[tool.nbqa.mutate]
69-
black = 1
70152

153+
# ======================================================================================
154+
# Pytest configuration
155+
# ======================================================================================
71156
[tool.pytest.ini_options]
72157
filterwarnings = [
73-
"ignore:delta_grad == 0.0", # UserWarning in test_poisedness.py
74-
"ignore:Jupyter is migrating", # DeprecationWarning from jupyter client
158+
"ignore:delta_grad == 0.0",
159+
"ignore:Jupyter is migrating",
75160
"ignore:Noisy scalar functions are experimental",
161+
"ignore:Parallelization together with",
76162
]
77163
markers = [
78164
"wip: Tests that are work-in-progress.",
@@ -81,6 +167,15 @@ markers = [
81167
norecursedirs = ["docs", ".envs"]
82168

83169

170+
# ======================================================================================
171+
# Misc configuration
172+
# ======================================================================================
173+
[tool.nbqa.config]
174+
black = "pyproject.toml"
175+
176+
[tool.nbqa.mutate]
177+
black = 1
178+
84179
[tool.yamlfix]
85180
line_length = 88
86181
sequence_style = "block_style"

setup.cfg

Lines changed: 0 additions & 47 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/tranquilo/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
try:
2+
from ._version import version as __version__
3+
except ImportError:
4+
# package is not installed
5+
__version__ = "unknown"
6+
7+
__all__ = ["__version__"]

0 commit comments

Comments
 (0)