rlstatsapi 0.1.5__tar.gz → 0.1.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. {rlstatsapi-0.1.5/src/rlstatsapi.egg-info → rlstatsapi-0.1.7}/PKG-INFO +9 -8
  2. {rlstatsapi-0.1.5 → rlstatsapi-0.1.7}/README.md +7 -7
  3. {rlstatsapi-0.1.5 → rlstatsapi-0.1.7}/pyproject.toml +2 -2
  4. {rlstatsapi-0.1.5 → rlstatsapi-0.1.7}/src/rlstatsapi/__init__.py +6 -7
  5. {rlstatsapi-0.1.5 → rlstatsapi-0.1.7}/src/rlstatsapi/__main__.py +15 -2
  6. {rlstatsapi-0.1.5 → rlstatsapi-0.1.7}/src/rlstatsapi/client.py +413 -143
  7. {rlstatsapi-0.1.5 → rlstatsapi-0.1.7}/src/rlstatsapi/config.py +124 -25
  8. {rlstatsapi-0.1.5 → rlstatsapi-0.1.7}/src/rlstatsapi/events.py +3 -5
  9. rlstatsapi-0.1.7/src/rlstatsapi/models.py +142 -0
  10. rlstatsapi-0.1.7/src/rlstatsapi/state.py +214 -0
  11. {rlstatsapi-0.1.5 → rlstatsapi-0.1.7}/src/rlstatsapi/types.py +75 -9
  12. {rlstatsapi-0.1.5 → rlstatsapi-0.1.7/src/rlstatsapi.egg-info}/PKG-INFO +9 -8
  13. {rlstatsapi-0.1.5 → rlstatsapi-0.1.7}/src/rlstatsapi.egg-info/SOURCES.txt +2 -0
  14. {rlstatsapi-0.1.5 → rlstatsapi-0.1.7}/src/rlstatsapi.egg-info/requires.txt +1 -0
  15. rlstatsapi-0.1.7/tests/test_client.py +49 -0
  16. rlstatsapi-0.1.7/tests/test_client_unit.py +474 -0
  17. {rlstatsapi-0.1.5 → rlstatsapi-0.1.7}/tests/test_config.py +22 -13
  18. rlstatsapi-0.1.5/src/rlstatsapi/models.py +0 -61
  19. rlstatsapi-0.1.5/src/rlstatsapi/state.py +0 -110
  20. {rlstatsapi-0.1.5 → rlstatsapi-0.1.7}/LICENSE +0 -0
  21. {rlstatsapi-0.1.5 → rlstatsapi-0.1.7}/setup.cfg +0 -0
  22. {rlstatsapi-0.1.5 → rlstatsapi-0.1.7}/src/rlstatsapi/py.typed +0 -0
  23. {rlstatsapi-0.1.5 → rlstatsapi-0.1.7}/src/rlstatsapi.egg-info/dependency_links.txt +0 -0
  24. {rlstatsapi-0.1.5 → rlstatsapi-0.1.7}/src/rlstatsapi.egg-info/entry_points.txt +0 -0
  25. {rlstatsapi-0.1.5 → rlstatsapi-0.1.7}/src/rlstatsapi.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rlstatsapi
3
- Version: 0.1.5
3
+ Version: 0.1.7
4
4
  Summary: Rocket League Stats API client
5
5
  Author: Manuel Cabral
6
6
  License-Expression: MIT
@@ -19,17 +19,18 @@ License-File: LICENSE
19
19
  Provides-Extra: dev
20
20
  Requires-Dist: pytest>=8; extra == "dev"
21
21
  Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
22
+ Requires-Dist: black; extra == "dev"
22
23
  Dynamic: license-file
23
24
 
24
- <img width="600" alt="rlstatsapi-logo" src="https://github.com/manucabral/RocketLeagueStatsAPI/blob/main/docs/assets/social-preview.png" />
25
+ <img width="600" alt="rlstatsapi-logo" src="https://github.com/manucabral/rlstatsapi/blob/main/docs/assets/social-preview.png" />
25
26
 
26
27
  # Rocket League Stats API
27
- [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![PyPI version](https://img.shields.io/pypi/v/rlstatsapi.svg)](https://pypi.org/project/rlstatsapi/) [![Pylint](https://github.com/manucabral/RocketLeagueStatsAPI/actions/workflows/pylint.yml/badge.svg)](https://github.com/manucabral/RocketLeagueStatsAPI/actions/workflows/pylint.yml)
28
+ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![PyPI version](https://img.shields.io/pypi/v/rlstatsapi.svg)](https://pypi.org/project/rlstatsapi/) [![Pylint](https://github.com/manucabral/rlstatsapi/actions/workflows/pylint.yml/badge.svg)](https://github.com/manucabral/rlstatsapi/actions/workflows/pylint.yml)
28
29
  ![Downloads](https://img.shields.io/pypi/dm/rlstatsapi)
29
30
 
30
31
  `rlstatsapi` is a small Python client for reading live Rocket League Stats API events over a local TCP socket.
31
32
 
32
- - Full docs: [manucabral.github.io/RocketLeagueStatsAPI](https://manucabral.github.io/RocketLeagueStatsAPI/)
33
+ - Full docs: [manucabral.github.io/rlstatsapi](https://manucabral.github.io/rlstatsapi/)
33
34
  - Release history: [CHANGELOG.md](CHANGELOG.md)
34
35
 
35
36
  ## Install
@@ -43,7 +44,7 @@ pip install rlstatsapi
43
44
  From GitHub:
44
45
 
45
46
  ```bash
46
- pip install git+https://github.com/manucabral/RocketLeagueStatsAPI.git
47
+ pip install git+https://github.com/manucabral/rlstatsapi.git
47
48
  ```
48
49
 
49
50
  ## Rocket League setup
@@ -126,7 +127,7 @@ def on_goal(msg: EventMessage) -> None:
126
127
 
127
128
  ## More
128
129
 
129
- - Full docs: [manucabral.github.io/RocketLeagueStatsAPI](https://manucabral.github.io/RocketLeagueStatsAPI/)
130
+ - Full docs: [manucabral.github.io/rlstatsapi](https://manucabral.github.io/rlstatsapi/)
130
131
  - Examples: [examples/](examples)
131
132
  - Release history: [CHANGELOG.md](CHANGELOG.md)
132
133
 
@@ -144,6 +145,6 @@ Use this library at your own risk and in compliance with Rocket League’s terms
144
145
 
145
146
  ## Contributors
146
147
 
147
- <a href="https://github.com/manucabral/RocketLeagueStatsAPI/graphs/contributors">
148
- <img src="https://contrib.rocks/image?repo=manucabral/RocketLeagueStatsAPI" alt="Contributors" />
148
+ <a href="https://github.com/manucabral/rlstatsapi/graphs/contributors">
149
+ <img src="https://contrib.rocks/image?repo=manucabral/rlstatsapi" alt="Contributors" />
149
150
  </a>
@@ -1,12 +1,12 @@
1
- <img width="600" alt="rlstatsapi-logo" src="https://github.com/manucabral/RocketLeagueStatsAPI/blob/main/docs/assets/social-preview.png" />
1
+ <img width="600" alt="rlstatsapi-logo" src="https://github.com/manucabral/rlstatsapi/blob/main/docs/assets/social-preview.png" />
2
2
 
3
3
  # Rocket League Stats API
4
- [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![PyPI version](https://img.shields.io/pypi/v/rlstatsapi.svg)](https://pypi.org/project/rlstatsapi/) [![Pylint](https://github.com/manucabral/RocketLeagueStatsAPI/actions/workflows/pylint.yml/badge.svg)](https://github.com/manucabral/RocketLeagueStatsAPI/actions/workflows/pylint.yml)
4
+ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![PyPI version](https://img.shields.io/pypi/v/rlstatsapi.svg)](https://pypi.org/project/rlstatsapi/) [![Pylint](https://github.com/manucabral/rlstatsapi/actions/workflows/pylint.yml/badge.svg)](https://github.com/manucabral/rlstatsapi/actions/workflows/pylint.yml)
5
5
  ![Downloads](https://img.shields.io/pypi/dm/rlstatsapi)
6
6
 
7
7
  `rlstatsapi` is a small Python client for reading live Rocket League Stats API events over a local TCP socket.
8
8
 
9
- - Full docs: [manucabral.github.io/RocketLeagueStatsAPI](https://manucabral.github.io/RocketLeagueStatsAPI/)
9
+ - Full docs: [manucabral.github.io/rlstatsapi](https://manucabral.github.io/rlstatsapi/)
10
10
  - Release history: [CHANGELOG.md](CHANGELOG.md)
11
11
 
12
12
  ## Install
@@ -20,7 +20,7 @@ pip install rlstatsapi
20
20
  From GitHub:
21
21
 
22
22
  ```bash
23
- pip install git+https://github.com/manucabral/RocketLeagueStatsAPI.git
23
+ pip install git+https://github.com/manucabral/rlstatsapi.git
24
24
  ```
25
25
 
26
26
  ## Rocket League setup
@@ -103,7 +103,7 @@ def on_goal(msg: EventMessage) -> None:
103
103
 
104
104
  ## More
105
105
 
106
- - Full docs: [manucabral.github.io/RocketLeagueStatsAPI](https://manucabral.github.io/RocketLeagueStatsAPI/)
106
+ - Full docs: [manucabral.github.io/rlstatsapi](https://manucabral.github.io/rlstatsapi/)
107
107
  - Examples: [examples/](examples)
108
108
  - Release history: [CHANGELOG.md](CHANGELOG.md)
109
109
 
@@ -121,6 +121,6 @@ Use this library at your own risk and in compliance with Rocket League’s terms
121
121
 
122
122
  ## Contributors
123
123
 
124
- <a href="https://github.com/manucabral/RocketLeagueStatsAPI/graphs/contributors">
125
- <img src="https://contrib.rocks/image?repo=manucabral/RocketLeagueStatsAPI" alt="Contributors" />
124
+ <a href="https://github.com/manucabral/rlstatsapi/graphs/contributors">
125
+ <img src="https://contrib.rocks/image?repo=manucabral/rlstatsapi" alt="Contributors" />
126
126
  </a>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "rlstatsapi"
7
- version = "0.1.5"
7
+ version = "0.1.7"
8
8
  description = "Rocket League Stats API client"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -28,7 +28,7 @@ Repository = "https://github.com/manucabral/RocketLeagueStatsAPI"
28
28
  rlstatsapi = "rlstatsapi.__main__:main"
29
29
 
30
30
  [project.optional-dependencies]
31
- dev = ["pytest>=8", "pytest-asyncio>=0.23"]
31
+ dev = ["pytest>=8", "pytest-asyncio>=0.23", "black"]
32
32
 
33
33
  [tool.pytest.ini_options]
34
34
  asyncio_mode = "auto"
@@ -1,14 +1,11 @@
1
- """
2
- Public package surface for rlstatsapi.
1
+ """Public package interface for ``rlstatsapi``."""
3
2
 
4
- Re-exports the client, envelope model, known event constants, and typed payload
5
- helpers so consumers can import from `rlstatsapi` directly.
6
- """
3
+ from __future__ import annotations
7
4
 
8
5
  from importlib.metadata import PackageNotFoundError
9
6
  from importlib.metadata import version as _pkg_version
10
7
 
11
- from .client import StatsClient
8
+ from .client import ConnectionState, StatsClient
12
9
  from .config import (
13
10
  DEFAULT_PACKET_SEND_RATE,
14
11
  DEFAULT_STATS_API_FILENAME,
@@ -22,7 +19,7 @@ from .config import (
22
19
  set_stats_api_port,
23
20
  )
24
21
  from .events import KNOWN_EVENTS
25
- from .models import ClientMetrics, EventMessage, MatchStateSnapshot
22
+ from .models import ClientMetrics, EventMessage, MatchStateSnapshot, PlayerSnapshot
26
23
  from .state import MatchStateTracker
27
24
  from .types import (
28
25
  BallHitPayload,
@@ -58,10 +55,12 @@ except PackageNotFoundError:
58
55
  __all__ = [
59
56
  "__version__",
60
57
  "StatsClient",
58
+ "ConnectionState",
61
59
  "StatsAPIConfigStatus",
62
60
  "EventMessage",
63
61
  "ClientMetrics",
64
62
  "MatchStateSnapshot",
63
+ "PlayerSnapshot",
65
64
  "MatchStateTracker",
66
65
  "KNOWN_EVENTS",
67
66
  "DEFAULT_PACKET_SEND_RATE",
@@ -1,4 +1,4 @@
1
- """Command-line entrypoint for common rlstatsapi setup and debugging tasks."""
1
+ """Command-line interface for ``rlstatsapi`` configuration and live listening."""
2
2
 
3
3
  from __future__ import annotations
4
4
 
@@ -19,13 +19,21 @@ from .config import (
19
19
 
20
20
 
21
21
  def main(argv: Sequence[str] | None = None) -> int:
22
- """Parse CLI args and dispatch the requested command."""
22
+ """Parse CLI arguments and run the selected subcommand.
23
+
24
+ Args:
25
+ argv: Optional list of CLI arguments. Defaults to ``sys.argv[1:]``.
26
+
27
+ Returns:
28
+ int: Process exit code.
29
+ """
23
30
  parser = _build_parser()
24
31
  args = parser.parse_args(argv)
25
32
  return args.func(args)
26
33
 
27
34
 
28
35
  def _build_parser() -> argparse.ArgumentParser:
36
+ """Create the top-level argument parser and register subcommands."""
29
37
  parser = argparse.ArgumentParser(prog="rlstatsapi")
30
38
  subparsers = parser.add_subparsers(dest="command", required=True)
31
39
 
@@ -87,12 +95,14 @@ def _build_parser() -> argparse.ArgumentParser:
87
95
 
88
96
 
89
97
  def _run_status(args: argparse.Namespace) -> int:
98
+ """Print the current ``TAStatsAPI.ini`` status as formatted JSON."""
90
99
  status = get_stats_api_status(args.path)
91
100
  print(json.dumps(asdict(status), indent=2))
92
101
  return 0
93
102
 
94
103
 
95
104
  def _run_enable(args: argparse.Namespace) -> int:
105
+ """Enable the Stats API exporter in ``TAStatsAPI.ini`` and print the result."""
96
106
  status = configure_stats_api(
97
107
  enabled=True,
98
108
  port=args.port,
@@ -105,6 +115,7 @@ def _run_enable(args: argparse.Namespace) -> int:
105
115
 
106
116
 
107
117
  def _run_disable(args: argparse.Namespace) -> int:
118
+ """Disable the Stats API exporter in ``TAStatsAPI.ini`` and print the result."""
108
119
  status = configure_stats_api(
109
120
  enabled=False,
110
121
  port=args.port,
@@ -117,10 +128,12 @@ def _run_disable(args: argparse.Namespace) -> int:
117
128
 
118
129
 
119
130
  def _run_listen(args: argparse.Namespace) -> int:
131
+ """Run the async ``_listen`` coroutine from the synchronous CLI handler."""
120
132
  return asyncio.run(_listen(args))
121
133
 
122
134
 
123
135
  async def _listen(args: argparse.Namespace) -> int:
136
+ """Connect to the local Stats API and print incoming events until interrupted."""
124
137
  async with StatsClient(
125
138
  host=args.host,
126
139
  port=args.port,