Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 5 additions & 15 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Install dependencies
run: |
uv venv
uv pip install -r requirements.txt
run: uv sync --frozen
- name: Lint with ruff
run: uv run python run.py ruff-check
- name: Format with ruff
Expand All @@ -53,9 +51,7 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Install dependencies
run: |
uv venv
uv pip install -r requirements.txt
run: uv sync --frozen
- run: uv run python run.py pytest
mypy:
name: Run mypy on the tests and on the stubs
Expand All @@ -69,9 +65,7 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Install dependencies
run: |
uv venv
uv pip install -r requirements.txt
run: uv sync --frozen
- run: uv run python run.py mypy
# stubtest:
# name: Run stubtest on the the stubs
Expand All @@ -85,9 +79,7 @@ jobs:
# - name: Install uv
# uses: astral-sh/setup-uv@v6
# - name: Install dependencies
# run: |
# uv venv
# uv pip install -r requirements.txt
# run: uv sync --frozen
# - run: uv run python run.py stubtest
pyright:
name: Run pyright on the tests and on the stubs
Expand All @@ -101,7 +93,5 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Install dependencies
run: |
uv venv
uv pip install -r requirements.txt
run: uv sync --frozen
- run: uv run python run.py pyright
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repos:
- id: mixed-line-ending
- id: check-case-conflict
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.1 # must match requirements.txt
rev: v0.11.10 # must match requirements.txt
hooks:
- id: ruff
- id: ruff-format
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,18 @@ every change).
Contributions of any kind are welcome. Please open an issue or a send pull request.

To set up a development environment:
1. Install `uv`: https://docs.astral.sh/uv/getting-started/installation/
2. Install the project dependencies: `uv sync --frozen`
3. Run `uv run python run.py --help` for more.

Alternatively, if you want to use pip instead of `uv`:
1. Create a virtual environment: `python -m .venv venv`
2. Activate the virtual environment:
- Unix: `. .venv/bin/activate`
- Windows: `.venv\Scripts\activate`
3. Install the dependencies: `python -m pip install -r requirements.txt`

Run `python run.py --help` for more.
3. Update `pip`: `python -m pip install --upgrade pip`
4. Install the dependencies: `python -m pip install -r requirements.txt`
5. Run `python run.py --help` for more.

## License

Expand Down
28 changes: 28 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,34 @@ name = "python-stubs"
version = "0.0.0"
requires-python = ">=3.9"

[dependency-groups]
tests = [
# geopandas and shapely
"types-geopandas>=1.0.1",
"types-shapely>=2.0.0",
"pandas-stubs>=2.2.2",
"matplotlib>=3.8.0",
"folium>=0.16.0",
"rtree>=1.2.0",
# netfields and psqlextra
"django-types>=0.19.1",
"djangorestframework-types>=0.8.0",
"types-psycopg2>=2.9.21",
"types-netaddr>=1.2.0",
"types-python-dateutil>=2.9.0",
# pandapower
"networkx>=3.2.1",
"geopandas>=1.0.0",
]
dev = [
"ruff>=0.9.2",
"pytest>=8.0",
"rich-argparse>=1.6.0",
"mypy>=1.14.1",
"pyright>=1.1.392",
{ include-group = "tests" },
]

[tool.ruff]
line-length = 130
fix = true
Expand Down
29 changes: 0 additions & 29 deletions requirements.in

This file was deleted.

1,280 changes: 1,203 additions & 77 deletions requirements.txt

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions stubs/pandapower-stubs/auxiliary.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections.abc import Iterable, Mapping, MutableMapping
from typing import Any, Literal, NoReturn, SupportsFloat as Float, SupportsIndex as Int, TypeVar, overload
from typing import Any, Final, Literal, NoReturn, SupportsFloat as Float, SupportsIndex as Int, TypeVar, overload
from typing_extensions import Self

import geopandas as gpd
Expand Down Expand Up @@ -140,7 +140,7 @@ def element_types_to_ets(element_types: None = None) -> pd.Series[str]: ...
def element_types_to_ets(element_types: str) -> str: ...
@overload
def element_types_to_ets(element_types: list[str] | pd.Series[str] | pd.Index[str] | NDArray[np.str_]) -> list[str]: ...
def get_free_id(df: pd.DataFrame) -> int: ...
def get_free_id(df: pd.DataFrame) -> np.int64: ...

class ppException(Exception): ...
class AlgorithmUnknown(ppException): ...
Expand All @@ -152,7 +152,7 @@ class MapboxTokenMissing(ppException): ...

def get_indices(
selection: Iterable[Int], lookup: Mapping[Int, Int] | Mapping[str, Mapping[Int, Int]], fused_indices: bool = True
) -> NDArray[np.int_]: ...
) -> NDArray[np.int64]: ...
def ensure_iterability(var: _T | Iterable[_T], len_: Int | None = None) -> Iterable[_T]: ...
def read_from_net(
net: pandapowerNet,
Expand All @@ -171,19 +171,19 @@ def write_to_net(
) -> None: ...

# jit-ted functions
def get_values(source, selection, lookup) -> NDArray[np.int_]: ...
def get_values(source, selection, lookup) -> NDArray[np.int64]: ...
def set_elements_oos(ti, tis, bis, lis) -> None: ...
def set_isolated_buses_oos(bus_in_service, ppc_bus_isolated, bus_lookup) -> None: ...
def X012_to_X0(X012: ArrayLike) -> NDArray[np.complex128]: ...
def X012_to_X1(X012: ArrayLike) -> NDArray[np.complex128]: ...
def X012_to_X2(X012: ArrayLike) -> NDArray[np.complex128]: ...
def combine_X012(X0: ArrayLike, X1: ArrayLike, X2: ArrayLike) -> NDArray[np.complex128]: ...
def phase_shift_unit_operator(angle_deg: Float) -> complex: ...
def phase_shift_unit_operator(angle_deg: Float) -> np.complex128: ...

a: complex
asq: complex
Tabc: NDArray[np.complex128]
T012: NDArray[np.complex128]
a: Final[np.complex128]
asq: Final[np.complex128]
Tabc: Final[np.ndarray[tuple[int, int], np.dtype[np.complex128]]]
T012: Final[np.ndarray[tuple[int, int], np.dtype[np.complex128]]]

def sequence_to_phase(X012: ArrayLike) -> NDArray[np.complex128]: ...
def phase_to_sequence(Xabc: ArrayLike) -> NDArray[np.complex128]: ...
Expand Down
Loading