Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to development with Poetry #45

Merged
merged 9 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,36 @@ Would you like to contribute to the development of this project? Then read the p

Thank you for being involved! :heart_eyes:

## Setting up development environment

This Python project relies on [Poetry][poetry] as its dependency manager,
providing comprehensive management and control over project dependencies.

You need at least:

- Python 3.10+
- [Poetry][poetry-install]

Install all packages, including all development requirements:

```bash
poetry install
```

Poetry creates by default an virtual environment where it installs all
necessary pip packages, to enter or exit the venv run the following commands:

```bash
poetry shell
exit
```

To run just the Python tests:

```bash
poetry run pytest
```

## License

MIT License
Expand Down Expand Up @@ -149,3 +179,6 @@ SOFTWARE.
[commits-shield]: https://img.shields.io/github/commit-activity/y/home-assistant-libs/forecast_solar.svg?style=for-the-badge
[commits]: https://github.com/home-assistant-libs/forecast_solar/commits/master
[last-commit-shield]: https://img.shields.io/github/last-commit/home-assistant-libs/forecast_solar.svg?style=for-the-badge

[poetry-install]: https://python-poetry.org/docs/#installation
[poetry]: https://python-poetry.org
File renamed without changes.
970 changes: 970 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

60 changes: 60 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
[tool.poetry]
name = "forecast-solar"
version = "0.0.0"
description = "Asynchronous Python client for getting forecast solar information"
authors = ["Klaas Schoute <[email protected]>"]
maintainers = ["Klaas Schoute <[email protected]>"]
license = "MIT"
readme = "README.md"
homepage = "https://github.com/home-assistant-libs/forecast_solar"
repository = "https://github.com/home-assistant-libs/forecast_solar"
documentation = "https://github.com/home-assistant-libs/forecast_solar"
keywords = ["forecast", "solar", "power", "energy", "api", "async", "client"]
classifiers = [
"Framework :: AsyncIO",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3",
"Topic :: Software Development :: Libraries :: Python Modules",
]
packages = [
{ include = "forecast_solar", from = "src" },
]

[tool.poetry.dependencies]
aiohttp = ">=3.0.0"
aiodns = ">=3.0.0"
python = "^3.10"
klaasnicolaas marked this conversation as resolved.
Show resolved Hide resolved
yarl = ">=1.6.0"

[tool.poetry.urls]
"Bug Tracker" = "https://github.com/home-assistant-libs/forecast_solar/issues"
Changelog = "https://github.com/home-assistant-libs/forecast_solar/releases"

[tool.poetry.group.dev.dependencies]
black = "24.4.2"
covdefaults = "2.3.0"
coverage = {version = "7.5.0", extras = ["toml"]}
flake8 = "7.0.0"
pytest = "8.1.1"
pytest-asyncio = "0.23.6"
pytest-cov = "5.0.0"

[tool.coverage.run]
plugins = ["covdefaults"]
source = ["forecast_solar"]

[tool.coverage.report]
show_missing = true

[tool.pytest.ini_options]
addopts = "--cov"
asyncio_mode = "auto"

[build-system]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core>=1.0.0"]
MartinHjelmare marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 0 additions & 2 deletions requirements-test.txt

This file was deleted.

50 changes: 0 additions & 50 deletions setup.py

This file was deleted.

25 changes: 25 additions & 0 deletions src/forecast_solar/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""Asynchronous Python client for the Forecast.Solar API."""

from .exceptions import (
ForecastSolarError,
ForecastSolarConnectionError,
ForecastSolarConfigError,
ForecastSolarAuthenticationError,
ForecastSolarRequestError,
ForecastSolarRatelimit,
)
from .models import Estimate, AccountType, Ratelimit
from .forecast_solar import ForecastSolar

__all__ = [
"AccountType",
"Estimate",
"ForecastSolar",
"ForecastSolarAuthenticationError",
"ForecastSolarConfigError",
"ForecastSolarConnectionError",
"ForecastSolarError",
"ForecastSolarRatelimit",
"ForecastSolarRequestError",
"Ratelimit",
]
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Exceptions for Forecast.Solar."""

from datetime import datetime


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Asynchronous Python client for the Forecast.Solar API."""

from __future__ import annotations

from collections.abc import Mapping
Expand Down
1 change: 1 addition & 0 deletions forecast_solar/models.py → src/forecast_solar/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Data models for the Forecast.Solar API."""

from __future__ import annotations

from dataclasses import dataclass
Expand Down
1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests."""

from datetime import datetime
from unittest.mock import patch, Mock

Expand Down
1 change: 1 addition & 0 deletions tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test the models."""

from datetime import datetime
from forecast_solar import models
from . import PAYLOAD, patch_now, patch_previous_day, patch_near_end_today
Expand Down
Loading