Skip to main content

A generic REST API server backend for DataJoint pipelines.

Project description

👷‍♀️ Under Construction 👷 construction_fig

⚠️ The Pharus project is still early in its life and the maintainers are currently actively developing with a priority of addressing first critical issues directly related to the deliveries of Alpha and Beta milestones. Please be advised that while working through our milestones, we may restructure/refactor the codebase without warning until we issue our Official Release currently planned as 0.1.0 on 2021-03-31.

Pharus

A generic REST API server backend for DataJoint pipelines built on top of flask, datajoint, and pyjwt.

Usage and API documentation currently available within method docstrings. See Python's help(...) utility.

Requirements for Preferred Setup

Run Locally w/ Docker

  • Copy a *-docker-compose.yaml file corresponding to your usage to docker-compose.yaml. This file is untracked so feel free to modify as necessary.
  • Check the first comment which will provide best instruction on how to start the service.

⚠️ Deployment options currently being considered are Docker Compose and Kubernetes.

Run Locally w/ Python

  • Set environment variables for port assignment (PHARUS_PORT, defaults to 5000) and API route prefix (PHARUS_PREFIX e.g. /api, defaults to empty string).
  • For development, use CLI command pharus. This method supports hot-reloading so probably best coupled with pip install -e ....
  • For production, use gunicorn --bind 0.0.0.0:${PHARUS_PORT} pharus.server:app.

Run Tests for Development w/ Docker

  • Create a .env as appropriate for your setup:
    PY_VER=3.8    # Python version: 3.6|3.7|3.8
    IMAGE=djtest  # Image type:     djbase|djtest|djlab|djlabhub
    DISTRO=alpine # Distribution:   alpine|debian
    AS_SCRIPT=    # If 'TRUE', will not keep container alive but run tests and exit
    
  • Navigate to test-docker-compose.yaml and check first comment which will provide best instruction on how to start the service. Yes, the command is a bit long...

Run Tests for Development w/ Pytest and Flake8

  • Set pharus testing environment variables:
    PKG_DIR=/opt/conda/lib/python3.8/site-packages/pharus # path to pharus installation
    TEST_DB_SERVER=example.com:3306 # testing db server address
    TEST_DB_USER=root # testing db server user (needs CRUD on schemas, tables, users)
    TEST_DB_PASS=unsecure # testing db server password
    
  • For syntax tests, run flake8 ${PKG_DIR} --count --select=E9,F63,F7,F82 --show-source --statistics
  • For pytest integration tests, run pytest -sv --cov-report term-missing --cov=${PKG_DIR} /main/tests
  • For style tests, run flake8 ${PKG_DIR} --count --max-complexity=20 --max-line-length=95 --statistics

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pharus-0.1.0a5.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

pharus-0.1.0a5-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file pharus-0.1.0a5.tar.gz.

File metadata

  • Download URL: pharus-0.1.0a5.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.1

File hashes

Hashes for pharus-0.1.0a5.tar.gz
Algorithm Hash digest
SHA256 7eaac083a16ef53bc229db462255ab2d67cbafa4adadf98e708d754d24d86cec
MD5 00bd8fecbf12dbab966ddee6e2da8d79
BLAKE2b-256 e2e61ac207d1e792a11f63e14282e407224f242df3fe2a5935d7bb23ca25d4b4

See more details on using hashes here.

File details

Details for the file pharus-0.1.0a5-py3-none-any.whl.

File metadata

  • Download URL: pharus-0.1.0a5-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.1

File hashes

Hashes for pharus-0.1.0a5-py3-none-any.whl
Algorithm Hash digest
SHA256 ea7d2ad288379a03cb4c22c73430186f7a1863172b4f14c08144bfdccb1203f3
MD5 8188a8ec13c382d27509097f5a738096
BLAKE2b-256 801c0cc2f0e16080f3de6fd9207f1ecba0455e80b7b567a68968750934696e9a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page