Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exercise 1 #5

Merged
merged 2 commits into from
Dec 6, 2024
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
19 changes: 19 additions & 0 deletions 04-containers/solutions/sferkel/exercise1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM python:3.9-slim

## Install click 7.1.2 uisng pip from PyPI
RUN pip install click==7.1.2

## set working directory to /opt
WORKDIR /opt

## Copy the app.py file to /opt
COPY app.py /opt

## Make app.py executeable
RUN chmod +x /opt/app.py

## Add app.py to the path
RUN export PATH=/opt:$PATH

## Run the application
CMD ["python", "/opt/app.py", "--name", "Sonia"]
17 changes: 17 additions & 0 deletions 04-containers/solutions/sferkel/exercise1/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import click

@click.command()
@click.option('--name', default='Test', help='Name of the participant.')
@click.version_option(version='1.1.0')
def main(name):
"""
A demo App for BIOS259: The Art of Reproducible Science
https://github.com/asntech/bios259-a24

Author: Aziz Khan <[email protected]>
"""

print(f"Hello, {name}!\nWelcome to BIOS259 – The Art of Reproducible Science")

if __name__ == "__main__":
main()
19 changes: 19 additions & 0 deletions 04-containers/solutions/sferkel/exercise2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM asntech/bios259:a24.e1

## Install latest version of seaborn uisng pip from PyPI - https://pypi.org/project/seaborn/
RUN pip install seaborn

## set working directory to /opt
WORKDIR /opt

## Copy the app2.py file to /opt
COPY app2.py /opt

## Make app2.py executeable
RUN chmod +x /opt/app2.py

## Add ap2p.py to the path
ENV PATH=/opt:$PATH

## Run the application help
CMD ["app2.py", "--help"]
29 changes: 29 additions & 0 deletions 04-containers/solutions/sferkel/exercise2/app2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env python

import click
import seaborn as sns

@click.command()
@click.option('--dataset', default='healthexp', help='Name of the dataset – github.com/mwaskom/seaborn-data')
@click.version_option(version='1.2.0')
def main(dataset):
"""
A demo App2 for BIOS259: The Art of Reproducible Science
https://github.com/asntech/bios259-a24
Author: Aziz Khan <[email protected]>
"""
# Load the dataset
try:
dataset = sns.load_dataset(dataset)
except ValueError as e:
click.echo(f"Error: {e}")
return

# Print dataset information
click.echo(f"Descriptive Statistics for {dataset} dataset:")
click.echo("==============================================")
click.echo(dataset.describe())

if __name__ == "__main__":
main()
Loading