BbPyP (Blogger Bust Python Project) is a collection of python packages that I intend to use to help develop other more interesting python projects.
Each bbpyp namespace has a Dependency Injector IoC container that accepts a python dictionary named config.
config Key: logger Is Optional: True
The logger
configuration key may be set to any valid logging dictionary configuration. This parameter is entirely optional.
There are four named loggers that can be configured:
bbpyp.common
bbpyp.message_bus
bbpyp.lexical_state_machine
bbpyp.interpreter_state_machine
config Key: memory_channel_topic
Is Optional: True
"memory_channel_topic": {
"topic_name_1": {
"publish_concurrency": 1,
"subscribe_concurrency": 1
},
"topic_name_2": {
"publish_concurrency": 1,
"subscribe_concurrency": 1,
},
"topic_name_3": {
"publish_concurrency": 1,
"subscribe_concurrency": 1,
"queue_type": QueueType.SEQUENCE
}
},
Memory channels allow the passing of objects between tasks owned by a single process. The bbpyp.message_bus
package uses the Trio library’s memory channel to facilitate Pub/Sub
. The memory_channel_topic
config attribute tells the message bus how many concurrent memory connections should be created for each topic with respect to publishing and subscribing. Cross channel communication is currently made possible using queues. The queue_type
attribute may be set to QueueType.SEQUENCE
or QueueType.FIFO
with QueueType.FIFO
being the default.
config Key: memory_channel_topic_default
Is Optional: True
"memory_channel_topic_default": {
"publish_concurrency": 1,
"subscribe_concurrency": 1,
"queue_type": QueueType.FIFO
},
Provides default settings for any topic that is not configured in memory_channel_topic
. If memory_channel_topic_default
is not set, then it defaults to the values shown above.
config Key: memory_channel_max_buffer_size
Is Optional: True
"memory_channel_max_buffer_size": 5
The number of objects that can be temporarily stored in a memory channel prior to being processed. The default is 5.
I am happy to accept pull requests. If you need to get a hold of me you can create an issue or email me directly.
First, fork this repository and clone your fork to a local dev environment.
git clone https://github.com/<your-username>/bbpyp.git
Next, create a venv and install the latest pip and setuptools.
cd bbpyp
python -m venv venv
source venv/bin/activate
pip install -q --upgrade pip setuptools
Lastly, install the dev requirements declared in dev-requirements.txt and run the unit tests.
pip install -q -r dev-requirements.txt
python -m unittest discover
............................................................................................................................................... ---------------------------------------------------------------------- Ran 143 tests in 0.554s OK
Keep your mainline up to date with upstream.
git fetch origin --prune
git checkout master
git --ff-only origin/master
Make your changes in a feature branch.
git checkout -b branch_name
Unit tests are written using python’s unittest framework and mock library. Please do write unit tests to accommodate your contribution.
Read Chris Beams excellent article on writing commit messages and do your best to follow his advice.
If you feel that your changes would be appreciated upstream, then it is time to create a pull request. Please write unit tests and run all the tests again before making a pull request to defend against inadvertently braking something.
python -m unittest discover
If you have made many intermittent commits in your feature branch, then please make a squash branch and rebase with a single squashed commit. A squash branch is just a spin-off branch where you can perform the squash and rebase without the fear of corrupting your feature branch. My preference is to perform an interactive rebase. Note, that a squash branch is pointless if you only made a single commit.
First switch to master and fast forward to HEAD. This will reduce the risk of having a merge conflict later.
git checkout master
git fetch origin --prune
git merge --ff-only origin/master
Next, switch back to your feature branch and pull any changes fetched to master. If there are conflicts, then resolve them. Be sure to run all the tests once more if you had to merge with changes from upstream.
git checkout branch_name
git pull origin/master
python -m unittest discover
Determine the first commit of the feature branch which will be needed during interactive rebasing.
git log master..branch_name | grep -iE '^commit' | tail -n 1
commit f723dcc2c154662b3d6c366fb5ad923865687796
Then, create a squash branch as a spin-off of the feature branch and begin the interactive rebase following this guidance.
git checkout -b branch_name_squash
git rebase -i f723dcc^
Now, if you make a mistake during the rebase, but don’t notice until after you have already committed, all of your precious commit history remains in the feature branch. Simply reset the squash branch back to the feature branch and start again. Once you are happy with your rebase, push the squash branch to remote and create a pull request.
For convenience distribution requirements, including pep517 package, are defined in dist-requirements.txt.
pip install -q -r dist-requirements.txt
python -m pep517.build .
By default the wheel and sdist are placed in a directory named dist.
ls dist
bbpyp-0.0.2-py3-none-any.whl bbpyp-0.0.2.tar.gz