fluxwave 0.1.0__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 (86) hide show
  1. fluxwave-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +41 -0
  2. fluxwave-0.1.0/.github/ISSUE_TEMPLATE/config.yml +8 -0
  3. fluxwave-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +27 -0
  4. fluxwave-0.1.0/.github/pull_request_template.md +22 -0
  5. fluxwave-0.1.0/.github/workflows/ci.yml +28 -0
  6. fluxwave-0.1.0/.github/workflows/release.yml +61 -0
  7. fluxwave-0.1.0/.gitignore +11 -0
  8. fluxwave-0.1.0/.readthedocs.yaml +22 -0
  9. fluxwave-0.1.0/CHANGELOG.md +76 -0
  10. fluxwave-0.1.0/CONTRIBUTING.md +68 -0
  11. fluxwave-0.1.0/LICENSE +21 -0
  12. fluxwave-0.1.0/PKG-INFO +456 -0
  13. fluxwave-0.1.0/README.md +410 -0
  14. fluxwave-0.1.0/SECURITY.md +33 -0
  15. fluxwave-0.1.0/docs/api/index.md +393 -0
  16. fluxwave-0.1.0/docs/conf.py +14 -0
  17. fluxwave-0.1.0/docs/getting-started.md +108 -0
  18. fluxwave-0.1.0/docs/guide/advanced.md +117 -0
  19. fluxwave-0.1.0/docs/guide/api-stability.md +82 -0
  20. fluxwave-0.1.0/docs/guide/events.md +80 -0
  21. fluxwave-0.1.0/docs/guide/examples.md +227 -0
  22. fluxwave-0.1.0/docs/guide/faq.md +133 -0
  23. fluxwave-0.1.0/docs/guide/hosting.md +133 -0
  24. fluxwave-0.1.0/docs/guide/migration.md +123 -0
  25. fluxwave-0.1.0/docs/guide/nodes.md +201 -0
  26. fluxwave-0.1.0/docs/guide/persistence-observability.md +127 -0
  27. fluxwave-0.1.0/docs/guide/player.md +126 -0
  28. fluxwave-0.1.0/docs/guide/plugin-compatibility.md +168 -0
  29. fluxwave-0.1.0/docs/guide/plugins.md +140 -0
  30. fluxwave-0.1.0/docs/guide/queue-filters.md +137 -0
  31. fluxwave-0.1.0/docs/guide/search-autoplay.md +182 -0
  32. fluxwave-0.1.0/docs/guide/testing-release.md +101 -0
  33. fluxwave-0.1.0/docs/guide/troubleshooting.md +161 -0
  34. fluxwave-0.1.0/docs/index.md +100 -0
  35. fluxwave-0.1.0/docs/product-design.md +191 -0
  36. fluxwave-0.1.0/examples/advanced_bot.py +773 -0
  37. fluxwave-0.1.0/examples/basic_bot.py +195 -0
  38. fluxwave-0.1.0/pyproject.toml +102 -0
  39. fluxwave-0.1.0/src/fluxwave/__init__.py +268 -0
  40. fluxwave-0.1.0/src/fluxwave/__main__.py +70 -0
  41. fluxwave-0.1.0/src/fluxwave/_libraries.py +100 -0
  42. fluxwave-0.1.0/src/fluxwave/_meta.py +7 -0
  43. fluxwave-0.1.0/src/fluxwave/autoplay.py +162 -0
  44. fluxwave-0.1.0/src/fluxwave/backoff.py +51 -0
  45. fluxwave-0.1.0/src/fluxwave/cache.py +86 -0
  46. fluxwave-0.1.0/src/fluxwave/events.py +321 -0
  47. fluxwave-0.1.0/src/fluxwave/exceptions.py +148 -0
  48. fluxwave-0.1.0/src/fluxwave/filters.py +682 -0
  49. fluxwave-0.1.0/src/fluxwave/formatting.py +136 -0
  50. fluxwave-0.1.0/src/fluxwave/metrics.py +114 -0
  51. fluxwave-0.1.0/src/fluxwave/node.py +1389 -0
  52. fluxwave-0.1.0/src/fluxwave/persistence.py +381 -0
  53. fluxwave-0.1.0/src/fluxwave/player.py +1870 -0
  54. fluxwave-0.1.0/src/fluxwave/plugins.py +243 -0
  55. fluxwave-0.1.0/src/fluxwave/pool.py +398 -0
  56. fluxwave-0.1.0/src/fluxwave/py.typed +1 -0
  57. fluxwave-0.1.0/src/fluxwave/queue.py +576 -0
  58. fluxwave-0.1.0/src/fluxwave/rest.py +360 -0
  59. fluxwave-0.1.0/src/fluxwave/results.py +71 -0
  60. fluxwave-0.1.0/src/fluxwave/routeplanner.py +34 -0
  61. fluxwave-0.1.0/src/fluxwave/router.py +127 -0
  62. fluxwave-0.1.0/src/fluxwave/search.py +136 -0
  63. fluxwave-0.1.0/src/fluxwave/tracing.py +135 -0
  64. fluxwave-0.1.0/src/fluxwave/tracks.py +1021 -0
  65. fluxwave-0.1.0/src/fluxwave/types.py +7 -0
  66. fluxwave-0.1.0/src/fluxwave/versioning.py +136 -0
  67. fluxwave-0.1.0/src/fluxwave/watchdog.py +209 -0
  68. fluxwave-0.1.0/src/fluxwave/websocket.py +416 -0
  69. fluxwave-0.1.0/tests/test_audit_fixes.py +310 -0
  70. fluxwave-0.1.0/tests/test_bugfixes.py +158 -0
  71. fluxwave-0.1.0/tests/test_cache.py +39 -0
  72. fluxwave-0.1.0/tests/test_events.py +54 -0
  73. fluxwave-0.1.0/tests/test_features.py +166 -0
  74. fluxwave-0.1.0/tests/test_filters.py +128 -0
  75. fluxwave-0.1.0/tests/test_imports.py +30 -0
  76. fluxwave-0.1.0/tests/test_integration_lavalink.py +79 -0
  77. fluxwave-0.1.0/tests/test_models.py +212 -0
  78. fluxwave-0.1.0/tests/test_node_websocket.py +950 -0
  79. fluxwave-0.1.0/tests/test_player.py +1243 -0
  80. fluxwave-0.1.0/tests/test_plugins.py +85 -0
  81. fluxwave-0.1.0/tests/test_pool.py +123 -0
  82. fluxwave-0.1.0/tests/test_queue.py +287 -0
  83. fluxwave-0.1.0/tests/test_rest.py +193 -0
  84. fluxwave-0.1.0/tests/test_rest_transport.py +113 -0
  85. fluxwave-0.1.0/tests/test_search.py +109 -0
  86. fluxwave-0.1.0/tests/test_soak.py +285 -0
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: Bug report
3
+ about: Report something not working as expected
4
+ title: "[Bug] "
5
+ labels: bug
6
+ ---
7
+
8
+ ## Description
9
+
10
+ A clear description of the bug.
11
+
12
+ ## Reproduction
13
+
14
+ A minimal code snippet that triggers it. **Do not include real bot tokens or
15
+ Lavalink passwords.**
16
+
17
+ ```python
18
+ # ...
19
+ ```
20
+
21
+ ## Expected vs actual behavior
22
+
23
+ What you expected to happen, and what actually happened.
24
+
25
+ ## Traceback / logs
26
+
27
+ ```
28
+ paste the full traceback here
29
+ ```
30
+
31
+ ## Environment
32
+
33
+ - FluxWave version:
34
+ - Python version:
35
+ - Discord library + version (discord.py / py-cord / nextcord / disnake):
36
+ - Lavalink version (`GET /version`):
37
+ - OS:
38
+
39
+ ## Additional context
40
+
41
+ Anything else that might help (plugins installed, multi-node setup, etc.).
@@ -0,0 +1,8 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: Question / usage help
4
+ url: https://github.com/NobitaDeveloper/fluxwave/discussions
5
+ about: Ask questions and get help here instead of opening an issue.
6
+ - name: Documentation
7
+ url: https://github.com/NobitaDeveloper/fluxwave/tree/main/docs
8
+ about: Guides, API reference, and the FAQ.
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea or improvement
4
+ title: "[Feature] "
5
+ labels: enhancement
6
+ ---
7
+
8
+ ## Problem
9
+
10
+ What are you trying to do that FluxWave doesn't support today?
11
+
12
+ ## Proposed solution
13
+
14
+ The API or behavior you'd like. Sketch a usage example if you can:
15
+
16
+ ```python
17
+ # ...
18
+ ```
19
+
20
+ ## Alternatives considered
21
+
22
+ Other approaches or existing workarounds.
23
+
24
+ ## Additional context
25
+
26
+ Links to how other clients (wavelink, pomice, lavalink.py) handle this, if
27
+ relevant.
@@ -0,0 +1,22 @@
1
+ ## What does this PR do?
2
+
3
+ Brief description of the change and the motivation.
4
+
5
+ Fixes #(issue) <!-- if applicable -->
6
+
7
+ ## Type of change
8
+
9
+ - [ ] Bug fix
10
+ - [ ] New feature
11
+ - [ ] Breaking change
12
+ - [ ] Docs / internal only
13
+
14
+ ## Checklist
15
+
16
+ - [ ] `ruff check .` passes
17
+ - [ ] `ruff format --check .` passes
18
+ - [ ] `mypy` passes
19
+ - [ ] `pytest` passes
20
+ - [ ] Added/updated tests (a bug fix includes a regression test)
21
+ - [ ] Updated docs for any public API change
22
+ - [ ] No secrets (tokens/passwords) committed
@@ -0,0 +1,28 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ jobs:
8
+ test:
9
+ runs-on: ubuntu-latest
10
+ strategy:
11
+ matrix:
12
+ python-version: ["3.11", "3.12", "3.13", "3.14"]
13
+
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: actions/setup-python@v5
17
+ with:
18
+ python-version: ${{ matrix.python-version }}
19
+ - name: Install
20
+ run: python -m pip install -e ".[dev]"
21
+ - name: Ruff
22
+ run: ruff check .
23
+ - name: Format
24
+ run: ruff format --check .
25
+ - name: Mypy
26
+ run: mypy
27
+ - name: Tests
28
+ run: pytest
@@ -0,0 +1,61 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ jobs:
9
+ build:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - uses: actions/setup-python@v5
14
+ with:
15
+ python-version: "3.11"
16
+ - name: Install build
17
+ run: python -m pip install build
18
+ - name: Build distributions
19
+ run: python -m build
20
+ - name: Upload distributions
21
+ uses: actions/upload-artifact@v4
22
+ with:
23
+ name: dist
24
+ path: dist/
25
+
26
+ pypi-publish:
27
+ needs: build
28
+ runs-on: ubuntu-latest
29
+ # Configure a "pypi" environment with a PyPI trusted publisher for this repo
30
+ # and the release.yml workflow. No API token needed — OIDC handles auth.
31
+ environment:
32
+ name: pypi
33
+ url: https://pypi.org/p/fluxwave
34
+ permissions:
35
+ id-token: write
36
+ steps:
37
+ - name: Download distributions
38
+ uses: actions/download-artifact@v4
39
+ with:
40
+ name: dist
41
+ path: dist/
42
+ - name: Publish to PyPI
43
+ uses: pypa/gh-action-pypi-publish@release/v1
44
+
45
+ github-release:
46
+ needs: build
47
+ runs-on: ubuntu-latest
48
+ permissions:
49
+ contents: write
50
+ steps:
51
+ - uses: actions/checkout@v4
52
+ - name: Download distributions
53
+ uses: actions/download-artifact@v4
54
+ with:
55
+ name: dist
56
+ path: dist/
57
+ - name: Create GitHub Release
58
+ uses: softprops/action-gh-release@v2
59
+ with:
60
+ files: dist/*
61
+ generate_release_notes: true
@@ -0,0 +1,11 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ .mypy_cache/
5
+ .pytest_cache/
6
+ .ruff_cache/
7
+ .venv/
8
+ build/
9
+ dist/
10
+ docs/_build/
11
+ mytestbot.py
@@ -0,0 +1,22 @@
1
+ # Read the Docs configuration. https://docs.readthedocs.io/en/stable/config-file/v2.html
2
+ version: 2
3
+
4
+ build:
5
+ os: ubuntu-24.04
6
+ tools:
7
+ python: "3.12"
8
+
9
+ sphinx:
10
+ configuration: docs/conf.py
11
+
12
+ # Install the package with its docs extra (Sphinx + MyST + furo). The package
13
+ # itself depends only on aiohttp; no Discord library is needed to build the docs.
14
+ python:
15
+ install:
16
+ - method: pip
17
+ path: .
18
+ extra_requirements:
19
+ - docs
20
+
21
+ formats:
22
+ - pdf
@@ -0,0 +1,76 @@
1
+ # Changelog
2
+
3
+ All notable changes to FluxWave are documented in this file. The format is based
4
+ on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project aims
5
+ to follow [Semantic Versioning](https://semver.org/) once it reaches `1.0`.
6
+
7
+ ## [0.1.0a0] — 2026-05-29
8
+
9
+ First public pre-release. The core API is usable for beta bots and testing;
10
+ public APIs may still change before `1.0`. Requires Python 3.11+, `aiohttp`, a
11
+ Lavalink v4 server, and any one of discord.py / py-cord / nextcord / disnake.
12
+
13
+ ### Core
14
+
15
+ - Async Lavalink v4 client with a typed REST layer and a websocket event layer
16
+ (ready / stats / playerUpdate / events, session resume, jittered reconnect).
17
+ - Library-agnostic: FluxWave depends only on `aiohttp` and auto-detects whichever
18
+ Discord library is installed (discord.py, py-cord, nextcord, or disnake).
19
+ `FLUXWAVE_DISCORD_LIBRARY` / `FLUXWAVE_IGNORE_LIBRARY_CHECK` override detection.
20
+ - Strict typing throughout with a `py.typed` marker.
21
+ - Connect-time Lavalink version validation with clear unsupported/newer warnings.
22
+
23
+ ### Nodes and pools
24
+
25
+ - `Node` owns one Lavalink server; `NodePool` is instance-first and the global
26
+ `Pool` facade offers wavelink-style helpers (every `Pool` member is a classmethod,
27
+ called as `Pool.x(...)`).
28
+ - Health-aware selection with region/shard awareness (`NodeSelectionStrategy`),
29
+ blacklist/cooldowns, degraded-node detection, parallel multi-node `search_all`,
30
+ and graceful `drain`.
31
+ - Automatic player migration on node failure and return-to-home-node once a failed
32
+ node recovers.
33
+ - LFU search cache plus in-flight request coalescing so concurrent identical
34
+ searches share a single Lavalink request.
35
+
36
+ ### Players and playback
37
+
38
+ - `FluxPlayer` is a Discord `VoiceProtocol`: `channel.connect(cls=fluxwave.FluxPlayer)`
39
+ resolves a node from the connected `Pool` automatically.
40
+ - `play`, `enqueue`, `play_search`, `play_next`, `skip`, `stop`, `pause`, `resume`,
41
+ `seek`, `set_volume`, `move_to`, `switch_node`, `disconnect`/`destroy`.
42
+ - Position tracking, voice-state recovery, empty-channel auto-pause/resume/disconnect,
43
+ and Pomice-style state aliases (`is_connected`, `is_playing`, `is_paused`, `is_dead`).
44
+
45
+ ### Queue and filters
46
+
47
+ - Queue with history, loop modes, async waiters, move/shuffle/dedupe, range clearing,
48
+ search, total duration, capacity limits, and raw serialization round-trips.
49
+ - Lavalink filters with ergonomic components, presets (nightcore, vaporwave,
50
+ bass boost), `set_filters(..., seek=True)`, a tagged filter stack, and interpolation.
51
+
52
+ ### Search, events, and plugins
53
+
54
+ - Search helpers for `ytsearch:`/`ytmsearch:`/`scsearch:`/etc., direct URLs,
55
+ playlists, empty results, and load errors, with default-source prefixing.
56
+ - Typed public events with both `fluxwave_*` and wavelink-style aliases, a raw
57
+ websocket event, and global `listen`/`dispatch` helpers.
58
+ - Plugin helpers for LavaLyrics, LavaSrc, and SponsorBlock, plus custom REST routes.
59
+
60
+ ### Autoplay, persistence, and observability
61
+
62
+ - Autoplay with provider-based recommendations, duplicate filtering, and a partial
63
+ mode (`AutoPlayMode`).
64
+ - Player state persistence via `save_state`/`restore_state`, a `MemoryStore`, and a
65
+ crash-safe on-disk `FileStore`.
66
+ - `VoiceWatchdog` for stalled-playback recovery, `WrapperMetrics` operation counters,
67
+ and an `EventTracer` — all wired into live operations.
68
+ - `SourceRouter` for glob-based per-source node routing.
69
+
70
+ ### Tooling
71
+
72
+ - `python -m fluxwave --version` diagnostics CLI.
73
+ - Library-agnostic display helpers (`progress_bar`, `format_duration`,
74
+ `paginate_queue`).
75
+ - Documentation site, beginner and advanced example bots, and a `release.yml`
76
+ publish pipeline.
@@ -0,0 +1,68 @@
1
+ # Contributing to FluxWave
2
+
3
+ Thanks for your interest in improving FluxWave! This guide covers the local
4
+ setup and the checks every change must pass.
5
+
6
+ ## Development setup
7
+
8
+ FluxWave targets Python 3.11+. Clone the repo and install the dev extras into a
9
+ virtual environment:
10
+
11
+ ```bash
12
+ git clone https://github.com/NobitaDeveloper/fluxwave.git
13
+ cd fluxwave
14
+ python -m venv .venv
15
+ source .venv/bin/activate # Windows: .venv\Scripts\activate
16
+ python -m pip install -e ".[dev,docs]"
17
+ ```
18
+
19
+ The `dev` extra installs `discord.py` so the test suite has a Discord library to
20
+ run against. FluxWave itself works with discord.py, py-cord, nextcord, or disnake.
21
+
22
+ ## Checks
23
+
24
+ CI runs these on every push and pull request (Python 3.11–3.14). Run them locally
25
+ before opening a PR:
26
+
27
+ ```bash
28
+ ruff check . # lint
29
+ ruff format --check . # formatting
30
+ mypy # strict type checking
31
+ pytest # unit tests
32
+ ```
33
+
34
+ `ruff format .` will auto-format your changes.
35
+
36
+ ## Tests
37
+
38
+ - Unit tests live in `tests/` and must not require a network connection.
39
+ - Add or update tests for any behavior change; bug fixes should include a
40
+ regression test that fails before the fix.
41
+ - Integration tests are marked `@pytest.mark.integration` and require a real
42
+ Lavalink v4 server:
43
+
44
+ ```bash
45
+ LAVALINK_HOST=127.0.0.1 LAVALINK_PORT=2333 LAVALINK_PASSWORD=youshallnotpass \
46
+ LAVALINK_SECURE=false pytest -m integration tests/test_integration_lavalink.py
47
+ ```
48
+
49
+ ## Pull requests
50
+
51
+ 1. Branch off `main`.
52
+ 2. Keep changes focused; one logical change per PR.
53
+ 3. Make sure all four checks above pass and docs are updated if you changed the
54
+ public API.
55
+ 4. Describe what changed and why in the PR body.
56
+
57
+ ## Reporting bugs
58
+
59
+ Open a [GitHub issue](https://github.com/NobitaDeveloper/fluxwave/issues)
60
+ with FluxWave/Python/Lavalink versions, a minimal reproduction, and the full
61
+ traceback. Never paste real bot tokens or Lavalink passwords.
62
+
63
+ ## Code style
64
+
65
+ - Strictly typed (`mypy --strict`, `py.typed`); add precise type hints.
66
+ - Match the surrounding code's naming and structure.
67
+ - Public API additions should be exported from `fluxwave/__init__.py` and
68
+ documented under `docs/`.
fluxwave-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 FluxWave Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.