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
5 changes: 3 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ Currently, the package supports the *common* and *FILL RATE BASED CONTROL* types

To Install
-----------
You can install this package using pip or any Python dependency manager that collects the packages from Pypi:
You can install this package using pip or any Python dependency manager that collects the packages from PyPI:

.. code-block:: bash

pip install s2-python
pip install s2-python[ws] # for S2 over WebSockets

The packages on Pypi may be found `here <https://pypi.org/project/s2-python/>`_
The packages on PyPI may be found `here <https://pypi.org/project/s2-python/>`_

Mypy support
------------
Expand Down
60 changes: 59 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,61 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
build-backend = "setuptools.build_meta"

[project]
name = "s2-python"
authors = [
{name = "Flexiblepower", email = "info@info.nl"}
]
description = "S2 Protocol Python Wrapper"
version = "0.5.0"
readme = "README.rst"
license = "Apache-2.0"
license-files = ["LICENSE"]
requires-python = ">=3.8, < 3.13"
dependencies = [
"pydantic>=2.8.2",
"pytz",
"click",
]
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
[project.urls]
"Source code" = "https://github.com/flexiblepower/s2-ws-json-python"

[project.optional-dependencies]
ws = [
"websockets~=13.1",
]
testing = [
"pytest",
"pytest-coverage",
"pytest-timer",
"mypy",
"types-pytz",
"pylint",
"pyright",
]
development = [
"pip-tools",
"datamodel-code-generator",
"pre-commit",
"tox",
]
docs = [
"sphinx",
"sphinx-rtd-theme >= 1.2",
"sphinx-tabs",
"sphinx_copybutton",
"sphinx_fontawesome",
"sphinxcontrib.httpdomain",
]

[project.scripts]
s2python = "s2python.tools.cli:s2python_cmd"
63 changes: 0 additions & 63 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,83 +1,20 @@
[metadata]
name = s2-python
description = S2 Protocol Python Wrapper
author = Flexiblepower
author_email = info@info.nl
license = APACHE
license_files = LICENSE.txt
long_description = file: README.rst
long_description_content_type = text/x-rst; charset=UTF-8
url = https://github.com/flexiblepower/s2-ws-json-python
version = 0.5.0

# Change if running only on Windows, Mac or Linux (comma-separated)
platforms = Linux

# Add here all kinds of additional classifiers as defined under
# https://pypi.org/classifiers/
classifiers =
Development Status :: 4 - Beta
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12


[options]
zip_safe = False
packages = find_namespace:
include_package_data = True
package_dir =
=src

# Require a min/specific Python version (comma-separated conditions)
python_requires >= 3.8, <= 3.12

# Add here dependencies of your project (line-separated), e.g. requests>=2.2,<3.0.
# Version specifiers like >=2.2,<3.0 avoid problems due to API changes in
# new major versions. This works if the required packages follow Semantic Versioning.
# For more information, check out https://semver.org/.
install_requires =
pydantic>=2.8.2
pytz
click
websockets~=13.1

[options.packages.find]
where = src
exclude =
tests

[options.extras_require]
testing =
pytest
pytest-coverage
pytest-timer
mypy
types-pytz
pylint
pyright


development =
pip-tools
datamodel-code-generator
pre-commit
tox

docs =
sphinx
sphinx-rtd-theme >= 1.2
sphinx-tabs
sphinx_copybutton
sphinx_fontawesome
sphinxcontrib.httpdomain

[options.entry_points]
console_scripts =
s2python = s2python.tools.cli:s2python_cmd

[tool:pytest]
addopts =
--cov=s2python
Expand Down
8 changes: 7 additions & 1 deletion src/s2python/s2_connection.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
try:
import websockets
except ImportError as exc:
raise ImportError(
"The 'websockets' package is required. Run 'pip install s2-python[ws]' to use this feature."
) from exc

import asyncio
import json
import logging
Expand All @@ -8,7 +15,6 @@
from dataclasses import dataclass
from typing import Any, Optional, List, Type, Dict, Callable, Awaitable, Union

import websockets
from websockets.asyncio.client import (
ClientConnection as WSConnection,
connect as ws_connect,
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ passenv =
SETUPTOOLS_*
extras =
testing
ws
commands =
pytest {posargs}

Expand Down