This documentation is still in development. Please report any issues here (opens in a new tab).
CLI Documentation
Commands Line Interface (CLI) Documentation.
Installation
Prerequisites
- Python 3.9+
Installing
Published Release
We recommend using a packaging manager like pip
or poetry
.
pip install thread-cli
Building From Source
# Clone this repository
git clone https://github.com/python-thread/thread-cli
# Install the upstream package
pip install -e .
Development
# Clone this repository
git clone https://github.com/python-thread/thread-cli
# Install poetry
pip install poetry
# Install dependencies
poetry install
Running the CLI
Open your terminal and run:
thread
Getting started
Try running the help command!
thread -h/--help
Log levels
Thread CLI uses the python logging library. (opens in a new tab)
Name | Level |
---|---|
NOTSET | 0 |
DEBUG | 10 |
INFO | 20 |
WARN | 30 |
ERROR | 40 |
CRITICAL | 50 |
Commands
List of commands
Documentation (thread docs)
thread docs
Ran with no arguments and options, this command will attempt to open your browser to this MD file! If unable, will instead print out the link.
Help (thread help)
thread help
Ran with no arguments and options, this command will attempt to open your browser to the issue tracker! If unable, will instead print out the link.
Report (thread report)
thread report
Ran with no arguments and options, this command will attempt to open your browser to this MD file! If unable, will instead print out the link.
Configuration (thread config ...)
thread config
Coming soon.
Parallel Processing (thread process ...)
thread process
Invokes the ParallelProcessing class.
Examples
Say you wanted to generate a list of the square of every number from 0 to 999.
thread process 'lambda x: x**2' '[ i for i in range(1000) ]'
This is functionally equivalent to:
import thread
# Start processing
worker = thread.ParallelProcessing(
function = lambda x: x**2,
dataset = [ i for i in range(1000) ]
)
worker.start()
worker.join()
# Write output to "./output.json"
with open('./output.json', 'w') as output:
output.write(worker.results)