Skip to content

Commit

Permalink
Merge branch 'master' into margo/readjson
Browse files Browse the repository at this point in the history
  • Loading branch information
AC-Dap authored Oct 8, 2023
2 parents b243bb3 + 54049f2 commit 4ee6c29
Show file tree
Hide file tree
Showing 23 changed files with 104 additions and 57 deletions.
10 changes: 3 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ jobs:
name: Install ersilia package in developer mode
command: |
source activate ersilia
pip install -e .
pip install -U pip setuptools
python -m pip install -e .
- run:
name: Test CLI
command: |
Expand Down Expand Up @@ -63,12 +64,6 @@ jobs:
command: |
source activate ersilia
ersilia -v delete molecular-weight
- run:
name: Test Python interface
command: |
source activate ersilia
pip install -e .[test]
pytest
docs-build:
docker:
- image: ersiliaos/conda:3.7
Expand All @@ -79,6 +74,7 @@ jobs:
command: |
apt-get update
source activate ersilia
pip install -U pip setuptools
pip install -e .[docs]
apt-get -y install make
- run:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/approve-dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # [email protected]
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # [email protected]

# parse the issue body from free form text to a structured JSON object
- name: parse issue
uses: GrantBirki/[email protected].0
uses: GrantBirki/[email protected].1
id: issue-parser
with:
body: ${{ github.event.client_payload.github.payload.issue.body }}
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
# upload git-lfs object
- name: checkout persist credentials
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # [email protected]
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # [email protected]
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
Expand Down Expand Up @@ -154,7 +154,7 @@ jobs:
# comment on the issue comment with further instructions for the user
- name: comment
uses: GrantBirki/comment@eab1bc94aa728cf526dcd6639bfd067512d4a5cb # [email protected].6
uses: GrantBirki/comment@e6bf4bc177996c9572b4ddb98b25eb1a80f9abc9 # [email protected].7
with:
issue-number: ${{ github.event.client_payload.github.payload.issue.number }}
file: .github/templates/new-model.md
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/black-code-formatter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Python Black Linter

on:
push:
pull_request:
issue_comment:
types: [ created, edited ]

jobs:
lint:
if: ${{ !contains(github.event_name, 'issue_comment') }} # Don't want to trigger on comments
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
with:
options: "--check"
src: "./ersilia"
comment-lint:
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '✨') }}
runs-on: ubuntu-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
steps:
- name: Checkout branch
uses: actions/checkout@v3
- name: Lint files
uses: psf/black@stable
with:
src: "./ersilia"
- name: Commit lint
uses: stefanzweifel/git-auto-commit-action@v5
10 changes: 5 additions & 5 deletions .github/workflows/ersilia-base-image-to-dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ jobs:
steps:
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

# log in to dockerhub
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
Expand All @@ -43,7 +43,7 @@ jobs:
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
Expand All @@ -59,7 +59,7 @@ jobs:
type=sha
- name: Build and push
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ersilia-installer-to-dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ jobs:
steps:
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

# log in to dockerhub
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
Expand All @@ -47,7 +47,7 @@ jobs:
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
Expand All @@ -63,7 +63,7 @@ jobs:
type=sha
- name: Build and push
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1
with:
Expand All @@ -35,7 +35,7 @@ jobs:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1
with:
Expand All @@ -57,7 +57,7 @@ jobs:
platform: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # [email protected]
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # [email protected]

- name: Add conda to system path
run: echo $CONDA/bin >> $GITHUB_PATH
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/json-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # [email protected]
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # [email protected]

- name: json syntax check
uses: GrantBirki/json-yaml-validate@1652fde01b1be71dfa7131148819e67639792673 # [email protected].0
uses: GrantBirki/json-yaml-validate@3add42f5fa8bfff04a3fe664d27a316736257ef1 # [email protected].1
with:
exclude_file: ".github/config/exclude.txt" # .gitignore style file for exclusions
comment: "true" # allow PR comments with error messages
2 changes: 1 addition & 1 deletion .github/workflows/pr_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # [email protected]
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # [email protected]

- name: Add conda to system path
run: echo $CONDA/bin >> $GITHUB_PATH
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/predict-model-input.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # [email protected]
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # [email protected]

- name: Add conda to system path
run: echo $CONDA/bin >> $GITHUB_PATH
Expand All @@ -44,14 +44,16 @@ jobs:
python --version
echo "After conda init"
conda init
python -m pip install -e .[test]
python -m pip install -e .
- name: Predict output
run: |
source activate
echo "Sample model id selected: $MODEL_ID"
ersilia fetch $MODEL_ID
ersilia -v fetch $MODEL_ID
echo "Serving model: $MODEL_ID"
ersilia serve $MODEL_ID
echo "$MODEL_ID successfully fetched and served"
ersilia sample -n 100 -f input.csv
ersilia api -i input.csv -o output.csv
ersilia run -i input.csv -o output.csv
ersilia close
2 changes: 1 addition & 1 deletion .github/workflows/predict-model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
count: [0, 1, 2, 3, 4]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # [email protected]
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # [email protected]

- name: Add conda to system path
run: echo $CONDA/bin >> $GITHUB_PATH
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # [email protected]
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # [email protected]

- name: Set up Python
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # [email protected]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/quick-manual-model-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # [email protected]
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # [email protected]

- name: Add conda to system path
run: echo $CONDA/bin >> $GITHUB_PATH
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:
- name: Upload log output
if: ${{ failure() }}
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # [email protected].2
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # [email protected].3
with:
name: ersilia-predict-logs
path: /home/runner/eos/console.log
2 changes: 1 addition & 1 deletion .github/workflows/tag-to-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

steps:
- name: Checkout persist credentials
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # [email protected]
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # [email protected]
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-colab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
test-colab-notebook:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # [email protected]
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # [email protected]
- name: Add conda to system path
run: echo $CONDA/bin >> $GITHUB_PATH

Expand All @@ -33,14 +33,14 @@ jobs:
run: jupyter nbconvert --to notebook --execute notebooks/test-colab-notebook-python-api.ipynb --output=output-python-api.ipynb --ExecutePreprocessor.timeout=-1

- name: Upload Output of the Google Colab Notebook CLI
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # [email protected].2
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # [email protected].3
with:
name: output-cli.ipynb
path: notebooks/output-cli.ipynb
retention-days: 7

- name: Upload Output of the Google Colab Notebook Python API
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # [email protected].2
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # [email protected].3
with:
name: output-python-api.ipynb
path: notebooks/output-python-api.ipynb
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # [email protected]
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # [email protected]

- name: Add conda to system path
run: echo $CONDA/bin >> $GITHUB_PATH
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/write_secrets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # [email protected]
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # [email protected]

# Write json file
- name: Write secrets to json file
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div id="top"></div>
<img src="https://raw.githubusercontent.com/ersilia-os/ersilia/master/assets/Ersilia_Plum.png" height="70">

# Welcome to the Ersilia Model Hub
# 🎉 Welcome to the Ersilia Model Hub! 🌟

[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/uk/fundraiser/charity/4145012) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md) [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-yellow.svg)](https://www.gnu.org/licenses/agpl-3.0)
[![PyPI version fury.io](https://badge.fury.io/py/ersilia.svg)](https://pypi.python.org/pypi/ersilia/) [![Python 3.7](https://img.shields.io/pypi/pyversions/ersilia
Expand All @@ -18,7 +18,10 @@

## Project Description

The Ersilia Model Hub is a unified platform of pre-trained AI/ML models for infectious and neglected disease research. The end goal is to provide an open-source, low-code solution to access AI/ML models for **drug discovery**. The models embedded in the hub include both models published in the literature (with appropriate third party acknowledgement) and models developed by the Ersilia team or contributors.
The [Ersilia Model Hub](https://ersilia.io) is a unified platform of pre-trained AI/ML models dedicated to 🦠 infectious and neglected disease research. Our mission is to offer an open-source, 🛠 low-code solution that provides seamless access to AI/ML models for 💊 drug discovery. Models housed in our hub come from two sources:

1. 📚 Published models from literature (with due third-party acknowledgement)
2. 🛠 Custom models developed by the **Ersilia team** or our valued contributors.

* Read more about the project in the [Ersilia Book](https://ersilia.gitbook.io/ersilia-book/)
* Browse available models in the [Ersilia Model Hub](https://ersilia.io/model-hub/)
Expand Down
6 changes: 4 additions & 2 deletions ersilia/cli/commands/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ def info_cmd():
@ersilia_cli.command(
short_help="Get model information", help="Get model information"
)
@click.option('--as_json', is_flag=True, default=False, help='Output as JSON format')
@click.option(
"--as_json", is_flag=True, default=False, help="Output as JSON format"
)
def info(as_json):
session = Session(config_json=None)
model_id = session.current_model_id()
Expand All @@ -26,4 +28,4 @@ def info(as_json):
print(json.dumps(info, indent=4))
return info
else:
InformationDisplayer(info).echo()
InformationDisplayer(info).echo()
11 changes: 9 additions & 2 deletions ersilia/cli/commands/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,15 @@ def run(input, output, batch_size, track_run):
fg="red",
)
return
mdl = ErsiliaModel(model_id, service_class=service_class, config_json=None, track_runs=track_run)
result = mdl.run(input=input, output=output, batch_size=batch_size, track_run=track_run)
mdl = ErsiliaModel(
model_id,
service_class=service_class,
config_json=None,
track_runs=track_run,
)
result = mdl.run(
input=input, output=output, batch_size=batch_size, track_run=track_run
)
if isinstance(result, types.GeneratorType):
for result in mdl.run(input=input, output=output, batch_size=batch_size):
if result is not None:
Expand Down
Loading

0 comments on commit 4ee6c29

Please sign in to comment.