Skip to content

Commit 05732f6

Browse files
dbrattliclaude
andauthored
RxPY v5 (#743)
* Add back fluent method chaining * Add windowing operators * Add more tests * Formatting * Update deps * Update docs * Curry flip * Use curry-flipping operators * Better generic types * Format test files with ruff Apply ruff formatting to all test files as Stage 0 of the test linting enablement plan. This separates formatting changes from type annotation work for cleaner diffs and easier review. Changes: - 19 files reformatted (mainly removing unnecessary line breaks) - 167 files already formatted (no changes) - All tests still pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Update ruff configuration for staged test linting Replace blanket "tests" exclusion with specific directory exclusions matching the pyright configuration. This aligns both tools and makes the staged rollout plan clearer. Changes: - Remove generic "tests" from ruff exclude list - Add specific test directories to exclude - Both ruff and pyright now have identical test exclusions - Will remove exclusions incrementally as each stage completes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent a999275 commit 05732f6

File tree

140 files changed

+12951
-3627
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+12951
-3627
lines changed

README.rst

Lines changed: 52 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
===============================
21
The ReactiveX for Python (RxPY)
32
===============================
3+
===============================
44

55
.. image:: https://github.com/ReactiveX/RxPY/workflows/Python%20package/badge.svg
66
:target: https://github.com/ReactiveX/RxPY/actions
@@ -59,6 +59,43 @@ Schedulers.
5959
composed.subscribe(lambda value: print("Received {0}".format(value)))
6060
6161
62+
Fluent and Functional Syntax
63+
-----------------------------
64+
65+
RxPY supports both **fluent** (method chaining) and **functional** (pipe-based) syntax,
66+
giving you the flexibility to choose the style that works best for your codebase:
67+
68+
**Fluent style** - Method chaining for a more Pythonic feel:
69+
70+
.. code:: python
71+
72+
import reactivex as rx
73+
74+
result = (rx.of(1, 2, 3, 4, 5)
75+
.map(lambda x: x * 2)
76+
.filter(lambda x: x > 5)
77+
.reduce(lambda acc, x: acc + x, 0)
78+
)
79+
result.subscribe(print) # Output: 24
80+
81+
**Functional style** - Pipe-based for functional composition:
82+
83+
.. code:: python
84+
85+
import reactivex as rx
86+
from reactivex import operators as ops
87+
88+
result = rx.of(1, 2, 3, 4, 5).pipe(
89+
ops.map(lambda x: x * 2),
90+
ops.filter(lambda x: x > 5),
91+
ops.reduce(lambda acc, x: acc + x, 0)
92+
)
93+
result.subscribe(print) # Output: 24
94+
95+
Both styles are **fully supported** and can even be mixed in the same pipeline.
96+
Choose the style that best fits your team's preferences and coding standards.
97+
98+
6299
Learning ReactiveX
63100
------------------
64101

@@ -106,8 +143,12 @@ need to be written with an ``_`` in Python:
106143

107144
.. code:: python
108145
146+
# Functional style
109147
group = source.pipe(ops.group_by(lambda i: i % 3))
110148
149+
# Or fluent style
150+
group = source.group_by(lambda i: i % 3)
151+
111152
With ReactiveX for Python you should use `named keyword arguments
112153
<https://docs.python.org/3/glossary.html>`_ instead of positional arguments when an
113154
operator has multiple optional arguments. RxPY will not try to detect which arguments
@@ -116,34 +157,30 @@ you are giving to the operator (or not).
116157
Development
117158
-----------
118159

119-
This project is managed using `Poetry <https://python-poetry.org/>`_. Code is formatted
120-
using `Black <https://github.com/psf/black>`_, `isort
121-
<https://github.com/PyCQA/isort>`_. Code is statically type checked using `pyright
122-
<https://github.com/microsoft/pyright>`_ and `mypy <http://mypy-lang.org/>`_.
160+
This project is managed using `uv <https://docs.astral.sh/uv/>`_. Code is formatted
161+
using `Ruff <https://github.com/astral-sh/ruff>`_. Code is statically type checked
162+
using `pyright <https://github.com/microsoft/pyright>`_.
123163

124-
If you want to take advantage of the default VSCode integration, then
125-
first configure Poetry to make its virtual environment in the
126-
repository:
164+
After cloning the repository, install dependencies:
127165

128166
.. code:: console
129167
130-
poetry config virtualenvs.in-project true
168+
uv sync
131169
132-
After cloning the repository, activate the tooling:
170+
Run unit tests:
133171

134172
.. code:: console
135173
136-
poetry install
137-
poetry run pre-commit install
174+
uv run pytest
138175
139-
Run unit tests:
176+
Run type checking:
140177

141178
.. code:: console
142179
143-
poetry run pytest
180+
uv run pyright
144181
145182
Run code checks (manually):
146183

147184
.. code:: console
148185
149-
poetry run pre-commit run --all-files
186+
uv run pre-commit run --all-files

0 commit comments

Comments
 (0)