Skip to content

Commit

Permalink
Merge pull request #623 from ReactiveX/docs-version
Browse files Browse the repository at this point in the history
Fix version for docs
  • Loading branch information
dbrattli authored Mar 5, 2022
2 parents 534eae5 + 310394f commit d836284
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 29 deletions.
7 changes: 4 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.

import os
import re
import sys
from distutils.command.config import config

import guzzle_sphinx_theme
import tomli
from dunamai import Version

root = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
sys.path.insert(0, root)
Expand All @@ -39,10 +39,11 @@
url = project_meta["homepage"]
title = project + " Documentation"

_version = Version.from_git()
# The full version, including alpha/beta/rc tags
release = project_meta["version"]
release = _version.serialize(metadata=False)
# The short X.Y.Z version
version = re.sub("[^0-9.].*$", "", release)
version = _version.base


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/get_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ To achieve concurrency, you use two operators: :func:`subscribe_on()
<reactivex.operators.subscribe_on>` and :func:`observe_on() <reactivex.operators.observe_on>`.
Both need a :ref:`Scheduler <reference_scheduler>` which provides a thread for
each subscription to do work (see section on Schedulers below). The
:class:`ThreadPoolScheduler <rx.scheduler.ThreadPoolScheduler>` is a good
:class:`ThreadPoolScheduler <reactivex.scheduler.ThreadPoolScheduler>` is a good
choice to create a pool of reusable worker threads.

.. attention::
Expand Down
6 changes: 3 additions & 3 deletions docs/migration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,13 @@ Some packages were renamed:
+-----------------------+-------------------------+
| Old name | New name |
+-----------------------+-------------------------+
| *rx.concurrency* | *rx.scheduler* |
| *rx.concurrency* | *reactivex.scheduler* |
+-----------------------+-------------------------+
| *rx.disposables* | *rx.disposable* |
+-----------------------+-------------------------+
| *rx.subjects* | *rx.subject* |
+-----------------------+-------------------------+

Furthermore, the package formerly known as *rx.concurrency.mainloopscheduler*
has been split into two parts, *rx.scheduler.mainloop* and
*rx.scheduler.eventloop*.
has been split into two parts, *reactivex.scheduler.mainloop* and
*reactivex.scheduler.eventloop*.
6 changes: 3 additions & 3 deletions docs/reference_scheduler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
Schedulers
===========

.. automodule:: rx.scheduler
.. automodule:: reactivex.scheduler
:members: CatchScheduler, CurrentThreadScheduler, EventLoopScheduler,
HistoricalScheduler, ImmediateScheduler, NewThreadScheduler,
ThreadPoolScheduler, TimeoutScheduler, TrampolineScheduler,
VirtualTimeScheduler

.. automodule:: rx.scheduler.eventloop
.. automodule:: reactivex.scheduler.eventloop
:members: AsyncIOScheduler, AsyncIOThreadSafeScheduler, EventletScheduler,
GEventScheduler, IOLoopScheduler, TwistedScheduler

.. automodule:: rx.scheduler.mainloop
.. automodule:: reactivex.scheduler.mainloop
:members: GtkScheduler, PyGameScheduler, QtScheduler,
TkinterScheduler, WxScheduler
2 changes: 1 addition & 1 deletion docs/reference_typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
Typing
=======

.. automodule:: rx.typing
.. automodule:: reactivex.typing
:members:
3 changes: 2 additions & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ sphinx>=2.0
sphinx-autodoc-typehints>=1.10.3
guzzle_sphinx_theme>=0.7.11
sphinxcontrib_dooble>=1.0
tomli>=2.0
tomli>=2.0
dunamai>=1.9.0
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@
"\n",
" 1 - res = source.sample(sample_observable) # Sampler tick sequence\n",
" 2 - res = source.sample(5000) # 5 seconds\n",
" 2 - res = source.sample(5000, rx.scheduler.timeout) # 5 seconds\n",
" 2 - res = source.sample(5000, reactivex.scheduler.timeout) # 5 seconds\n",
"\n",
" Keyword arguments:\n",
" source -- Source sequence to sample.\n",
Expand Down
10 changes: 5 additions & 5 deletions notebooks/reactivex.io/Part VII - Meta Operations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -501,15 +501,15 @@
"\n",
"# start simple:\n",
"header('Switching Schedulers')\n",
"s = O.just(42, rx.scheduler.ImmediateScheduler())\n",
"d = subs(s.subscribe_on(rx.scheduler.TimeoutScheduler()), name='SimpleSubs')\n",
"s = O.just(42, reactivex.scheduler.ImmediateScheduler())\n",
"d = subs(s.subscribe_on(reactivex.scheduler.TimeoutScheduler()), name='SimpleSubs')\n",
"\n",
"sleep(0.1)\n",
"\n",
"header('Custom Subscription Side Effects')\n",
"\n",
"from rx.scheduler.newthreadscheduler import NewThreadScheduler\n",
"from rx.scheduler.eventloopscheduler import EventLoopScheduler\n",
"from reactivex.scheduler.newthreadscheduler import NewThreadScheduler\n",
"from reactivex.scheduler.eventloopscheduler import EventLoopScheduler\n",
"\n",
"class MySched(NewThreadScheduler):\n",
" '''For adding side effects at subscription and unsubscription time'''\n",
Expand Down Expand Up @@ -622,7 +622,7 @@
],
"source": [
"rst(O.observe_on)\n",
"from rx.scheduler.newthreadscheduler import NewThreadScheduler\n",
"from reactivex.scheduler.newthreadscheduler import NewThreadScheduler\n",
"\n",
"header('defining a custom thread factory for a custom scheduler')\n",
"def my_thread_factory(target, args=None): \n",
Expand Down
25 changes: 14 additions & 11 deletions reactivex/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def empty(scheduler: Optional[abc.SchedulerBase] = None) -> Observable[Any]:
Args:
scheduler: [Optional] Scheduler instance to send the termination call
on. By default, this will use an instance of
:class:`ImmediateScheduler <rx.scheduler.ImmediateScheduler>`.
:class:`ImmediateScheduler <reactivex.scheduler.ImmediateScheduler>`.
Returns:
An observable sequence with no elements.
Expand Down Expand Up @@ -462,7 +462,8 @@ def from_callable(
supplier: Function which is invoked to obtain the single element.
scheduler: [Optional] Scheduler instance to schedule the values on.
If not specified, the default is to use an instance of
:class:`CurrentThreadScheduler <rx.scheduler.CurrentThreadScheduler>`.
:class:`CurrentThreadScheduler
<reactivex.scheduler.CurrentThreadScheduler>`.
Returns:
An observable sequence containing the single element obtained by
Expand Down Expand Up @@ -538,7 +539,8 @@ def from_iterable(
iterable: An Iterable to change into an observable sequence.
scheduler: [Optional] Scheduler instance to schedule the values on.
If not specified, the default is to use an instance of
:class:`CurrentThreadScheduler <rx.scheduler.CurrentThreadScheduler>`.
:class:`CurrentThreadScheduler
<reactivex.scheduler.CurrentThreadScheduler>`.
Returns:
The observable sequence whose elements are pulled from the
Expand Down Expand Up @@ -610,7 +612,7 @@ def from_marbles(
scheduler: [Optional] Scheduler to run the the input sequence
on. If not specified, defaults to the subscribe scheduler
if defined, else to an instance of
:class:`NewThreadScheduler <rx.scheduler.NewThreadScheduler`.
:class:`NewThreadScheduler <reactivex.scheduler.NewThreadScheduler`.
lookup: [Optional] A dict used to convert an element into a specified
value. If not specified, defaults to :code:`{}`.
error: [Optional] Exception that will be use in place of the :code:`#`
Expand Down Expand Up @@ -758,7 +760,7 @@ def hot(
determines when to start the emission of elements.
scheduler: [Optional] Scheduler to run the the input sequence
on. If not specified, defaults to an instance of
:class:`NewThreadScheduler <rx.scheduler.NewThreadScheduler>`.
:class:`NewThreadScheduler <reactivex.scheduler.NewThreadScheduler>`.
lookup: [Optional] A dict used to convert an element into a specified
value. If not specified, defaults to :code:`{}`.
error: [Optional] Exception that will be use in place of the :code:`#`
Expand Down Expand Up @@ -833,7 +835,7 @@ def interval(
(specified as a :class:`float` denoting seconds or an instance of
:class:`timedelta`).
scheduler: Scheduler to run the interval on. If not specified, an
instance of :class:`TimeoutScheduler <rx.scheduler.TimeoutScheduler>`
instance of :class:`TimeoutScheduler <reactivex.scheduler.TimeoutScheduler>`
is used.
Returns:
Expand Down Expand Up @@ -976,7 +978,8 @@ def range(
step: [Optional] The step to be used (default is 1).
scheduler: [Optional] The scheduler to schedule the values on.
If not specified, the default is to use an instance of
:class:`CurrentThreadScheduler <rx.scheduler.CurrentThreadScheduler>`.
:class:`CurrentThreadScheduler
<reactivex.scheduler.CurrentThreadScheduler>`.
Returns:
An observable sequence that contains a range of sequential
Expand Down Expand Up @@ -1072,7 +1075,7 @@ def start(
func: Function to run asynchronously.
scheduler: [Optional] Scheduler to run the function on. If
not specified, defaults to an instance of
:class:`TimeoutScheduler <rx.scheduler.TimeoutScheduler>`.
:class:`TimeoutScheduler <reactivex.scheduler.TimeoutScheduler>`.
Returns:
An observable sequence exposing the function's result value,
Expand Down Expand Up @@ -1125,7 +1128,7 @@ def throw(
exception: An object used for the sequence's termination.
scheduler: [Optional] Scheduler to schedule the error notification on.
If not specified, the default is to use an instance of
:class:`ImmediateScheduler <rx.scheduler.ImmediateScheduler>`.
:class:`ImmediateScheduler <reactivex.scheduler.ImmediateScheduler>`.
Returns:
The observable sequence that terminates exceptionally with the
Expand Down Expand Up @@ -1165,7 +1168,7 @@ def timer(
If not specified, the resulting timer is not recurring.
scheduler: [Optional] Scheduler to run the timer on. If not specified,
the default is to use an instance of
:class:`TimeoutScheduler <rx.scheduler.TimeoutScheduler>`.
:class:`TimeoutScheduler <reactivex.scheduler.TimeoutScheduler>`.
Returns:
An observable sequence that produces a value after due time has
Expand Down Expand Up @@ -1199,7 +1202,7 @@ def to_async(
func: Function to convert to an asynchronous function.
scheduler: [Optional] Scheduler to run the function on. If not
specified, defaults to an instance of
:class:`TimeoutScheduler <rx.scheduler.TimeoutScheduler>`.
:class:`TimeoutScheduler <reactivex.scheduler.TimeoutScheduler>`.
Returns:
Asynchronous function.
Expand Down
6 changes: 6 additions & 0 deletions tests/test_scheduler/test_threadpoolscheduler.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import os
import threading
import unittest
from datetime import timedelta
from time import sleep

import pytest

from reactivex.internal.basic import default_now
from reactivex.scheduler import ThreadPoolScheduler

thread_pool_scheduler = ThreadPoolScheduler()

CI = os.getenv("CI") is not None


class TestThreadPoolScheduler(unittest.TestCase):
@pytest.mark.skipif(CI, reason="Flaky test in GitHub Actions")
def test_threadpool_now(self):
scheduler = ThreadPoolScheduler()
diff = scheduler.now - default_now()
Expand Down

0 comments on commit d836284

Please sign in to comment.