Skip to main content

consensual_http

In what follows python is an alias for python3.7 or any later version (python3.8 and so on).

Installation

Install the latest pip & setuptools packages versions

python -m pip install --upgrade pip setuptools

User

Download and install the latest stable version from PyPI repository

python -m pip install --upgrade consensual_http

Developer

Download the latest version from GitHub repository

git clone https://github.com/lycantropos/consensual_http.git
cd consensual_http

Install dependencies

python -m pip install -r requirements.txt

Install

python setup.py install

Usage

>>> from consensual.raft import Node
>>> from consensual_http import communication
>>> from yarl import URL
>>> node_url = URL.build(scheme='http',
...                      host='localhost',
...                      port=6000)
>>> heartbeat = 0.1
>>> from typing import Any
>>> processed_parameters = []
>>> def dummy_processor(parameters: Any) -> None:
...     processed_parameters.append(parameters)
>>> def stop(parameters: Any = None) -> None:
...     receiver.stop()
>>> processors = {'dummy': dummy_processor, 'stop': stop}
>>> sender = communication.Sender(heartbeat=heartbeat,
...                               urls=[node_url])
>>> from asyncio import Event, get_event_loop
>>> loop = get_event_loop()
>>> node = Node.from_url(node_url,
...                      heartbeat=heartbeat,
...                      loop=loop,
...                      processors=processors,
...                      sender=sender)
>>> node_is_running = Event()
>>> receiver = communication.Receiver(node,
...                                   on_run=node_is_running.set)
>>> from aiohttp.client import ClientSession
>>> def validate_response(response: Any) -> None:
...     assert isinstance(response, dict)
...     assert response.keys() == {'error'}
...     assert response['error'] is None
>>> async def run() -> None:
...     await node_is_running.wait()
...     async with ClientSession(node.url) as session:
...         validate_response(await (await session.post('/')).json())
...         validate_response(await (await session.post('/dummy',
...                                                     json=42)).json())
...         validate_response(await (await session.delete('/',
...                                                       json=[str(node.url)])).json())
...         validate_response(await (await session.delete('/')).json())
...     stop(None)
>>> _ = loop.create_task(run())
>>> receiver.start()
>>> all(parameters == 42 for parameters in processed_parameters)
True

Development

Bumping version

Preparation

Install bump2version.

Pre-release

Choose which version number category to bump following semver specification.

Test bumping version

bump2version --dry-run --verbose $CATEGORY

where $CATEGORY is the target version number category name, possible values are patch/minor/major.

Bump version

bump2version --verbose $CATEGORY

This will set version to major.minor.patch-alpha.

Release

Test bumping version

bump2version --dry-run --verbose release

Bump version

bump2version --verbose release

This will set version to major.minor.patch.

Running tests

Install dependencies

python -m pip install -r requirements-tests.txt

Plain

pytest

Inside Docker container:

docker-compose up

Bash script:

./run-tests.sh

PowerShell script:

.\run-tests.ps1

Metadata

Release files for consensual-http 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for consensual-http 0.1.0
File Size Uploaded Provenance Actions
consensual_http-0.1.0.tar.gz 6.2 kB Without provenance Details for consensual_http-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for consensual-http 0.1.0
File Interpreter ABI Platform Actions
consensual_http-0.1.0-py3-none-any.whl Python 3 none any Details for consensual_http-0.1.0-py3-none-any.whl

Total release size: 14.4 kB

Release files / consensual_http-0.1.0.tar.gz

Download URL consensual_http-0.1.0.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
06dcb3dc9223c90ca19ea6fb13ff674145ddb1aa81f20a7be76483f631f26efd
BLAKE2b-256 checksum
How to use checksums
903df01c9ddc464d9014098f58e87dc2c9fe86f87d17ac85e0ebf1ccac8578b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.12

Release files / consensual_http-0.1.0-py3-none-any.whl

Download URL consensual_http-0.1.0-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
59fef025a63551b482d8ab2cc01d4ce88c60c5c22ba0a0b8ef84c64b579dd72f
BLAKE2b-256 checksum
How to use checksums
cfc51376b059e2852ccb6954b813196560cd408f332237d3b5f095414e528c31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.12

Security for consensual-http 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page