Skip to content

Commit

Permalink
Merge pull request #539 from mlco2/fix/hatch
Browse files Browse the repository at this point in the history
Fix problems with Hatch
  • Loading branch information
benoit-cty committed May 10, 2024
2 parents 2787011 + de5061b commit fe118ca
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% set version = "2.4.0rc0" %}
{% set version = "2.4.1" %}

package:
name: codecarbon
Expand Down
74 changes: 71 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ If you've identified a bug in `codecarbon`, please [submit an issue](#issue) to

Feel free to describe your request by [submitting an issue](#issue) documenting the feature (with its intent) and a PR with a proposed implementation of the feature.




<!-- TOC --><a name="ready-to-contribute"></a>
## </a> Ready to Contribute!

Expand Down Expand Up @@ -87,6 +84,77 @@ cd codecarbon
hatch env create
```

### Some Hatch commands

View the options of CodeCarbon environments:

```sh
❯ hatch env show
Standalone
┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┓
┃ Name ┃ Type ┃ Features ┃ Dependencies ┃ Scripts ┃
┡━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━┩
│ default │ pip-compile │ │ │ │
├─────────────┼─────────────┼──────────┼───────────────────────────┼───────────────────┤
│ carbonboard │ pip-compile │ viz │ │ run │
├─────────────┼─────────────┼──────────┼───────────────────────────┼───────────────────┤
│ docs │ virtual │ │ sphinx │ build │
│ │ │ │ sphinx-rtd-theme │ │
├─────────────┼─────────────┼──────────┼───────────────────────────┼───────────────────┤
│ dev │ pip-compile │ │ black │ format │
│ │ │ │ mypy │ lint │
│ │ │ │ pre-commit │ mypy-check │
│ │ │ │ ruff │ precommit │
│ │ │ │ │ precommit-install │
│ │ │ │ │ precommit-update │
├─────────────┼─────────────┼──────────┼───────────────────────────┼───────────────────┤
│ dashboard │ pip-compile │ │ dash-bootstrap-components │ run │
│ │ │ │ dash>=2.2.0 │ │
│ │ │ │ plotly>=5.6.0 │ │
├─────────────┼─────────────┼──────────┼───────────────────────────┼───────────────────┤
│ api │ pip-compile │ │ alembic<2.0.0 │ docker │
│ │ │ │ bcrypt<5.0.0 │ local
│ │ │ │ dependency-injector<5.0.0 │ server-ci │
│ │ │ │ fastapi-pagination<1.0.0 │ setup-db │
│ │ │ │ fastapi<1.0.0 │ test-integ │
│ │ │ │ httpx │ test-unit │
│ │ │ │ mock │ │
│ │ │ │ numpy │ │
│ │ │ │ psutil │ │
│ │ │ │ psycopg2-binary<3.0.0 │ │
│ │ │ │ pydantic[email]<2.0.0 │ │
│ │ │ │ pytest │ │
│ │ │ │ python-dateutil<3.0.0 │ │
│ │ │ │ rapidfuzz │ │
│ │ │ │ requests-mock │ │
│ │ │ │ requests<3.0.0 │ │
│ │ │ │ responses │ │
│ │ │ │ sqlalchemy<2.0.0 │ │
│ │ │ │ uvicorn[standard]<1.0.0 │ │
└─────────────┴─────────────┴──────────┴───────────────────────────┴───────────────────┘
Matrices
┏━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Name ┃ Type ┃ Envs ┃ Features ┃ Dependencies ┃ Scripts ┃
┡━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
test │ pip-compile │ test.py3.8 │ viz │ mock │ package │
│ │ │ test.py3.9 │ │ numpy │ package-integ │
│ │ │ test.py3.10 │ │ psutil │ │
│ │ │ test.py3.11 │ │ pytest │ │
│ │ │ test.py3.12 │ │ rapidfuzz │ │
│ │ │ │ │ requests-mock │ │
│ │ │ │ │ responses │ │
└──────┴─────────────┴─────────────┴──────────┴───────────────┴───────────────┘
```

To know the path of a env :
```sh
hatch env find dev
```

To delete all your env :
```sh
hatch env prune
```

<!-- TOC --><a name="tests"></a>
### Tests
Expand Down
2 changes: 1 addition & 1 deletion codecarbon/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.4.0rc0"
__version__ = "2.4.1"
4 changes: 3 additions & 1 deletion codecarbon/emissions_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,9 @@ def __init__(
self._conf["gpu_ids"] = self._gpu_ids
self._conf["gpu_count"] = len(self._gpu_ids)
else:
logger.warn("Invalid gpu_ids format. Expected a string or a list of ints.")
logger.warning(
"Invalid gpu_ids format. Expected a string or a list of ints."
)

logger.info("[setup] RAM Tracking...")
ram = RAM(tracking_mode=self._tracking_mode)
Expand Down
11 changes: 9 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ build-backend = "hatchling.build"
name = "codecarbon"
dynamic = ["version"]
readme = "README.md"
license = ""
requires-python = ">=3.7"
authors = [
{ name = "Mila" },
Expand Down Expand Up @@ -37,6 +36,14 @@ dependencies = [
"requests",
]

[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 = [
Expand Down Expand Up @@ -85,7 +92,7 @@ dependencies = [
precommit-install = "pre-commit install"
precommit-update = "pre-commit autoupdate"
precommit = "pre-commit run --show-diff-on-failure --color=always --all-files"
mypy = "mypy -m codecarbon --ignore-missing-imports --no-strict-optional --disable-error-code attr-defined --disable-error-code assignment --disable-error-code misc"
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:.}"]

Expand Down

0 comments on commit fe118ca

Please sign in to comment.