Skip to main content

Boa

A library of advanced system tools for Python.

Boa adds upgraded versions of system tools. For example, this includes advanced pipes, parallelism, etc. It is designed to have a simple Pythonic interface.

To list all of the available packages, simply Python's interactive prompt and explore:

>>> from Boa import *
>>> help(parallel)
Help on package Boa.parallel in Boa:

NAME
    Boa.parallel - This package contains some useful tools when working with multithreading or multiprocessing.

PACKAGE CONTENTS
    abc (package)
    exceptions
    process (package)
    thread (package)
...

Some practical examples of the content of Boa include:

  • Futures to manage eventual objects to come:
>>> from Boa.parallel.thread import Future
>>> from threading import Thread
>>> f = Future()
>>> def show_future():
...         while True:
...                 print(f"Future got set to {f.result()}.")
...                 f.clear()
... 
>>> Thread(target = show_future).start()
>>> f.set("Hello")
Future got set to Hello.
>>> f.set(True)
Future got set to True.
>>> f.set_exception(ValueError("Time to stop"))
Exception in thread Thread-1 (show_future):
Traceback (most recent call last):
  File "C:\Program Files\Python311\Lib\threading.py", line 1038, in _bootstrap_inner
     self.run()
  File "C:\Program Files\Python311\Lib\threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "<stdin>", line 3, in show_future
  File "C:\Users\Vince\OneDrive\Documents\Python\Boa\Boa\parallel\thread\future.py", line 248, in result
    raise self.__exception from None
ValueError: Time to stop

Futures are particularly useful in multithreaded environement for synchronization, especially with their special methods to cancel Futures, link them together, etc.

  • Many parallelism decorators:
>>> from Boa.parallel.thread import exclusive
>>> from time import sleep
>>> @exclusive
... def run():
...         print("Entering...")
...         sleep(5)
...         print("Exiting.")
... 
>>> from threading import Thread
>>> for i in range(5):
...         Thread(target = run).start()
... 
Entering...
>>> Exiting.
Entering...
Exiting.
Entering...
Exiting.
Entering...
Exiting.
Entering...
Exiting.

This decorator and others allow you to ensure exclusion with precise rules accros a multithreaded program.

  • Better signal handling:
>>> from Boa.signal import *
>>> Signals.
Signals.SIGABRT           Signals.SIGILL            Signals.SIGTERM           Signals.bit_length(       Signals.from_bytes(       Signals.numerator
Signals.SIGBREAK          Signals.SIGINT            Signals.as_integer_ratio( Signals.conjugate(        Signals.imag              Signals.real
Signals.SIGFPE            Signals.SIGSEGV           Signals.bit_count(        Signals.denominator       Signals.mro()             Signals.to_bytes(
>>> Signals.SIGINT.add_handler(lambda s : print(f"Received signal {s.name}"))
>>> Received signal SIGINT

KeyboardInterrupt
  • And many other useful random features!

Note that this library is extensively documented. Use Python's help system (for example the help function while in an interactive interpreter) to learn how to use all the modules and classes.

Metadata

Release files for boa-lib 1.4

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

Source distribution (sdist)

Source distribution for boa-lib 1.4
File Size Uploaded Provenance Actions
boa_lib-1.4.tar.gz 45.8 kB Without provenance Details for boa_lib-1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for boa-lib 1.4
File Interpreter ABI Platform Actions
boa_lib-1.4-py2.py3-none-any.whl Python 2, Python 3 none any Details for boa_lib-1.4-py2.py3-none-any.whl

Total release size: 103.3 kB

Release files / boa_lib-1.4.tar.gz

Download URL boa_lib-1.4.tar.gz
Size 45.8 kB
Tags Source
SHA-256 checksum
How to use checksums
818573c1d64ac4a7aed462bb4c359ee60c04a3cdd8c6389c0cc3b05143e6f9d3
BLAKE2b-256 checksum
How to use checksums
d21cf73cb2c4a00f27e4bf6de260d42169939fa737c93492e7f791edf2dfc372
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.2

Release files / boa_lib-1.4-py2.py3-none-any.whl

Download URL boa_lib-1.4-py2.py3-none-any.whl
Size 57.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
959b80cb79eeb642339382b634b0d5f4a79ee032259d39e9aae0e7be42aa3c8c
BLAKE2b-256 checksum
How to use checksums
9d905aea6612b7c275628d6e5a22a8861c48e8d9e614ff44b4fb1a7cf269bb1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.2

Security for boa-lib 1.4

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.

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