Skip to content

Commit

Permalink
Merge pull request #391 from arrrrrmin/feature/py311
Browse files Browse the repository at this point in the history
#390 Add Python 3.11 support
  • Loading branch information
benoit-cty authored May 13, 2023
2 parents c9afcca + 5ffbe2d commit 8d43bc2
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 13 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.2.0" %}
{% set version = "2.2.1" %}

package:
name: codecarbon
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9"]
python-version: ["3.8", "3.11"]

steps:
- uses: actions/checkout@v2
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.2.0"
__version__ = "2.2.1"
23 changes: 15 additions & 8 deletions codecarbon/core/rapl.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
from dataclasses import dataclass
from dataclasses import dataclass, field

from codecarbon.core.units import Energy, Power, Time
from codecarbon.external.logger import logger


@dataclass
class RAPLFile:
name: str # RAPL device being measured
path: str # Path to file containing RAPL reading
max_path: str # Path to corresponding file containing maximum possible RAPL reading
energy_delta: Energy = Energy(0) # Energy consumed in kWh
power: Power = Power(0) # Power based on reading
last_energy: Energy = Energy(0) # Last energy reading in kWh
max_energy_reading: Energy = Energy(0) # Max value energy can hold before it wraps
# RAPL device being measured
name: str
# Path to file containing RAPL reading
path: str
# Path to corresponding file containing maximum possible RAPL reading
max_path: str
# Energy consumed in kWh
energy_delta: Energy = field(default_factory=lambda: Energy(0))
# Power based on reading
power: Power = field(default_factory=lambda: Power(0))
# Last energy reading in kWh
last_energy: Energy = field(default_factory=lambda: Energy(0))
# Max value energy can hold before it wraps
max_energy_reading: Energy = field(default_factory=lambda: Energy(0))

def __post_init__(self):
self.last_energy = self._get_value()
Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

setuptools.setup(
name="codecarbon",
version="2.2.0",
version="2.2.1",
author="Mila, DataForGood, BCG GAMMA, Comet.ml, Haverford College",
long_description=long_description,
long_description_content_type="text/markdown",
Expand All @@ -38,6 +38,8 @@
"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",
"License :: OSI Approved :: MIT License",
],
package_data={
Expand Down
4 changes: 3 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py37, py38, py39
envlist = py37, py38, py39, py310, py311

[testenv]
deps =
Expand Down Expand Up @@ -30,3 +30,5 @@ python =
3.7: py37
3.8: py38
3.9: py39
3.10: py310
3.11: py311

0 comments on commit 8d43bc2

Please sign in to comment.