Skip to content

Commit

Permalink
update kernel spec in compose server
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPatrie committed Dec 30, 2024
1 parent f93686b commit 45e9ccd
Show file tree
Hide file tree
Showing 12 changed files with 950 additions and 36 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ nosetests.xml
coverage.xml
*.cover
*.log
.ipynb_checkpoints
.git
.mypy_cache
.pytest_cache
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.ipynb_checkpoints
release_env
commit.sh
.idea/
Expand Down
17 changes: 17 additions & 0 deletions assets/dev/scripts/add_env_kernel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

env="$1"

if [ "$env" == "" ]; then
env=$(conda env list | grep '*' | awk '{print $1}')
fi

# install ipykernel if needed
kernel=$(conda list | grep ipykernel)

if [ "$kernel" == "" ]; then
conda run -n "$env" pip install ipykernel jupyterlab
fi

python_version=$(conda run -n "$env" python --version)
conda run -n "$env" python -m ipykernel install --user --name="$env" --display-name "BioCompose Server($env): Python$python_version"
6 changes: 3 additions & 3 deletions assets/dev/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if [ "$platform" == "Darwin" ]; then
fi

# install deps from pyproject and activate env
conda run -n bio-compose-server pip install --upgrade pip
conda run -n bio-compose-server pip install -e .
conda activate bio-compose-server
conda run -n server pip install --upgrade pip
conda run -n server pip install -e .
conda activate server

3 changes: 3 additions & 0 deletions bio_bundles/quantum/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@



17 changes: 17 additions & 0 deletions bio_bundles/quantum/data_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import numpy as np


class DiracNotation(np.ndarray):
def __new__(cls, values: list[complex]):
return np.asarray(values).view(cls)


class Bra(DiracNotation):
pass


class Ket(DiracNotation):
def bra(self) -> Bra:
ket_value = self.view()
return Bra(np.conj(ket_value).T)

39 changes: 39 additions & 0 deletions bio_bundles/quantum/test_quantum.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"cells": [
{
"metadata": {},
"cell_type": "raw",
"source": "from process_bigraph",
"id": "f3a9e63ddcc7d864"
},
{
"metadata": {
"jupyter": {
"is_executing": true
}
},
"cell_type": "code",
"source": "from process_bigraph import Process, Step, Composite",
"id": "21fa17e759c94d71",
"outputs": [],
"execution_count": null
},
{
"metadata": {},
"cell_type": "code",
"outputs": [],
"execution_count": null,
"source": "",
"id": "92c51098889dfb08"
}
],
"metadata": {
"kernelspec": {
"name": "python3",
"language": "python",
"display_name": "Python 3 (ipykernel)"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
31 changes: 30 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: bio-compose-server
name: server
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
Expand All @@ -8,5 +8,34 @@ channels:
dependencies:
- pip
- python=3.10
- poetry
# - readdy
# - pymem3dg
- pip:
- uvicorn
- fastapi
- mypy
- pytest
- pip-autoremove
- networkx
- rustworkx
- qiskit
- qiskit-ibm-runtime
- numpy
- pandas
- process-bigraph
- copasi-basico
- tellurium
- python-libsbml
- smoldyn
- requests-toolbelt
- python-dotenv
- google-cloud-storage
- python-multipart
- toml
- typing-extensions
- pymongo
- pydantic
- pydantic-settings
- chardet
- pyyaml
46 changes: 46 additions & 0 deletions pyproject
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[project]
name = "bio-compose-server"
version = "0.0.1"
readme ="README.md"
description = "Backend for BioCompose: a microservices-based data service leveraging Kubernetes for efficient orchestration of bio-chemical simulation comparisons."
authors = [{name = "Alex Patrie", email = "[email protected]"}]

# only app-level deps
dependencies = [
"requests-toolbelt",
"python-dotenv",
"google-cloud-storage",
"python-multipart",
"fastapi",
"toml",
"typing-extensions",
"pymongo",
"pydantic-settings",
"pydantic",
"uvicorn",
"pyyaml",
"chardet",
"simulariumio",
"numpy",
"pandas",
"process-bigraph==0.0.22",
"bigraph-schema",
"copasi-basico",
"tellurium",
"python-libsbml",
"smoldyn",
"pip-autoremove",
"networkx",
"qiskit",
"qiskit-ibm-runtime",
"mypy"
]


[tool.setuptools]
packages = ["bio_bundles", "gateway", "shared", "tests", "worker"]


[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"
92 changes: 60 additions & 32 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,42 +1,70 @@
[project]
[tool.poetry]
name = "bio-compose-server"
version = "0.0.1"
readme ="README.md"
description = "Backend for BioCompose: a microservices-based data service leveraging Kubernetes for efficient orchestration of bio-chemical simulation comparisons."
authors = [{name = "Alex Patrie", email = "[email protected]"}]

# only app-level deps
dependencies = [
"requests-toolbelt",
"python-dotenv",
"google-cloud-storage",
"python-multipart",
"fastapi",
"toml",
"typing-extensions",
"pymongo",
"pydantic-settings",
"pydantic",
"uvicorn",
"pyyaml",
"chardet",
"simulariumio",
"numpy",
"pandas",
"process-bigraph==0.0.22",
"bigraph-schema",
"copasi-basico",
"tellurium",
"python-libsbml",
"smoldyn",
"pip-autoremove"
authors = ["Alex Patrie <[email protected]>"]
packages = [
{include ="bio_bundles"},
{include ="gateway"},
{include ="shared"},
{include ="tests"},
{include ="worker"}
]


[tool.setuptools]
packages = ["bio_bundles", "gateway", "shared", "tests", "worker"]
[tool.poetry.dependencies]
python = ">=3.10"


[tool.poetry.group.api.dependencies]
uvicorn = "*"
fastapi = "^0.115.6"


[tool.poetry.group.dev.dependencies]
mypy = "*"
pytest = "*"
pip-autoremove = "*"


[tool.poetry.group.quantum.dependencies]
jupyterlab = "*"
ipykernel = "*"


[tool.poetry.group.quantum.dependencies]
networkx = "*"
rustworkx = "*"
qiskit = "*"
qiskit-ibm-runtime = "*"


[tool.poetry.group.simulators.dependencies]
numpy = "*"
pandas = "*"
process-bigraph = "*"
bigraph-schema = "*"
copasi-basico = "*"
tellurium = "*"
python-libsbml = "*"
smoldyn = "*"


[tool.poetry.group.shared.dependencies]
requests-toolbelt = "^1.0.0"
python-dotenv = "^1.0.1"
google-cloud-storage = "^2.19.0"
python-multipart = "^0.0.20"
toml = "^0.10.2"
typing-extensions = "^4.12.2"
pymongo = "^4.10.1"
pydantic-settings = "^2.7.0"
pydantic = "^2.10.4"
chardet = "*"
pyyaml = "*"


[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
Loading

0 comments on commit 45e9ccd

Please sign in to comment.