Skip to content

Commit

Permalink
refactor: use an uppercase L in EcoLogits (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelrince authored Apr 12, 2024
1 parent 0695578 commit 4ce9066
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Ecologits
============

**Ecologits** tracks and estimates the energy consumption and environmental impacts of using generative AI models through APIs.
**EcoLogits** tracks and estimates the energy consumption and environmental impacts of using generative AI models through APIs.


## ⚙️ Installation
Expand All @@ -11,10 +11,10 @@ Coming soon...
## 🚀 Usage

```python
from ecologits import Ecologits
from ecologits import EcoLogits
from openai import OpenAI

Ecologits.init()
EcoLogits.init()

client = OpenAI(
api_key="<OPENAI_API_KEY>",
Expand All @@ -28,12 +28,12 @@ response = client.chat.completions.create(
)

# Get estimated environmental impacts for that inference.
print(response.impacts) # Impacts(energy=0.025, energy_unit='Wh', ...)
print(response.impacts) # Impacts(energy=0.025, energy_unit='Wh', ...)
```



See package documentation on [Ecologits](<link-to-mkdocs-material>)
See package documentation on [EcoLogits](<link-to-mkdocs-material>)

## 💪 Contributing

Expand Down
4 changes: 2 additions & 2 deletions ecologits/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .ecologits import Ecologits
from .ecologits import EcoLogits

__all__ = ["Ecologits"]
__all__ = ["EcoLogits"]
6 changes: 3 additions & 3 deletions ecologits/ecologits.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
from ecologits.exceptions import TracerInitializationError


class Ecologits:
class EcoLogits:
initialized = False

@staticmethod
def init() -> None:
if Ecologits.initialized:
if EcoLogits.initialized:
raise TracerInitializationError()
init_instruments()
Ecologits.initialized = True
EcoLogits.initialized = True


def init_instruments() -> None:
Expand Down
4 changes: 2 additions & 2 deletions ecologits/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class EcologitsError(Exception):
class EcoLogitsError(Exception):
pass


class TracerInitializationError(EcologitsError):
class TracerInitializationError(EcoLogitsError):
"""Tracer is initialized twice"""
pass
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "ecologits"
version = "0.1.0"
description = "Ecologits tracks and estimates the energy consumption and environmental impacts of using generative AI models through APIs."
description = "EcoLogits tracks and estimates the energy consumption and environmental impacts of using generative AI models through APIs."
authors = ["DataForGood"]
license = "MIT"
readme = "README.md"
Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest

from ecologits import Ecologits
from ecologits import EcoLogits


@pytest.fixture(autouse=True)
Expand All @@ -28,4 +28,4 @@ def vcr_config():

@pytest.fixture(scope="session")
def tracer_init():
Ecologits.init()
EcoLogits.init()
8 changes: 4 additions & 4 deletions tests/test_tracer.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import pytest
from ecologits import Ecologits
from ecologits.exceptions import EcologitsError
from ecologits import EcoLogits
from ecologits.exceptions import EcoLogitsError


def test_double_init(tracer_init):
with pytest.raises(EcologitsError) as e:
Ecologits.init() # Second initialization
with pytest.raises(EcoLogitsError) as e:
EcoLogits.init() # Second initialization

0 comments on commit 4ce9066

Please sign in to comment.