Skip to content

Commit

Permalink
[fix] remove typing_extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
pkelaita committed Jun 30, 2024
1 parent 922b664 commit 8ea3492
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 10 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
# Changelog

_Current version: 0.0.22_
_Current version: 0.0.23_

[PyPi link](https://pypi.org/project/l2m2/)

### 0.0.23 - June 30, 2024

#### Fixed

- Major bug where l2m2 would cause environments without `typing_extensions` installed to crash due to it not being listed as an external dependency. This has been fixed by removing the dependency on `typing_extensions` in the code and replacing it with Python3.9-compatible type hints.

#### Changed

- blah blah blah

### 0.0.22 - June 22, 2024

#### Fixed
Expand Down
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,17 @@ init:
test:
pytest -v --cov=l2m2 --cov-report=term-missing --failed-first --durations=0

itest:
clear-deps:
@pip uninstall -y l2m2 > /dev/null 2>&1
@pip freeze | xargs pip uninstall -y > /dev/null

itest-run:
@pip install dist/l2m2-$(VERSION)-py3-none-any.whl > /dev/null
@pip install python-dotenv > /dev/null
python integration_tests/itests.py
@pip uninstall -y l2m2 > /dev/null

itest: clear-deps itest-run clear-deps


coverage:
pytest --cov=l2m2 --cov-report=html
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -579,8 +579,9 @@ Contributions are welcome! Contributing requires Python >= 3.9 and [GNU Make](ht
- Create a `.env` file with your API keys, and copy `itests.example.py` to `itests.py`.
- Write your integration tests in `itests.py`.
- Run locally with `python itests.py -l`.
- Make sure to pass the `-l` flag or else it will look for an L2M2 distribution. Additionally, make sure l2m2 is not installed with pip when running the integration tests locally.
- _Note: make sure to pass the `-l` flag or else it will look for an L2M2 distribution. Additionally, make sure l2m2 is not installed with pip when running the integration tests locally._
- Once your changes are ready, from the top-level directory run `make build` to create the distribution and `make itest` to run your integration tests against the distribution.
- _Note: in order to ensure a clean test environment, `make itest` uninstalls all third-party Python packages before running the tests, so make sure to run `make init` when you're done working on integration tests._
- **Contribute**
- Create a PR and ping me for a review.
- Merge!
Expand Down
16 changes: 10 additions & 6 deletions l2m2/model_info.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Information about models and providers supported by L2M2."""

from typing import Dict, Union, Any
from typing_extensions import TypedDict, NotRequired, TypeVar, Generic, Literal
from typing import Dict, Union, Any, TypedDict, Literal, TypeVar, Generic

from enum import Enum
import sys

Expand All @@ -22,15 +22,19 @@ class ProviderEntry(TypedDict):
MODEL_ID = "<<MODEL_ID>>"


class Param(TypedDict, Generic[T]):
custom_key: NotRequired[str]
class ParamBase(TypedDict, Generic[T]):
default: Union[T, Literal[Marker.PROVIDER_DEFAULT]]
max: T


class ParamExt(ParamBase[T], total=False):
custom_key: str
abc: str


class ModelParams(TypedDict):
temperature: Param[float]
max_tokens: Param[int]
temperature: Union[ParamBase[float], ParamExt[float]]
max_tokens: Union[ParamBase[int], ParamExt[int]]


ParamName = Literal[
Expand Down

0 comments on commit 8ea3492

Please sign in to comment.