Skip to content

Commit

Permalink
Merge pull request #615 from ReactiveX/github-publish
Browse files Browse the repository at this point in the history
Add publish action and dynamic versioning
  • Loading branch information
dbrattli committed Mar 5, 2022
2 parents 5066a5c + becb44c commit 8fcdf72
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 22 deletions.
File renamed without changes.
34 changes: 34 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish Package

on:
release:
types: [created]

jobs:
publish:
runs-on: ubuntu-latest
name: "Publish library"
steps:
- name: Check out
uses: actions/checkout@v3
with:
token: "${{ secrets.GITHUB_TOKEN }}"
fetch-depth: 0

- name: Setup Python Env
uses: actions/setup-python@v3
with:
python-version: '3.9'

- name: Install dependencies
run: |
pip install poetry
poetry version $(dunamai from any --no-metadata --style pep440)
poetry install
- name: Build package
run: poetry build

- name: Release to PyPI
run: |
poetry publish -u __token__ -p ${{ secrets.PYPI_API_TOKEN }} || echo 'Version exists'
68 changes: 52 additions & 16 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ The ReactiveX for Python (RxPY)
:target: https://coveralls.io/github/ReactiveX/RxPY
:alt: Coverage Status

.. image:: https://img.shields.io/pypi/v/rx.svg
:target: https://pypi.python.org/pypi/Rx
.. image:: https://img.shields.io/pypi/v/reactivex.svg
:target: https://pypi.org/project/reactivex/
:alt: PyPY Package Version

.. image:: https://img.shields.io/readthedocs/rxpy.svg
Expand All @@ -22,13 +22,14 @@ The ReactiveX for Python (RxPY)
*A library for composing asynchronous and event-based programs using observable
collections and query operator functions in Python*

ReactiveX for Python (RxPY) v4.0
--------------------------------
ReactiveX for Python v4
-----------------------

For v3.X please go to the `v3 branch <https://github.com/ReactiveX/RxPY/tree/master>`_.
For v3.X please go to the `v3 branch
<https://github.com/ReactiveX/RxPY/tree/release/v3.2.x>`_.

RxPY v4.x runs on `Python <http://www.python.org/>`_ 3.7 or above. To install
RxPY:
ReactiveX for Python v4.x runs on `Python <http://www.python.org/>`_ 3.7 or above. To
install:

.. code:: console
Expand All @@ -46,10 +47,10 @@ streams using Schedulers.

.. code:: python
import reactivex
import reactivex as rx
from reactivex import operators as ops
source = reactivex.of("Alpha", "Beta", "Gamma", "Delta", "Epsilon")
source = rx.of("Alpha", "Beta", "Gamma", "Delta", "Epsilon")
composed = source.pipe(
ops.map(lambda s: len(s)),
Expand All @@ -63,7 +64,7 @@ Learning ReactiveX

Read the `documentation
<https://rxpy.readthedocs.io/en/latest/>`_ to learn
the principles of RxPY and get the complete reference of the available
the principles of ReactiveX and get the complete reference of the available
operators.

If you need to migrate code from RxPY v1.x, read the `migration
Expand Down Expand Up @@ -98,8 +99,8 @@ over `1300 passing unit-tests <https://coveralls.io/github/ReactiveX/RxPY>`_. Rx
is mostly a direct port of RxJS, but also borrows a bit from Rx.NET and RxJava in
terms of threading and blocking operators.

RxPY follows `PEP 8 <http://legacy.python.org/dev/peps/pep-0008/>`_, so all
function and method names are lowercase with words separated by underscores as
ReactiveX for Python follows `PEP 8 <http://legacy.python.org/dev/peps/pep-0008/>`_, so
all function and method names are lowercase with words separated by underscores as
necessary to improve readability.

Thus .NET code such as:
Expand All @@ -115,7 +116,42 @@ need to be written with an ``_`` in Python:
group = source.pipe(ops.group_by(lambda i: i % 3))
With RxPY you should use `named keyword arguments
<https://docs.python.org/3/glossary.html>`_ instead of positional arguments when
an operator has multiple optional arguments. RxPY will not try to detect which
arguments you are giving to the operator (or not).
With ReactiveX for Python you should use `named keyword arguments
<https://docs.python.org/3/glossary.html>`_ instead of positional arguments when an
operator has multiple optional arguments. RxPY will not try to detect which arguments
you are giving to the operator (or not).

Development
-----------

This project is managed using `Poetry <https://python-poetry.org/>`_. Code is formatted
using `Black <https://github.com/psf/black>`_, `isort
<https://github.com/PyCQA/isort>`_. Code is statically type checked using `pyright
<https://github.com/microsoft/pyright>`_ and `mypy <http://mypy-lang.org/>`_.

If you want to take advantage of the default VSCode integration, then
first configure Poetry to make its virtual environment in the
repository:

.. code:: console
poetry config virtualenvs.in-project true
After cloning the repository, activate the tooling:

.. code:: console
poetry install
poetry run pre-commit install
Run unit tests:

.. code:: console
poetry run pytest
Run code checks (manually):

.. code:: console
poetry run pre-commit run --all-files
2 changes: 1 addition & 1 deletion docs/migration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Migration v4
============

ReactiveX for Python v4 is an evolution of RxPY v3 to modenize it to
ReactiveX for Python v4 is an evolution of RxPY v3 to modernize it to
current Python standards:

- Project main module renamed from ``rx`` to ``reactivex``. This is done
Expand Down
18 changes: 17 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "reactivex"
version = "4.0.0a4" # Make sure the version here is the same as in _version.py
name = "ReactiveX"
version = "0.0.0"
description = "ReactiveX (Rx) for Python"
readme = "README.rst"
authors = ["Dag Brattli <dag@brattli.net>"]
Expand Down Expand Up @@ -43,6 +43,7 @@ flake8 = "^4.0.1"
coveralls = "^3.3.1"
pre-commit = "^2.17.0"
autoflake = "^1.4"
dunamai = "^1.9.0"

[tool.black]
line-length = 88
Expand Down
3 changes: 1 addition & 2 deletions reactivex/_version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# Please make sure the version here remains the same as in pyproject.toml
__version__ = "4.0.0a4"
__version__ = "$(dunamai from any)"

0 comments on commit 8fcdf72

Please sign in to comment.