Skip to content

Commit

Permalink
Merge pull request #9 from NorwegianVeterinaryInstitute/dev_ML
Browse files Browse the repository at this point in the history
Transferred code into a package managed by uv.
  • Loading branch information
magnulei authored Oct 22, 2024
2 parents 4aefe9c + 7191c0f commit 853b0bf
Show file tree
Hide file tree
Showing 14 changed files with 1,395 additions and 36 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
__pycache__
api-key.txt
__pycache__/
/src/shinylims/__pycache__
*.pyc
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.11.5
7 changes: 7 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2024 Magnus Leithaug

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 changes: 7 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
### Shinylims

A Python Shiny app for LIMS reporting.

Environment setup:
This python package is managed with uv (https://docs.astral.sh/uv). To run it, clone the repository and install the package with:

```
python -m venv pyshiny-env
cd pyshiny-env
source bin/activate
pip install -r requirements.txt
uv sync
```

Then clone the repo, and open the app.

Runs locally with:
Then, run the shiny app with:

```
shiny run app.py
uv run uvicorn shinylims.app:app
```

Remember to update the manifest before making commits

```
rsconnect write-manifest shiny . --overwrite
```
uvx --from rsconnect-python --python .venv/Scripts/python.exe rsconnect write-manifest shiny . --overwrite --entrypoint shinylims.app:app
```

41 changes: 28 additions & 13 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,55 @@
"locale": "English_United States.1252",
"metadata": {
"appmode": "python-shiny",
"entrypoint": "app"
"entrypoint": "shinylims.app:app"
},
"python": {
"version": "3.11.9",
"version": "3.11.5",
"package_manager": {
"name": "pip",
"version": "24.0",
"version": "24.2",
"package_file": "requirements.txt"
}
},
"files": {
"requirements.txt": {
"checksum": "b5406ad9b684385870dad2811a0cbb52"
"checksum": "2976d8cc4dabb78a47c02b90dc75d48e"
},
".gitignore": {
"checksum": "85d6754af8e577056060708790e4049f"
"checksum": "a490f4da04fb5b1ec743568fe3380d40"
},
".python-version": {
"checksum": "215923581f8fcce0029639f7ab16ccb6"
},
"LICENSE": {
"checksum": "bbcd65b7e389067d3922f20a2f9eaf4e"
},
"README.md": {
"checksum": "e43540e228defc4ae6e2478fa92a24e8"
"checksum": "262635faedb2f6c0096957d5b75c6d2c"
},
"app.py": {
"checksum": "dcb0e583c2c9f5cde04e5d682457422c"
"pyproject.toml": {
"checksum": "158312210f1c3c22ec358b734eaa34a6"
},
"data_utils.py": {
"checksum": "91c3c9621a893c9f1163077c8633c8d0"
"src/shinylims/__init__.py": {
"checksum": "d41d8cd98f00b204e9800998ecf8427e"
},
"src/shinylims/app.py": {
"checksum": "b561f7e2b81fff588d93ac091dc6a16b"
},
"styles.css": {
"src/shinylims/assets/styles.css": {
"checksum": "3a235faad5ed32854aa71009d1e7a333"
},
"ui_pages.py": {
"src/shinylims/data_utils.py": {
"checksum": "91c3c9621a893c9f1163077c8633c8d0"
},
"src/shinylims/ui_pages.py": {
"checksum": "da947ff0de151ce45fc2a3d3f9fe9a81"
},
"ui_server.py": {
"src/shinylims/ui_server.py": {
"checksum": "13c704eff839d4b4d8c0e7e801a4b49c"
},
"uv.lock": {
"checksum": "9b96f9b5b26f9ebe3ea91404ecb4ee15"
}
}
}
19 changes: 19 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[project]
name = "shinylims-uv"
version = "0.1.0"
authors = [
{ name="Magnus Leithaug", email="[email protected]" },
]

description = "A shiny app to display lab metadata from clarity LIMS"
readme = "README.md"
requires-python = ">=3.11.5"
dependencies = [
"faicons==0.2.2",
"itables==2.0.1",
"pandas==2.2.2",
"pins==0.8.5",
"seaborn==0.13.2",
"shiny==0.9.0",
"shinyswatch==0.6.1",
]
75 changes: 70 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,73 @@
shiny==0.9.0
seaborn==0.13.2
pandas==2.2.2
# This file was autogenerated by uv via the following command:
# uv export --no-hashes -o requirements.txt
-e .
anyio==4.6.2.post1
appdirs==1.4.4
asgiref==3.8.1
asttokens==2.4.1
certifi==2024.8.30
charset-normalizer==3.4.0
click==8.1.7 ; platform_system != 'Emscripten'
colorama==0.4.6 ; sys_platform == 'win32' or platform_system == 'Windows'
contourpy==1.3.0
cycler==0.12.1
decorator==5.1.1
executing==2.1.0
faicons==0.2.2
fonttools==4.54.1
fsspec==2024.10.0
h11==0.14.0 ; platform_system != 'Emscripten'
htmltools==0.5.3
humanize==4.11.0
idna==3.10
importlib-metadata==8.5.0
importlib-resources==6.4.5
ipython==8.18.0
itables==2.0.1
rsconnect-python==1.23.0
jedi==0.19.1
jinja2==3.1.4
joblib==1.4.2
kiwisolver==1.4.7
linkify-it-py==2.0.3
markdown-it-py==3.0.0
markupsafe==3.0.2
matplotlib==3.9.2
matplotlib-inline==0.1.7
mdit-py-plugins==0.4.2
mdurl==0.1.2
numpy==2.1.2
packaging==24.1
pandas==2.2.2
parso==0.8.4
pexpect==4.9.0 ; sys_platform != 'win32'
pillow==11.0.0
pins==0.8.5
faicons==0.2.2
prompt-toolkit==3.0.36
ptyprocess==0.7.0 ; sys_platform != 'win32'
pure-eval==0.2.3
pygments==2.18.0
pyparsing==3.2.0
python-dateutil==2.9.0.post0
python-multipart==0.0.12
pytz==2024.2
pyyaml==6.0.2
questionary==2.0.1 ; platform_system != 'Emscripten'
requests==2.32.3
seaborn==0.13.2
shiny==0.9.0
shinyswatch==0.6.1
six==1.16.0
sniffio==1.3.1
stack-data==0.6.3
starlette==0.41.0
traitlets==5.14.3
typing-extensions==4.12.2
tzdata==2024.2
uc-micro-py==1.0.3
urllib3==2.2.3
uvicorn==0.32.0 ; platform_system != 'Emscripten'
watchfiles==0.24.0 ; platform_system != 'Emscripten'
wcwidth==0.2.13
websockets==13.1
xxhash==3.5.0
zipp==3.20.2
Empty file added src/shinylims/__init__.py
Empty file.
11 changes: 7 additions & 4 deletions app.py → src/shinylims/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@
from shinyswatch import theme

# App modules
from ui_pages import projects_page, wgs_samples_page, prepared_samples_page, seq_page
from ui_server import setup_projects_page, setup_wgs_samples_page, setup_prepared_samples_page, setup_seq_run_page
from data_utils import fetch_pinned_data
from src.shinylims.ui_pages import projects_page, wgs_samples_page, prepared_samples_page, seq_page
from src.shinylims.ui_server import setup_projects_page, setup_wgs_samples_page, setup_prepared_samples_page, setup_seq_run_page
from src.shinylims.data_utils import fetch_pinned_data

# Add assets
from pathlib import Path
css_path = Path(__file__).parent / "assets" / "styles.css"

####################
# CONSTRUCT THE UI #
Expand All @@ -25,7 +28,7 @@
theme.cerulean(),

# Include the custom CSS file
ui.head_content(ui.include_css("styles.css")),
ui.head_content(ui.include_css(css_path)),

# Push the navbar items to the right
ui.nav_spacer(),
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 853b0bf

Please sign in to comment.