Skip to content

Commit 2267945

Browse files
authored
Initial commit
0 parents  commit 2267945

15 files changed

Lines changed: 2272 additions & 0 deletions
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Publishes docker image, pinning actions to a commit SHA,
2+
# and updating most recently built image with the latest tag.
3+
# Can be triggered by either pushing a commit that changes the `Dockerfile`,
4+
# or manually dispatching the workflow.
5+
6+
name: Publish Docker image
7+
8+
on:
9+
workflow_dispatch:
10+
push:
11+
paths:
12+
- 'Dockerfile'
13+
- 'conda-linux-64.lock'
14+
15+
jobs:
16+
push_to_registry:
17+
name: Push Docker image to Docker Hub
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Check out the repo
21+
uses: actions/checkout@v4
22+
23+
- name: Log in to Docker Hub
24+
uses: docker/login-action@v3
25+
with:
26+
username: ${{ secrets.DOCKER_USERNAME }}
27+
password: ${{ secrets.DOCKER_PASSWORD }}
28+
29+
- name: Extract metadata (tags, labels) for Docker
30+
id: meta
31+
uses: docker/metadata-action@v5
32+
with:
33+
images: ttimbers/dsci-522-individual-assignment-quarto-python
34+
tags: |
35+
type=raw, value={{sha}},enable=${{github.ref_type != 'tag' }}
36+
type=raw, value=latest
37+
38+
- name: Build and push Docker image
39+
uses: docker/build-push-action@v6
40+
with:
41+
context: .
42+
file: ./Dockerfile
43+
push: true
44+
tags: ${{ steps.meta.outputs.tags }}
45+
labels: ${{ steps.meta.outputs.labels }}
46+
47+
- name: Update docker-compose.yml with new image tag
48+
if: success()
49+
run: |
50+
sed -i "s|image: ttimbers/dsci-522-individual-assignment-quarto-python:.*|image: ttimbers/dsci-522-individual-assignment-quarto-python:${{ steps.meta.outputs.version }}|" docker-compose.yml
51+
52+
- name: Commit and push updated docker-compose.yml
53+
if: success()
54+
run: |
55+
git config --global user.name "github-actions[bot]"
56+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
57+
git add docker-compose.yml
58+
git commit -m "Update docker-compose.yml with new image tag"
59+
git push

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
**.ipynb_checkpoints
2+
**.DS_Store
3+
**.cache/
4+
**.ipython/
5+
**.jupyter/
6+
**.local/
7+
**.npm/

Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM quay.io/jupyter/minimal-notebook:afe30f0c9ad8
2+
3+
COPY conda-linux-64.lock /tmp/conda-linux-64.lock
4+
5+
USER root
6+
7+
# install lmodern for Quarto PDF rendering
8+
RUN sudo apt update \
9+
&& sudo apt install -y lmodern
10+
11+
USER $NB_UID
12+
13+
# install packages from conda-linux-64.lock
14+
RUN mamba update --quiet --file /tmp/conda-linux-64.lock \
15+
&& mamba clean --all -y -f \
16+
&& fix-permissions "${CONDA_DIR}" \
17+
&& fix-permissions "/home/${NB_USER}"

LICENSE

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
## Non-software content
2+
3+
Copyright: Jordan Bourak & Tiffany Timbers
4+
5+
The DSCI 310 individual assignment on reproducible reports is made available under the **Attribution 4.0 International** ([CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)).
6+
7+
This is a human-readable summary of (and not a substitute for) the [license](https://creativecommons.org/licenses/by/4.0/legalcode).
8+
9+
You are free:
10+
11+
* to **Share**---copy and redistribute the material in any medium or format
12+
* to **Adapt**---remix, transform, and build upon the material
13+
14+
for any purpose, even commercially.
15+
16+
The licensor cannot revoke these freedoms as long as you follow the
17+
license terms.
18+
19+
Under the following terms:
20+
21+
* **Attribution**---You must give appropriate credit (mentioning that
22+
your work is derived from work that is Copyright © Software
23+
Carpentry and, where practical, linking to
24+
http://software-carpentry.org/), provide a [link to the
25+
license][cc-by-human], and indicate if changes were made. You may do
26+
so in any reasonable manner, but not in any way that suggests the
27+
licensor endorses you or your use.
28+
29+
**No additional restrictions**---You may not apply legal terms or
30+
technological measures that legally restrict others from doing
31+
anything the license permits. With the understanding that:
32+
33+
Notices:
34+
35+
* You do not have to comply with the license for elements of the
36+
material in the public domain or where your use is permitted by an
37+
applicable exception or limitation.
38+
* No warranties are given. The license may not give you all of the
39+
permissions necessary for your intended use. For example, other
40+
rights such as publicity, privacy, or moral rights may limit how you
41+
use the material.
42+
43+
44+
## Software
45+
46+
Copyright: Jordan Bourak & Tiffany Timbers
47+
48+
Except where otherwise noted, the software
49+
provided in the DSCI 310 individual assignment on reproducible reports
50+
is available under the
51+
[OSI][osi]-approved
52+
[MIT license][mit-license].
53+
54+
Permission is hereby granted, free of charge, to any person obtaining
55+
a copy of this software and associated documentation files (the
56+
"Software"), to deal in the Software without restriction, including
57+
without limitation the rights to use, copy, modify, merge, publish,
58+
distribute, sublicense, and/or sell copies of the Software, and to
59+
permit persons to whom the Software is furnished to do so, subject to
60+
the following conditions:
61+
62+
The above copyright notice and this permission notice shall be
63+
included in all copies or substantial portions of the Software.
64+
65+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
66+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
67+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
68+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
69+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
70+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
71+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
## DSCI 522 individual assignment on Quarto reproducible reports using Python
2+
3+
This is a template repository
4+
for the individual assignment on Quarto reproducible reports using Python
5+
from the DSCI 522 (Workflows for data science) course.
6+
Instructions for this assignment can be found on the DSCI 522 course website.
7+
8+
### Dependencies
9+
10+
- [Docker](https://www.docker.com/)
11+
12+
### Usage
13+
14+
#### Setup
15+
16+
> If you are using Windows or Mac, make sure Docker Desktop is running.
17+
18+
1. Clone this GitHub repository.
19+
20+
#### Running the analysis
21+
22+
1. Navigate to the root of this project on your computer using the
23+
command line and enter the following command:
24+
25+
```
26+
docker compose up
27+
```
28+
29+
2. In the terminal, look for a URL that starts with
30+
`http://127.0.0.1:8888/lab?token=`
31+
(for an example, see the highlighted text in the terminal below).
32+
Copy and paste that URL into your browser.
33+
34+
<img src="img/jupyter-container-web-app-launch-url.png" width=400>
35+
36+
3. To run the analysis,
37+
open a terminal (in the docker jupyter lab) and run the following commands:
38+
39+
```
40+
python scripts/generate_figures.py --input_dir="data/00030067-eng.csv" \
41+
--out_dir="results"
42+
43+
quarto render reports/qmd_example.qmd --to html
44+
quarto render reports/qmd_example.qmd --to pdf
45+
```
46+
47+
#### Clean up
48+
49+
1. To shut down the container and clean up the resources,
50+
type `Cntrl` + `C` in the terminal
51+
where you launched the container, and then type `docker compose rm`
52+
53+
## Developer notes
54+
55+
### Developer dependencies
56+
- `conda` (version 23.9.0 or higher)
57+
- `conda-lock` (version 2.5.7 or higher)
58+
59+
### Adding a new dependency
60+
61+
1. Add the dependency to the `environment.yml` file on a new branch.
62+
63+
2. Run `conda-lock -k explicit --file environment.yml -p linux-64` to update the `conda-linux-64.lock` file.
64+
65+
2. Re-build the Docker image locally to ensure it builds and runs properly.
66+
67+
3. Push the changes to GitHub. A new Docker
68+
image will be built and pushed to Docker Hub automatically.
69+
It will be tagged with the SHA for the commit that changed the file.
70+
71+
4. Update the `docker-compose.yml` file on your branch to use the new
72+
container image (make sure to update the tag specifically).
73+
74+
5. Send a pull request to merge the changes into the `main` branch.
75+
76+
### License:
77+
The non-software content of this template repository is licensed under the
78+
[Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) License](https://creativecommons.org/licenses/by-nc-sa/4.0/).
79+
The software content of this template repository licensed under the [MIT License](https://spdx.org/licenses/MIT.html). See the [license file](LICENSE.md) for more information.

conda-linux-64.lock

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Generated by conda-lock.
2+
# platform: linux-64
3+
# input_hash: c741a250b9198dde712edc9f15753e8f58d55f89739bd81714ba4fee7c615367
4+
@EXPLICIT
5+
https://conda.anaconda.org/conda-forge/linux-64/_libgcc_mutex-0.1-conda_forge.tar.bz2#d7c89558ba9fa0495403155b64376d81
6+
https://conda.anaconda.org/conda-forge/linux-64/ca-certificates-2024.8.30-hbcca054_0.conda#c27d1c142233b5bc9ca570c6e2e0c244
7+
https://conda.anaconda.org/conda-forge/linux-64/dart-sass-1.58.3-ha770c72_1.conda#d54982a58cd9be3d00a7efe76ba6f60c
8+
https://conda.anaconda.org/conda-forge/linux-64/esbuild-0.24.0-ha770c72_0.conda#b2cdfd1d3c62519b913d71f200e7f9ca
9+
https://conda.anaconda.org/conda-forge/linux-64/pandoc-3.2-ha770c72_0.conda#8c924f0b7f3e064b1c954a08e7c32fba
10+
https://conda.anaconda.org/conda-forge/linux-64/python_abi-3.11-5_cp311.conda#139a8d40c8a2f430df31048949e450de
11+
https://conda.anaconda.org/conda-forge/noarch/tzdata-2024b-hc8b5060_0.conda#8ac3367aafb1cc0a068483c580af8015
12+
https://conda.anaconda.org/conda-forge/linux-64/ld_impl_linux-64-2.43-h712a8e2_2.conda#048b02e3962f066da18efe3a21b77672
13+
https://conda.anaconda.org/conda-forge/linux-64/libgomp-14.2.0-h77fa898_1.conda#cc3573974587f12dda90d96e3e55a702
14+
https://conda.anaconda.org/conda-forge/linux-64/_openmp_mutex-4.5-2_gnu.tar.bz2#73aaf86a425cc6e73fcf236a5a46396d
15+
https://conda.anaconda.org/conda-forge/linux-64/libgcc-14.2.0-h77fa898_1.conda#3cb76c3f10d3bc7f1105b2fc9db984df
16+
https://conda.anaconda.org/conda-forge/linux-64/libexpat-2.6.4-h5888daf_0.conda#db833e03127376d461e1e13e76f09b6c
17+
https://conda.anaconda.org/conda-forge/linux-64/libgcc-ng-14.2.0-h69a702a_1.conda#e39480b9ca41323497b05492a63bc35b
18+
https://conda.anaconda.org/conda-forge/linux-64/libgfortran5-14.2.0-hd5240d6_1.conda#9822b874ea29af082e5d36098d25427d
19+
https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-14.2.0-hc0a3c3a_1.conda#234a5554c53625688d51062645337328
20+
https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.3.1-hb9d3cd8_2.conda#edb0dca6bc32e4f4789199455a1dbeb8
21+
https://conda.anaconda.org/conda-forge/linux-64/openssl-3.4.0-hb9d3cd8_0.conda#23cc74f77eb99315c0360ec3533147a9
22+
https://conda.anaconda.org/conda-forge/linux-64/bzip2-1.0.8-h4bc722e_7.conda#62ee74e96c5ebb0af99386de58cf9553
23+
https://conda.anaconda.org/conda-forge/linux-64/deno-1.41.0-hfc7925d_0.conda#8d6e6bd74055bd30c88d3a678395a7e9
24+
https://conda.anaconda.org/conda-forge/linux-64/libffi-3.4.2-h7f98852_5.tar.bz2#d645c6d2ac96843a2bfaccd2d62b3ac3
25+
https://conda.anaconda.org/conda-forge/linux-64/libgfortran-14.2.0-h69a702a_1.conda#f1fd30127802683586f768875127a987
26+
https://conda.anaconda.org/conda-forge/linux-64/libnsl-2.0.1-hd590300_0.conda#30fd6e37fe21f86f4bd26d6ee73eeec7
27+
https://conda.anaconda.org/conda-forge/linux-64/libsqlite-3.47.0-hadc24fc_1.conda#b6f02b52a174e612e89548f4663ce56a
28+
https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-ng-14.2.0-h4852527_1.conda#8371ac6457591af2cf6159439c1fd051
29+
https://conda.anaconda.org/conda-forge/linux-64/libuuid-2.38.1-h0b41bf4_0.conda#40b61aab5c7ba9ff276c41cfffe6b80b
30+
https://conda.anaconda.org/conda-forge/linux-64/libxcrypt-4.4.36-hd590300_1.conda#5aa797f8787fe7a17d1b0821485b5adc
31+
https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.5-he02047a_1.conda#70caf8bb6cf39a0b6b7efc885f51c0fe
32+
https://conda.anaconda.org/conda-forge/linux-64/tk-8.6.13-noxft_h4845f30_101.conda#d453b98d9c83e71da0741bb0ff4d76bc
33+
https://conda.anaconda.org/conda-forge/linux-64/typst-0.11.0-he8a937b_0.conda#f6ac8c8ab4a4c9ed0ec710e3f5fa3954
34+
https://conda.anaconda.org/conda-forge/linux-64/xz-5.2.6-h166bdaf_0.tar.bz2#2161070d867d1b1204ea749c8eec4ef0
35+
https://conda.anaconda.org/conda-forge/linux-64/deno-dom-0.1.35-hd9586b0_1.conda#263ee0870b18b013d9ec8539113ac69f
36+
https://conda.anaconda.org/conda-forge/linux-64/libopenblas-0.3.28-pthreads_h94d23a6_1.conda#62857b389e42b36b686331bec0922050
37+
https://conda.anaconda.org/conda-forge/linux-64/readline-8.2-h8228510_1.conda#47d31b792659ce70f470b5c82fdfb7a4
38+
https://conda.anaconda.org/conda-forge/linux-64/libblas-3.9.0-25_linux64_openblas.conda#8ea26d42ca88ec5258802715fe1ee10b
39+
https://conda.anaconda.org/conda-forge/linux-64/python-3.11.10-hc5c86c4_3_cpython.conda#9e1ad55c87368e662177661a998feed5
40+
https://conda.anaconda.org/conda-forge/linux-64/quarto-1.5.57-ha770c72_0.conda#dd6838c663e9b5a1b18048a164ccb90b
41+
https://conda.anaconda.org/conda-forge/noarch/attrs-24.2.0-pyh71513ae_0.conda#6732fa52eb8e66e5afeb32db8701a791
42+
https://conda.anaconda.org/conda-forge/noarch/click-8.1.7-unix_pyh707e725_0.conda#f3ad426304898027fc619827ff428eca
43+
https://conda.anaconda.org/conda-forge/linux-64/libcblas-3.9.0-25_linux64_openblas.conda#5dbd1b0fc0d01ec5e0e1fbe667281a11
44+
https://conda.anaconda.org/conda-forge/linux-64/liblapack-3.9.0-25_linux64_openblas.conda#4dc03a53fc69371a6158d0ed37214cd3
45+
https://conda.anaconda.org/conda-forge/linux-64/markupsafe-3.0.2-py311h2dc5d0c_0.conda#15e4dadd59e93baad7275249f10b9472
46+
https://conda.anaconda.org/conda-forge/noarch/packaging-24.2-pyhff2d567_1.conda#8508b703977f4c4ada34d657d051972c
47+
https://conda.anaconda.org/conda-forge/noarch/pkgutil-resolve-name-1.3.10-pyhd8ed1ab_1.conda#405678b942f2481cecdb3e010f4925d9
48+
https://conda.anaconda.org/conda-forge/noarch/python-tzdata-2024.2-pyhd8ed1ab_0.conda#986287f89929b2d629bd6ef6497dc307
49+
https://conda.anaconda.org/conda-forge/noarch/pytz-2024.2-pyhd8ed1ab_0.conda#260009d03c9d5c0f111904d851f053dc
50+
https://conda.anaconda.org/conda-forge/linux-64/rpds-py-0.21.0-py311h9e33e62_0.conda#befdb32741d8686b860232ca80178d63
51+
https://conda.anaconda.org/conda-forge/noarch/setuptools-75.6.0-pyhff2d567_1.conda#fc80f7995e396cbaeabd23cf46c413dc
52+
https://conda.anaconda.org/conda-forge/noarch/six-1.16.0-pyh6c4a22f_0.tar.bz2#e5f25f8dbc060e9a8d912e432202afc2
53+
https://conda.anaconda.org/conda-forge/noarch/tabulate-0.9.0-pyhd8ed1ab_1.tar.bz2#4759805cce2d914c38472f70bf4d8bcb
54+
https://conda.anaconda.org/conda-forge/noarch/toolz-1.0.0-pyhd8ed1ab_0.conda#34feccdd4177f2d3d53c73fc44fd9a37
55+
https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.12.2-pyha770c72_0.conda#ebe6952715e1d5eb567eeebf25250fa7
56+
https://conda.anaconda.org/conda-forge/linux-64/vl-convert-python-1.0.1-py311h459d7ec_0.conda#a57e401035ccc80d2d775fae19bf7226
57+
https://conda.anaconda.org/conda-forge/noarch/wheel-0.45.1-pyhd8ed1ab_0.conda#bdb2f437ce62fd2f1fef9119a37a12d9
58+
https://conda.anaconda.org/conda-forge/noarch/zipp-3.21.0-pyhd8ed1ab_1.conda#0c3cc595284c5e8f0f9900a9b228a332
59+
https://conda.anaconda.org/conda-forge/noarch/importlib-metadata-8.5.0-pyha770c72_0.conda#54198435fce4d64d8a89af22573012a8
60+
https://conda.anaconda.org/conda-forge/noarch/importlib_resources-6.4.5-pyhd8ed1ab_0.conda#c808991d29b9838fb4d96ce8267ec9ec
61+
https://conda.anaconda.org/conda-forge/noarch/jinja2-3.1.4-pyhd8ed1ab_0.conda#7b86ecb7d3557821c649b3c31e3eb9f2
62+
https://conda.anaconda.org/conda-forge/linux-64/numpy-1.26.4-py311h64a7726_0.conda#a502d7aad449a1206efb366d6a12c52d
63+
https://conda.anaconda.org/conda-forge/noarch/pip-24.3.1-pyh8b19718_0.conda#5dd546fe99b44fda83963d15f84263b7
64+
https://conda.anaconda.org/conda-forge/noarch/python-dateutil-2.9.0.post0-pyhff2d567_0.conda#b6dfd90a2141e573e4b6a81630b56df5
65+
https://conda.anaconda.org/conda-forge/noarch/referencing-0.35.1-pyhd8ed1ab_0.conda#0fc8b52192a8898627c3efae1003e9f6
66+
https://conda.anaconda.org/conda-forge/noarch/typing-extensions-4.12.2-hd8ed1ab_0.conda#52d648bd608f5737b123f510bb5514b5
67+
https://conda.anaconda.org/conda-forge/noarch/jsonschema-specifications-2024.10.1-pyhd8ed1ab_0.conda#720745920222587ef942acfbc578b584
68+
https://conda.anaconda.org/conda-forge/linux-64/pandas-2.1.2-py311h320fe9a_0.conda#c36a53056129665b34db419b6af3d230
69+
https://conda.anaconda.org/conda-forge/noarch/jsonschema-4.23.0-pyhd8ed1ab_0.conda#da304c192ad59975202859b367d0f6a2
70+
https://conda.anaconda.org/conda-forge/noarch/altair-5.1.2-pyhd8ed1ab_0.conda#94f6558bed7e125d6115f4a6b70966d4

0 commit comments

Comments
 (0)