diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..aea4a7b --- /dev/null +++ b/.github/workflows/publish.yml @@ -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/setup-uv@v10.3.2 + - 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 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..48adad1 --- /dev/null +++ b/.github/workflows/tests.yml @@ -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/setup-uv@v10.3.2 + - 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/setup-uv@v10.3.2 + 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/setup-uv@v10.3.2 + 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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 83250c9..07e36da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. @@ -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` diff --git a/LICENSE.md b/LICENSE.md index ab9f3c4..142caa8 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -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. \ No newline at end of file +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. diff --git a/README.md b/README.md index da11393..b1b9647 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@

- PSE Logo + PSE Logo

# pse-python-sdk @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 9dda883..c0617c4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,13 +1,25 @@ [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", ] @@ -15,14 +27,23 @@ dependencies = [ [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"] diff --git a/uv.lock b/uv.lock index 1593e42..40e0b50 100644 --- a/uv.lock +++ b/uv.lock @@ -621,7 +621,6 @@ wheels = [ [[package]] name = "pse-sdk" -version = "1.5.1" source = { editable = "." } dependencies = [ { name = "requests" }, @@ -652,9 +651,9 @@ provides-extras = ["pandas"] [package.metadata.requires-dev] dev = [ { name = "pandas", specifier = ">=1.5" }, - { name = "pytest" }, - { name = "responses" }, - { name = "ruff" }, + { name = "pytest", specifier = ">=8" }, + { name = "responses", specifier = ">=0.25" }, + { name = "ruff", specifier = ">=0.15" }, ] [[package]]