diff --git a/.conda/recipe.yaml b/.conda/recipe.yaml
deleted file mode 100644
index 84f3835a4..000000000
--- a/.conda/recipe.yaml
+++ /dev/null
@@ -1,47 +0,0 @@
-###############################################################################
-## To build Conda package for Anaconda.org
-## We use the `rattler-build` tool to build the package, see README.md
-## rattler-build build --channel codecarbon --channel conda-forge --recipe .conda --output-dir /tmp/rattler
-###############################################################################
-schema_version: 1
-
-package:
- name: codecarbon
- version: X.X.X # Will be replaced by the version from the pyproject.toml file
-
-source:
- path: ..
-
-build:
- noarch: python
- number: 0
- string: py37_plus
- script: python -m pip install --no-deps --ignore-installed .
- python:
- entry_points:
- - codecarbon = codecarbon.cli.main:codecarbon
-
-requirements:
- host:
- - python
- - pip
- - setuptools
- - wheel
- run:
- # Will be replaced by the dependencies from the pyproject.toml file
- - dependencies
-
-tests:
- - python:
- imports:
- - codecarbon
- pip_check: true
-
-about:
- homepage: https://codecarbon.io
- license: MIT
- summary: 'CodeCarbon emissions tracker'
- description: |
- CodeCarbon is a Python package for tracking the carbon emissions produced by various kinds of computer programs, from straightforward algorithms to deep neural networks.
-
- By taking into account your computing infrastructure, location, usage and running time, CodeCarbon can provide an estimate of how much CO2 you produced, and give you some comparisons with common modes of transporation to give you an order of magnitude.
diff --git a/.conda/variants.yaml b/.conda/variants.yaml
deleted file mode 100644
index ba2b4a882..000000000
--- a/.conda/variants.yaml
+++ /dev/null
@@ -1,8 +0,0 @@
-python:
-- "3.7"
-- "3.8"
-- "3.9"
-- "3.10"
-- "3.11"
-- "3.12"
-- "3.13"
diff --git a/.github/pyproject_versions.py b/.github/pyproject_versions.py
index 19c67ed83..73f4474da 100644
--- a/.github/pyproject_versions.py
+++ b/.github/pyproject_versions.py
@@ -1,4 +1,4 @@
-# Read package version in pyproject.toml and replace it in .conda/recipe.yaml
+# Read package version in pyproject.toml
# Also provides version coherence checking across multiple files
import argparse
@@ -132,48 +132,10 @@ def get_versions():
}
-def replace_in_file(filepath: str, info: dict):
- """
- ::filepath:: Path to recipe.yaml, with filename
- ::info:: Dict with information to populate
- """
- with open(filepath, "rt") as fin:
- meta = fin.read()
- # Replace with info from pyproject.toml
- if PACKAGE_VERSION not in meta:
- raise Exception(f"{PACKAGE_VERSION=} not found in {filepath}")
- meta = meta.replace(PACKAGE_VERSION, info["package_version"])
- if " - dependencies" not in meta:
- raise Exception(f'" - dependencies" not found in {filepath}')
- dependencies = ""
- for dep in info["dependencies"]:
- if "fief-client" in dep:
- # Prevent to have unsupported "fief-client[cli]" in dependencies
- dependencies += " - fief-client-fastapi\n - yaspin\n"
- else:
- dependencies += f" - {dep}\n"
- meta = meta.replace(" - dependencies", dependencies)
- with open(filepath, "wt") as fout:
- fout.write(meta)
- logging.info(
- f"File {filepath} has been updated with informations from pyproject.toml."
- )
-
-
-if __name__ == "__main__":
- parser = argparse.ArgumentParser()
- parser.add_argument(
- "-r",
- "--replace",
- action="store_true",
- help="replace in file",
- )
- parser.add_argument(
- "-f",
- "--filename",
- type=str,
- default=".conda/recipe.yaml",
- help="Path to recipe.yaml, with filename",
+def main():
+ """Main entry point for the script."""
+ parser = argparse.ArgumentParser(
+ description="Read package version and check version coherence"
)
parser.add_argument(
"-o",
@@ -187,27 +149,39 @@ def replace_in_file(filepath: str, info: dict):
action="store_true",
help="Check version coherence across all bumpver-managed files",
)
+
+ # Parse arguments - all arguments are optional, so this works fine with no args
args = parser.parse_args()
- # Check version coherence first if requested or before any operations
+ # Check version coherence first if requested
if args.check_coherence:
coherence_ok = check_version_coherence()
sys.exit(0 if coherence_ok else 1)
- # Always check coherence before doing replacements or showing versions
- if not check_version_coherence(quiet=True):
- logging.error("Aborting due to version coherence issues.")
+ # If only_package_version is requested, just print version and exit
+ if args.only_package_version:
+ try:
+ info = get_versions()
+ print(f'{info["package_version"]}')
+ sys.exit(0)
+ except Exception as e:
+ logging.error(f"Error getting version: {e}")
+ sys.exit(1)
+
+ # Default behavior: check coherence quietly, then show versions
+ try:
+ if not check_version_coherence(quiet=True):
+ logging.error("Aborting due to version coherence issues.")
+ sys.exit(1)
+
+ info = get_versions()
+ logging.info("Versions:")
+ print(info) # noqa: T201
+ sys.exit(0)
+ except Exception as e:
+ logging.error(f"Error: {e}")
sys.exit(1)
- info = get_versions()
- file = args.filename
- if args.only_package_version:
- print(f'{info["package_version"]}')
- exit()
- logging.info("Versions :")
- print(info) # noqa: T201
- if args.replace:
- logging.info(f"Replace in {file}")
- replace_in_file(file, info)
- else:
- logging.info("Dry mode, no replace made")
+
+if __name__ == "__main__":
+ main()
diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml
index ac1b77416..f67669a99 100644
--- a/.github/workflows/package.yml
+++ b/.github/workflows/package.yml
@@ -70,48 +70,3 @@ jobs:
# Test that the CLI is functional
codecarbon --help
python -c "from codecarbon import EmissionsTracker; print('✓ Package import successful')"
-
- build-conda:
- runs-on: ubuntu-24.04
- steps:
- - name: Checkout
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- - name: Cache build
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
- with:
- path: /tmp/conda-bld
- key: build-conda-${{ github.sha }}
- - name: set version
- run: |
- python3 .github/pyproject_versions.py --check_coherence --replace
- - name: Build conda package
- uses: prefix-dev/rattler-build-action@20cb88d3095cc01fa181385021c57f886d624879 # v0.2.16
- with:
- build-args: --channel codecarbon --channel conda-forge --output-dir /tmp/conda-bld
- recipe-path: .conda/recipe.yaml
- upload-artifact: false
- test-conda:
- runs-on: ubuntu-24.04
- needs: [ build-conda ]
- steps:
- # Checkout needed to get github.sha
- - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- - name: Setup conda
- uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1
- with:
- activate-environment: codecarbon
- miniforge-version: latest
- python-version: 3.12
- use-mamba: true
- - name: Restore build
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
- with:
- path: /tmp/conda-bld
- key: build-conda-${{ github.sha }}
- fail-on-cache-miss: true
- - name: Install package
- shell: bash -l {0}
- run: mamba install --channel file:///tmp/conda-bld --channel codecarbon codecarbon
- - name: Test conda package
- shell: bash -l {0}
- run: codecarbon --help
diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml
index c7c2a6e55..1fd398fcd 100644
--- a/.github/workflows/python-publish.yml
+++ b/.github/workflows/python-publish.yml
@@ -33,32 +33,3 @@ jobs:
run: uv build
- name: Publish package
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # release/v1.13.0
- publish-to-conda:
- runs-on: ubuntu-24.04
- needs: [ deploy-pypi ]
- steps:
- - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- - name: Restore build
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
- with:
- path: /tmp/conda-bld
- key: build-conda-${{ github.sha }}
- fail-on-cache-miss: true
- - uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1
- with:
- activate-environment: codecarbon
- miniforge-version: latest
- python-version: 3.12
- use-mamba: true
- - name: Install package
- shell: bash -l {0}
- run: mamba install --channel file:///tmp/conda-bld --channel codecarbon codecarbon
- - name: Test conda package
- shell: bash -l {0}
- run: codecarbon --help
- - name: Conda upload already build package
- shell: bash -l {0}
- env:
- ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
- run: |
- anaconda upload --user codecarbon /tmp/conda-bld/noarch/codecarbon-*.tar.bz2
diff --git a/CLAUDE.md b/CLAUDE.md
new file mode 120000
index 000000000..02dd13412
--- /dev/null
+++ b/CLAUDE.md
@@ -0,0 +1 @@
+.github/copilot-instructions.md
\ No newline at end of file
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 62ffe1297..f7ea3449b 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -70,7 +70,7 @@ You have a cool idea, but do not know know if it fits with Code Carbon? You can
### Installation
-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).
+CodeCarbon is a Python package, to contribute to it, you need to have Python installed on your machine, natively or with [UV](https://github.com/astral-sh/uv).
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.
@@ -258,7 +258,6 @@ Dependencies are defined in different places:
- In [pyproject.toml](pyproject.toml#L28), those are all the dependencies.
- In [uv.lock](uv.lock), those are the locked dependencies managed by UV, do not edit them.
-- In [.conda/meta.yaml](.conda/meta.yaml#L21), those are the dependencies for the Conda pacakge targeting Python 3.7 and higher versions.
@@ -288,20 +287,6 @@ to regenerate the html files.
- Wait for the Github Action `ReleaseDrafter` to finish running on the merge commit.
- [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).
- A [Github Action](https://github.com/mlco2/codecarbon/actions) _Upload Python Package_ will be run automaticaly to upload the package.
-- For conda, we now have a [feedstock](https://github.com/conda-forge/codecarbon-feedstock/pulls) to publish to Conda-Forge channel.
-
-If you still want to publish to the Anaconda CodeCarbon channel:
-
-Start a Docker image in the same directory and bind-mount the current directory with:
-
-`docker run -ti --rm=true -v $PWD:/data continuumio/anaconda3`.
-
-Inside the docker container, run:
-
-- `conda install -y conda-build conda-verify`
-- `cd /data && mkdir -p /conda_dist`
-- `conda build --python 3.11 .conda/ -c conda-forge --output-folder /conda_dist`
-- `anaconda upload --user codecarbon /conda_dist/noarch/codecarbon-*.tar.bz2`
#### Test the build in Docker
diff --git a/README.md b/README.md
index c62ba100e..c96d7f663 100644
--- a/README.md
+++ b/README.md
@@ -13,8 +13,6 @@ CodeCarbon websites:
-[](https://anaconda.org/conda-forge/codecarbon)
-[](https://anaconda.org/codecarbon/codecarbon)
[](https://pypi.org/project/codecarbon/)
[](https://zenodo.org/badge/latestdoi/263364731)
@@ -63,10 +61,13 @@ Our hope is that this package will be used widely for estimating the carbon foot
pip install codecarbon
```
-**From Conda repository**
-```python
-conda install -c codecarbon codecarbon
+**Using Conda environments**
+If you're using Conda, you can install CodeCarbon with pip in your Conda environment:
+```bash
+conda activate your_env
+pip install codecarbon
```
+
To see more installation options please refer to the documentation: [**Installation**](https://mlco2.github.io/codecarbon/installation.html#)
## Start to estimate your impact 📏
diff --git a/docs/edit/installation.rst b/docs/edit/installation.rst
index 73eb4acb6..4539c5ffc 100755
--- a/docs/edit/installation.rst
+++ b/docs/edit/installation.rst
@@ -3,15 +3,6 @@
Installing CodeCarbon
=====================
-Create a virtual environment using `conda` for easier management of dependencies and packages.
-For installing conda, follow the instructions on the
-`official conda website `__
-
-.. code-block:: bash
-
- conda create --name codecarbon
- conda activate codecarbon
-
From PyPi repository
--------------------
@@ -23,16 +14,20 @@ To install the package, run the following command in your terminal.
pip install codecarbon
-From conda repository
----------------------
-
-The package is hosted on the conda repository `here `__.
+Using Conda environments
+------------------------
-To install the package, run the following command in your terminal.
+If you're using Conda for environment management, you can install CodeCarbon with pip in your Conda environment:
.. code-block:: bash
- conda install -c codecarbon -c conda-forge codecarbon
+ conda create --name codecarbon
+ conda activate codecarbon
+ pip install codecarbon
+
+.. note::
+
+ While CodeCarbon can be used in Conda environments, we no longer maintain Conda packages. We recommend using ``pip install codecarbon`` within your Conda environment, which works seamlessly with Conda.
.. note::