-
Notifications
You must be signed in to change notification settings - Fork 174
/
pyproject.toml
195 lines (171 loc) · 4.97 KB
/
pyproject.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "codecarbon"
dynamic = ["version"]
readme = "README.md"
requires-python = ">=3.7"
authors = [
{ name = "Mila" },
{ name = "DataForGood" },
{ name = "BCG GAMMA" },
{ name = "Comet.ml" },
{ name = "Haverford College" },
]
classifiers = [
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
dependencies = [
"arrow",
"click",
"fief-client[cli]",
"pandas",
"prometheus_client",
"psutil",
"py-cpuinfo",
"pynvml",
"rapidfuzz",
"requests",
"questionary",
"rich",
"typer"
]
[project.urls]
Homepage = "https://codecarbon.io/"
Repository = "https://github.com/mlco2/codecarbon"
Dashboard = "http://dashboard.codecarbon.io/"
Documentation = "https://mlco2.github.io/codecarbon/"
Issues = "https://github.com/mlco2/codecarbon/issues"
Changelog = "https://github.com/mlco2/codecarbon/releases"
[project.optional-dependencies]
viz = [
"dash",
"dash_bootstrap_components < 1.0.0",
"fire",
]
[project.scripts]
carbonboard = "codecarbon.viz.carbonboard:main"
codecarbon = "codecarbon.cli.main:codecarbon"
[tool.hatch.env]
requires = [
"hatch-pip-compile"
]
[tool.hatch.envs.default]
# pip-compile automate the export of environments.txt
type = "pip-compile"
[tool.hatch.envs.carbonboard]
features = ["viz"]
[tool.hatch.envs.carbonboard.scripts]
run = "carbonboard {args:.}"
[tool.hatch.envs.docs]
# detached means that other deps won't be installed
detached = true
dependencies = [
"sphinx",
"sphinx_rtd_theme",
]
pip-compile-constraint = ""
[tool.hatch.envs.dev]
dependencies = [
"bumpver",
"pre-commit",
"ruff",
"black",
"mypy",
]
[tool.hatch.envs.dev.scripts]
precommit-install = "pre-commit install"
precommit-update = "pre-commit autoupdate"
precommit = "pre-commit run --show-diff-on-failure --color=always --all-files"
mypy-check = "mypy -m codecarbon --ignore-missing-imports --no-strict-optional --disable-error-code attr-defined --disable-error-code assignment --disable-error-code misc"
lint = ["black --check --diff {args:.}", "ruff check {args:.}", "mypy {args:.}"]
format = ["black {args:.}", "ruff --fix --exit-non-zero-on-fix {args:.}"]
[tool.hatch.envs.test]
features = ["viz"]
dependencies = [
"mock",
"pytest",
"responses",
"numpy<2.0.0;python_version<'3.9'",
"numpy;python_version>='3.9'",
"psutil",
"requests-mock",
"rapidfuzz",
"importlib_resources;python_version<'3.9'"
]
[tool.hatch.envs.test.scripts]
package = 'CODECARBON_ALLOW_MULTIPLE_RUNS=True pytest -vv -m "not integ_test" tests/'
package-integ = 'CODECARBON_ALLOW_MULTIPLE_RUNS=True python -m pytest -vv tests/'
[[tool.hatch.envs.test.matrix]]
# Python 3.7 does not works with pip-tools, but CodeCarbon could run in 3.7
python = ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
[tool.hatch.envs.docs.scripts]
build = "cd docs/edit && make docs"
[tool.hatch.envs.dashboard]
dependencies = [
"dash>=2.2.0",
"dash_bootstrap_components",
"plotly>=5.6.0",
]
[tool.hatch.envs.dashboard.scripts]
run = "cd dashboard && python carbon_board_API.py"
[tool.hatch.envs.api]
python = "3.11"
dependencies = [
"alembic<2.0.0",
"bcrypt<5.0.0",
"python-dateutil<3.0.0",
"dependency-injector<5.0.0",
"fastapi<1.0.0",
"fief-client[fastapi]",
"httpx",
"pydantic[email]<2.0.0",
"psycopg2-binary<3.0.0",
"requests<3.0.0",
"sqlalchemy<2.0.0",
"uvicorn[standard]<1.0.0",
"fastapi-pagination==0.9.1",
"pytest",
"mock",
"pytest",
"responses",
"numpy",
"psutil",
"requests-mock",
"rapidfuzz",
"PyJWT",
]
[tool.hatch.envs.api.scripts]
local = "cd carbonserver && uvicorn main:app --reload"
server-ci = 'cd carbonserver && uvicorn main:app --host 0.0.0.0 --port 8008'
docker = "docker-compose up -d"
test-unit = 'cd carbonserver && python -m pytest -vv tests/api/routers/test_projects.py && python -m pytest -vv tests/api/service/ && python -m pytest -vv tests/api/usecase/'
test-integ = 'cd carbonserver && python -m pytest -vv tests/api/integration/'
setup-db = 'cd carbonserver && python3 -m alembic -c carbonserver/database/alembic.ini upgrade head'
# To downgrade the db and start from scratch
downgrade-db = 'cd carbonserver && python -m alembic -c carbonserver/database/alembic.ini downgrade base'
[tool.hatch.version]
path = "codecarbon/_version.py"
[tool.hatch.build.targets.sdist]
include = [
"/codecarbon",
]
[tool.bumpver]
current_version = "2.7.3"
version_pattern = "MAJOR.MINOR.PATCH"
[tool.bumpver.file_patterns]
"codecarbon/_version.py" = [
'^__version__ = "{version}"$',
]
"docs/edit/conf.py" = [
'^release = "{version}"$',
]