Skip to main content

BIGSdb_Python_Toolkit

Python libraries for interacting with local BIGSdb databases.

The modules included in this package enable scripts to be written in Python that can query and update local BIGSdb databases using similar method calls as used in the main BIGSdb Perl package.

A script object that is passed a database config name will automatically parse the BIGSdb configuration and database configuration files, and set up the required database connections. Methods for querying databases are included in the Datastore module. More methods will be added as required to replicate the Perl BIGSdb libraries.

BIGSdb plugins can also now be written in Python so that additional analysis functionality can be added to the platform without having to write Perl code.

Installation

It is recommended that you install this in a virtual environment, e.g.

python -m venv .venv
source .venv/bin/activate

Install with pip:

pip install bigsdb

You can de-activate the virtual environment with:

deactivate

You can also clone the git repository and install dependencies. You will need to clone the repository to access various scripts needed to enable plugins.

git clone https://github.com/kjolley/BIGSdb_Python_Toolkit.git
cd BIGSdb_Python_Toolkit
pip install -r requirements.txt

Initiating plugins

BIGSdb needs to know about any plugins. In order to enable this, there is a script called create_plugin_list.py found in the scripts directory. Run this and save the output to a file called python_plugins.json and copy this to /etc/bigsdb. This contains everything that BIGSdb needs to know about each plugin including descriptive attributes, Javascript libraries needed and any inline Javascript that should be added to the page.

python create_plugin_list.py --plugin_dir ../sample_plugins/

BIGSdb will call a script called plugin_runner.py and it needs to know the location of this as well as the location of the Python plugins. Set the python_plugin_runner_path and python_plugin_dir in bigsdb.conf, e.g.

python_plugin_runner_path=/home/bigsdb/BIGSdb_Python_Toolkit/.venv/bin/python /home/bigsdb/BIGSdb_Python_Toolkit/plugin_runner.py
python_plugin_dir=/home/bigsdb/BIGSdb_Python_Toolkit/sample_plugins

Tests

Many of the tests involve creating and dropping a test database. The user running the tests must have permissions set to enable this. They will also need to be able to modify tables which may be owned by the apache user.

It is probably easiest to run these as the postgres user if you can.

Tests can be run from the tests/ directory with the following:

python -m unittest discover

Metadata

Release files for bigsdb 0.0.10

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

Source distribution (sdist)

Source distribution for bigsdb 0.0.10
File Size Uploaded
bigsdb-0.0.10.tar.gz 77.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bigsdb 0.0.10
File Interpreter ABI Platform
bigsdb-0.0.10-py3-none-any.whl Python 3 none any Details

Total release size: 146.6 kB

Release files / bigsdb-0.0.10.tar.gz

Download URL bigsdb-0.0.10.tar.gz
Size 77.9 kB
Tags Source
SHA-256 checksum
How to use checksums
798c26b670a9d40181edcd31a451eba2136420d8ac4b309586817db7b0cb1423
BLAKE2b-256 checksum
How to use checksums
375e05985b6ddd1f658a5d620da476d06d401eb5b28d1ab1f0770a6f71ee9112
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / bigsdb-0.0.10-py3-none-any.whl

Download URL bigsdb-0.0.10-py3-none-any.whl
Size 68.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1f0c16aeec4e8c0f6ff420faa37bf2db256b5f1067b8be99945a2ac9202b9189
BLAKE2b-256 checksum
How to use checksums
6e83b0a6a49d9ed17c4329942b200092f78fac5d507ac4f65592464d7ea62301
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.0.10 This release

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

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