Skip to content

Explore Logic Bank

valhuber edited this page Jan 1, 2021 · 11 revisions

Installation

To get started, you will need:

  • Python3.8 (Relies on from __future__ import annotations, so requires Python 3.8)

  • virtualenv - see here (e.g., pip install virtualenv)

  • An IDE - any will do (I've used PyCharm and VSCode, install notes here), though different install / generate / run instructions apply for running programs

Issues? Try here.

Using your IDE or command line:

git fork / clone
cd LogicBank
cd examples/nw/basic_web_app
python run.py

The project includes:

  • the logic engine that executes the rules
  • the sample database (sqlite, so no db install is required)
  • business logic, both by-code and by-rules, to facilitate comparison
    • control whether logic is via rules or code by alteringby_rules in __init__.py
  • a test folder that runs various sample transactions

Testing

You can run the programs in the examples/nw/tests folder (note the generated log), and/or review this readme and the wiki.

Development Operations

Deploy to Pypi

Using this reference...

Acquire the setup software (initial, 1-time setup):

cd LogicBank
deactivate
python setup.py install
python3 -m pip install --user --upgrade twine
python3 -m pip install --user --upgrade setuptools wheel

Creating the dist, first time Get a Saved API Key

cd python-rules
deactivate
python3 setup.py sdist bdist_wheel
# verify this produced the dist folder; next command uploads to test Pypi
python3 -m twine upload --repository testpypi dist/*

User is __token__, pwd is Saved API Key (from above).

This should upload to the test Pypi site

To re-upload:

  1. Delete the dist folder (and build, and .egg)
  2. Alter the version number in setup.py
deactivate
python3 setup.py sdist bdist_wheel
python3 -m twine upload  --skip-existing --repository testpypi dist/*

To install locally (beware - may require 15 mins until new version is active.

source venv/bin/activate
pip uninstall python-rules
pip install -i https://test.pypi.org/simple/ python-rules

Local pip

Per this helpful link, you can build the wheel and install locally:

cd receiving_project
# fails to build: virtualenv venv --no-wheel --no-pip --no-setuptools
virtualenv venv
source venv/bin/activate
pip install /Users/val/dev/LogicBank