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
56 changes: 56 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Publish

# Tag push (v*) publishes to PyPI. Manual run publishes to TestPyPI.
on:
push:
tags: ["v*"]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: astral-sh/[email protected]
- run: uv build
- name: Check tag matches package version
if: github.ref_type == 'tag'
run: test -f "dist/pse_sdk-${GITHUB_REF_NAME#v}.tar.gz"
- uses: actions/upload-artifact@v7
with:
name: dist
path: dist/

testpypi:
if: github.event_name == 'workflow_dispatch'
needs: build
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/project/pse-sdk/
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v8
with:
name: dist
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

pypi:
if: github.ref_type == 'tag'
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/pse-sdk/
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v8
with:
name: dist
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1
44 changes: 44 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Tests

on:
push:
branches: [main, develop]
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: astral-sh/[email protected]
- run: uv run --locked ruff check src/ scripts/ tests/
- run: uv run --locked ruff format --check src/ scripts/ tests/
- run: uv run --locked scripts/gen_docs.py --check

test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v7
- uses: astral-sh/[email protected]
with:
python-version: ${{ matrix.python-version }}
# manual_test.py calls the live API on import
- run: uv run --locked pytest --ignore=tests/manual_test.py

test-lowest:
# Oldest dependency versions pyproject.toml allows. pandas 1.5 predates
# numpy 2 and breaks against it, so numpy is held below 2.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: astral-sh/[email protected]
with:
python-version: "3.10"
- run: echo "numpy<2" > constraints.txt
- run: uv venv
- run: uv pip install --resolution lowest-direct -e . --group dev -c constraints.txt
- run: .venv/bin/python -m pytest --ignore=tests/manual_test.py
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Added
- Published on PyPI as `pse-sdk`: `pip install pse-sdk`, or
`pip install "pse-sdk[pandas]"` for DataFrame output
- `PSEClient.endpoints()`: names of all endpoints
- `PSEClient.columns(endpoint)`: data columns of an endpoint, in API order
(meta columns left out). Both read the bundled registry, no HTTP request.
Expand All @@ -19,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
(#37)

### Changed
- License is now MIT (was proprietary)
- Unknown endpoint errors suggest the closest endpoint name (#25)
- `HTTPError` from the API includes the API's error message, e.g.
`Invalid field to be returned requested: cen_cots`
Expand Down
44 changes: 21 additions & 23 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
Copyright (C) 2026 FranekGit - All Rights Reserved.

IMPORTANT NOTICE: PLEASE READ CAREFULLY BEFORE USING THE SOFTWARE.

1. PROPRIETARY AND CONFIDENTIAL INFORMATION

The contents of this project, including its source code, are proprietary and confidential. Unauthorized copying, transferring, or reproduction of any part of this project, through any medium, is strictly prohibited.

2. LICENSE GRANT

The receipt or possession of the source code and/or any parts thereof does not convey or imply any right to use them for any purpose other than the specific purpose for which they were provided to you.

3. DISCLAIMER OF WARRANTIES

The software is provided "AS IS," without warranty of any kind, express or implied, including, but not limited to, the warranties of merchantability, fitness for a particular purpose, and non-infringement.

4. LIMITATION OF LIABILITY

In no event shall Sourceduty, its authors, or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the Software or the use or other dealings in the Software.

5. COPYRIGHT NOTICE

You are required to include the above copyright notice and this permission notice in all copies or substantial portions of the Software.
MIT License

Copyright (c) 2026 FranekGit

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<img src="assets/pse_logo.png" alt="PSE Logo">
<img src="https://raw.githubusercontent.com/FranekGit/pse-python-sdk/main/assets/pse_logo.png" alt="PSE Logo">
</p>

# pse-python-sdk
Expand Down Expand Up @@ -39,7 +39,7 @@ df = client.fetch(

## Documentation

- [docs/usage.md](docs/usage.md): finding endpoints, date ranges, columns and
- [docs/usage.md](https://github.com/FranekGit/pse-python-sdk/blob/main/docs/usage.md): finding endpoints, date ranges, columns and
output formats
- [docs/endpoints.md](docs/endpoints.md): all endpoints, their columns and
- [docs/endpoints.md](https://github.com/FranekGit/pse-python-sdk/blob/main/docs/endpoints.md): all endpoints, their columns and
types
31 changes: 26 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,28 +1,49 @@
[build-system]
requires = ["hatchling"]
requires = ["hatchling>=1.27"]
build-backend = "hatchling.build"

[project]
name = "pse-sdk"
version = "1.5.1"
dynamic = ["version"]
description = "Python SDK for the PSE (Polskie Sieci Elektroenergetyczne) public REST API"
readme = "README.md"
license = "MIT"
license-files = ["LICENSE.md"]
authors = [{ name = "FranekGit" }]
requires-python = ">=3.10"
keywords = ["pse", "energy", "electricity", "poland"]
classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Typing :: Typed",
]
dependencies = [
"requests>=2.28",
]

[project.optional-dependencies]
pandas = ["pandas>=1.5"]

[project.urls]
Homepage = "https://github.com/FranekGit/pse-python-sdk"
Documentation = "https://github.com/FranekGit/pse-python-sdk/blob/main/docs/usage.md"
Changelog = "https://github.com/FranekGit/pse-python-sdk/blob/main/CHANGELOG.md"
Issues = "https://github.com/FranekGit/pse-python-sdk/issues"

[dependency-groups]
dev = [
"pytest",
"responses",
"ruff",
"pytest>=8",
"responses>=0.25",
"ruff>=0.15",
"pandas>=1.5",
]

[tool.hatch.version]
path = "src/pse_sdk/__init__.py"

[tool.hatch.build.targets.wheel]
packages = ["src/pse_sdk"]

Expand Down
7 changes: 3 additions & 4 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading