diff --git a/CHANGES.md b/CHANGES.md index 088959a..eeec195 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -34,6 +34,11 @@ This release exports all functions in `matplotlib.pyplot` to `latexplotlib`. Thi - fix previously unnoticed ruff errors - update badges -## Version 0.x.x +## Version 0.8.2 - update `lpl.subplots` docstring +- typing: allow both floats and ints as widths and height + +### Development +- remove unused packages from environment.yml +- add requirements.txt diff --git a/environment.yml b/environment.yml index 838b096..3d3e427 100644 --- a/environment.yml +++ b/environment.yml @@ -3,11 +3,9 @@ channels: - conda-forge - defaults dependencies: - - black - coverage - ipython - matplotlib - - mypy - pip - pre-commit - pytest @@ -16,7 +14,6 @@ dependencies: - python>=3.8 - ruff - pip: - - ruff-lsp - python-lsp-server - pylsp-mypy - "--editable=.[tests]" diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..900bec0 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,7 @@ +--editable .[tests] +ipykernel +numpy +pre-commit +pylsp-mypy +python-lsp-server +ruff diff --git a/src/latexplotlib/_config.py b/src/latexplotlib/_config.py index 3ffda52..c0d98f1 100644 --- a/src/latexplotlib/_config.py +++ b/src/latexplotlib/_config.py @@ -5,6 +5,9 @@ from appdirs import user_config_dir +Number = Union[int, float] +ConfigData = Union[Number, bool] + GOLDEN_RATIO: float = (5**0.5 + 1) / 2 NAME: str = "latexplotlib" _PURGED_OLD = "_purged_old_styles" @@ -12,10 +15,7 @@ CONFIGFILE: str = "config.ini" CONFIGDIR: Path = Path(user_config_dir(NAME)) CONFIGPATH: Path = CONFIGDIR / CONFIGFILE -DEFAULT_CONFIG: Dict[str, int] = {"width": 630, "height": 412, _PURGED_OLD: False} - - -ConfigData = Union[int, bool] +DEFAULT_CONFIG: Dict[str, Number] = {"width": 630, "height": 412, _PURGED_OLD: False} class Config: @@ -60,8 +60,8 @@ def __setitem__(self, name: str, value: ConfigData) -> None: class Size: - _width: int - _height: int + _width: Number + _height: Number def __init__(self) -> None: self._width, self._height = config["width"], config["height"] @@ -70,7 +70,7 @@ def reload(self) -> None: config.reload() self._width, self._height = config["width"], config["height"] - def get(self) -> Tuple[int, int]: + def get(self) -> Tuple[Number, Number]: """Returns the current size of the figure in pts. Returns @@ -80,7 +80,7 @@ def get(self) -> Tuple[int, int]: """ return self._width, self._height - def set(self, width: int, height: int) -> None: + def set(self, width: Number, height: Number) -> None: """Sets the size of the latex page in pts. You can find the size of the latex page with the following commands: @@ -99,7 +99,7 @@ def set(self, width: int, height: int) -> None: self._width, self._height = width, height @contextmanager - def context(self, width: int, height: int) -> Iterator[None]: + def context(self, width: Number, height: Number) -> Iterator[None]: """This context manager temporarily sets the size of the figure in pts. Parameters diff --git a/src/latexplotlib/_version.py b/src/latexplotlib/_version.py index 8088f75..deded32 100644 --- a/src/latexplotlib/_version.py +++ b/src/latexplotlib/_version.py @@ -1 +1 @@ -__version__ = "0.8.1" +__version__ = "0.8.2"