You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+20-48Lines changed: 20 additions & 48 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,7 +70,7 @@ You have a cool idea, but do not know know if it fits with Code Carbon? You can
70
70
<!-- TOC --><aname="installation"></a>
71
71
### Installation
72
72
73
-
CodeCarbon is a Python package, to contribute to it, you need to have Python installed on your machine, natively or with [Conda](https://docs.conda.io/projects/conda/en/latest/user-guide/install/).
73
+
CodeCarbon is a Python package, to contribute to it, you need to have Python installed on your machine, natively or with [Conda](https://docs.conda.io/projects/conda/en/latest/user-guide/install/), or better, faster, stronger with [UV](https://github.com/astral-sh/uv).
74
74
75
75
Between April 2024 and July 2025 we use Hatch for managing development environment. Since August 2025 we use UV manages the environments, Python versions, and dependencies - it's a fast, reliable way to work with Python projects.
76
76
@@ -87,19 +87,8 @@ Then, clone the repository and create the environment with:
87
87
```sh
88
88
git clone https://github.com/mlco2/codecarbon.git
89
89
cd codecarbon
90
-
uv venv
91
-
uv pip install -e .
92
-
uv pip install -e ".[dev,test]"
93
-
```
94
-
95
-
To activate the virtual environment:
96
-
97
-
```sh
98
-
# On Linux/macOS
99
-
source .venv/bin/activate
100
-
101
-
# On Windows
102
-
.venv\Scripts\activate
90
+
uv sync
91
+
uv run task pre-commit-install
103
92
```
104
93
105
94
<!-- TOC --><aname="some-uv-commands"></a>
@@ -108,20 +97,12 @@ source .venv/bin/activate
108
97
UV simplifies Python package management with fast, reliable commands:
You can run the unit tests by running UV in the terminal when in the root package directory:
131
112
132
113
```sh
133
-
uv run test
134
-
```
135
-
136
-
To run integration tests:
137
-
138
-
```sh
139
-
uv run test-integ
114
+
uv run task test-package
140
115
```
141
116
142
117
You can also run a specific test:
143
118
144
119
```sh
145
-
uv run pytest tests/test_cloud.py
146
-
147
-
# or
148
-
149
120
uv run python -m unittest tests.test_your_feature.YourTestCase.test_function
150
121
```
151
122
@@ -308,15 +279,16 @@ to regenerate the html files.
308
279
<!-- TOC --><aname="release-process"></a>
309
280
### Release process
310
281
311
-
- Merge all PRs.
312
-
- Create a PR bumping the version with `uv run bumpver update --patch`. For a release candidate, use `uv run bumpver update --set-version 3.0.0_rc1`.
313
-
- Run `uv run python3 .github/check_version.py` to check version consistancy.
314
-
- Update the dependencies with `uv pip compile requirements.in -o requirements.txt`.
315
-
-[Build Documentation](#documentation) if needed with `uv run docs`.
316
-
- Push the changes.
317
-
- Merge the PR.
318
-
- Wait for the Github Action `ReleaseDrafter` to finish running on the merge commit.
319
-
-[Edit the Draft release](https://github.com/mlco2/codecarbon/releases/) on Github and give it a tag, `v1.0.0` for the version 1.0.0. Github will automatically create a Git tag for it. Complete help [here](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository).
282
+
- Merge all PRs.
283
+
- Create a PR bumping the version with `uv run bumpver update --patch`. For a release candidate, use `uv run bumpver update --set-version 3.0.0_rc1`.
284
+
- Run `uv run python3 .github/check_version.py` to check version consistancy.
285
+
- Update the dependencies with `uv sync --upgrade`
286
+
- Export a requirements.txt `uv pip freeze > requirements.txt`.
287
+
-[Build Documentation](#documentation) with `uv run --only-group doc task docs`.
288
+
- Push the changes.
289
+
- Merge the PR.
290
+
- Wait for the Github Action `ReleaseDrafter` to finish running on the merge commit.
291
+
-[Edit the Draft release](https://github.com/mlco2/codecarbon/releases/) on Github and give it a tag, `v1.0.0` for the version 1.0.0. Github will automatically create a Git tag for it. Complete help [here](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository).
320
292
- A [Github Action](https://github.com/mlco2/codecarbon/actions)_Upload Python Package_ will be run automaticaly to upload the package.
321
293
- For conda, we now have a [feedstock](https://github.com/conda-forge/codecarbon-feedstock/pulls) to publish to Conda-Forge channel.
0 commit comments