Skip to content

Commit

Permalink
Switch to pyproject.toml (#816)
Browse files Browse the repository at this point in the history
  • Loading branch information
raman325 committed Nov 14, 2023
1 parent bbd48bb commit f786501
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 83 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ jobs:
pip install wheel
- name: Build
run: >-
python3 setup.py sdist bdist_wheel
pip install build
python -m build
- name: Publish release to PyPI
uses: pypa/gh-action-pypi-publish@v1.8.10
with:
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
exclude test/*
85 changes: 66 additions & 19 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,66 @@
[tool.ruff]
select = [
"D",
"E",
"F",
"G",
"I",
"PLC",
"PLE",
"PLR",
"PLW",
"UP",
"W",
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "zwave-js-server-python"
authors = [{ name = "Home Assistant Team", email = "hello@home-assistant.io" }]
description = "Python wrapper for zwave-js-server"
readme = "README.md"
requires-python = ">=3.11"
license = { file = "LICENSE" }
keywords = ["home", "automation", "zwave", "zwave-js"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Topic :: Home Automation",
]
dependencies = ["aiohttp>3", "pydantic>=1.10.0"]
dynamic = ["version"]

[project.urls]
"Source Code" = "https://github.com/home-assistant-libs/zwave-js-server-python"
"Bug Reports" = "https://github.com/home-assistant-libs/zwave-js-server-python/issues"

[project.scripts]
zwave-js-server-python = "zwave_js_server.__main__:main"

[tool.setuptools.dynamic]
version = { attr = "zwave_js_server.const.__version__" }

[tool.setuptools.packages.find]
exclude = ["test", "test.*", "scripts"]

[tool.setuptools.package-data]
zwave_js_server = ["py.typed"]

[tool.mypy]
plugins = ["pydantic.mypy"]
follow_imports = "skip"
ignore_missing_imports = true
check_untyped_defs = true
disallow_incomplete_defs = true
disallow_untyped_calls = true
disallow_untyped_defs = true
warn_return_any = false
warn_unreachable = true
warn_unused_ignores = true
warn_incomplete_stub = true
warn_redundant_casts = true
warn_unused_configs = true

[[tool.mypy.overrides]]
module = "mypy-test.*"
ignore_errors = true

[tool.pytest.ini_options]
asyncio_mode = "auto"

[tool.ruff]
select = ["D", "E", "F", "G", "I", "PLC", "PLE", "PLR", "PLW", "UP", "W"]
ignore = [
"D202",
"D212",
Expand All @@ -22,10 +71,10 @@ ignore = [
"PLR0912", # Too many branches ({branches} > {max_branches})
"PLR0913", # Too many arguments to function call ({c_args} > {max_args})
"PLR0915", # Too many statements ({statements} > {max_statements})
"PLR2004", # Magic value used in comparison, consider replacing {value} with a constant variable
"PLR2004", # Magic value used in comparison, consider replacing {value} with a constant variable
"PLW2901", # Outer {outer_kind} variable {name} overwritten by inner {inner_kind} target
"UP006", # keep type annotation style as is
"UP007", # keep type annotation style as is
"UP006", # keep type annotation style as is
"UP007", # keep type annotation style as is
]
exclude = [
".venv",
Expand All @@ -42,9 +91,7 @@ line-length = 88

[tool.ruff.isort]
force-sort-within-sections = true
known-first-party = [
"zwave_js_server",
]
known-first-party = ["zwave_js_server"]
combine-as-imports = true
split-on-trailing-comma = false
case-sensitive = true
20 changes: 0 additions & 20 deletions setup.cfg

This file was deleted.

38 changes: 0 additions & 38 deletions setup.py

This file was deleted.

4 changes: 2 additions & 2 deletions test/model/test_node.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Test the node model."""
import asyncio
from copy import deepcopy
from datetime import datetime, timezone
from datetime import UTC, datetime
import json
from typing import Any
from unittest.mock import AsyncMock, patch
Expand Down Expand Up @@ -185,7 +185,7 @@ def test_from_state(client):
},
)
node.receive_event(event)
assert node.last_seen == datetime(2023, 7, 18, 15, 42, 34, 701000, timezone.utc)
assert node.last_seen == datetime(2023, 7, 18, 15, 42, 34, 701000, UTC)


async def test_highest_security_value(lock_schlage_be469, ring_keypad):
Expand Down
3 changes: 1 addition & 2 deletions zwave_js_server/const/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@

from dataclasses import dataclass, field
from enum import Enum, IntEnum
from importlib import metadata
import logging
from typing import TypedDict

PACKAGE_NAME = "zwave-js-server-python"
__version__ = metadata.version(PACKAGE_NAME)
__version__ = "0.54.0"

# minimal server schema version we can handle
MIN_SERVER_SCHEMA_VERSION = 33
Expand Down
3 changes: 2 additions & 1 deletion zwave_js_server/event.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""Provide Event base classes for Z-Wave JS."""
from __future__ import annotations

from collections.abc import Callable
from dataclasses import dataclass, field
import logging
from typing import Callable, Literal
from typing import Literal

try:
from pydantic.v1 import BaseModel
Expand Down

0 comments on commit f786501

Please sign in to comment.