Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/development.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ jobs:
env:
TWINE_USERNAME: ${{secrets.twine_username}}
TWINE_PASSWORD: ${{secrets.twine_password}}
outputs:
release_upload_url: ${{steps.create_gh_release.outputs.upload_url}}
steps:
- uses: actions/checkout@v2
- name: Determine package version
Expand All @@ -104,7 +106,9 @@ jobs:
run: |
export HOST_UID=$(id -u)
docker load < "image-pharus-${PHARUS_VERSION}-py3.8-alpine.tar.gz"
docker-compose -f docker-compose-build.yaml run pharus python -m twine upload dist/*
docker-compose -f docker-compose-build.yaml run \
-e TWINE_USERNAME=${TWINE_USERNAME} -e TWINE_PASSWORD=${TWINE_PASSWORD} pharus \
sh -lc "pip install twine && python -m twine upload dist/*"
- name: Get changelog entry
id: changelog_reader
uses: mindsers/changelog-reader-action@v2
Expand Down Expand Up @@ -144,7 +148,7 @@ jobs:
upload_url: ${{steps.create_gh_release.outputs.upload_url}}
asset_path: $${{env.PHARUS_SDIST_PATH}}
asset_name: pip-pharus-${{env.PHARUS_VERSION}}.tar.gz
asset_content_type: application/zip
asset_content_type: application/gzip
publish-images:
if: github.event_name == 'push'
needs: publish-release
Expand Down Expand Up @@ -189,7 +193,7 @@ jobs:
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
upload_url: ${{needs.publish-release.steps.create_gh_release.outputs.upload_url}}
upload_url: ${{needs.publish-release.outputs.release_upload_url}}
asset_path: "image-pharus-${{env.PHARUS_VERSION}}-py${{matrix.py_ver}}-\
${{matrix.distro}}.tar.gz"
asset_name: "image-pharus-${{env.PHARUS_VERSION}}-py${{matrix.py_ver}}-\
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) convention.

## [0.1.0a1] - 2021-02-16
## [0.1.0a1] - 2021-02-17
### Added
- List schemas method.
- List tables method.
Expand Down
40 changes: 31 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,50 @@

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

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

## Requirements for Preferred Setup

- [Docker](https://docs.docker.com/get-docker/ )
- [Docker Compose](https://docs.docker.com/compose/install/)

## Run Locally
## 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.

> :warning: Deployment options currently being considered are [Docker Compose](https://docs.docker.com/compose/install/) and [Kubernetes](https://kubernetes.io/docs/tutorials/kubernetes-basics/).

## Run Tests for Development
## 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:
```shell
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
```
```shell
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:
```shell
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

- DataJoint LabBook (a companion frontend)
Expand Down
1 change: 0 additions & 1 deletion docker-compose-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ services:
- IMAGE
volumes:
- .:/main
- ./requirements_package.txt:/tmp/pip_requirements.txt
command:
- sh
- -lc
Expand Down
1 change: 0 additions & 1 deletion requirements_package.txt

This file was deleted.