Skip to content

Commit

Permalink
slides and tweak container config
Browse files Browse the repository at this point in the history
  • Loading branch information
knaaptime committed Dec 3, 2024
1 parent cf76ed1 commit 0c0c267
Show file tree
Hide file tree
Showing 149 changed files with 15,622 additions and 25 deletions.
8 changes: 0 additions & 8 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
FROM mcr.microsoft.com/devcontainers/base:jammy

ARG PIXI_VERSION=v0.33.0

RUN curl -L -o /usr/local/bin/pixi -fsSL --compressed "https://github.com/prefix-dev/pixi/releases/download/${PIXI_VERSION}/pixi-$(uname -m)-unknown-linux-musl" \

&& chmod +x /usr/local/bin/pixi \

&& pixi info

# set some user and workdir settings to work nicely with vscode

USER vscode

WORKDIR /home/vscode

RUN echo 'eval "$(pixi completion -s bash)"' >> /home/vscode/.bashrc
15 changes: 5 additions & 10 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
{
"name": "rypyr",

"name": "rypyrx",
"build": {
"dockerfile": "Dockerfile",

"context": ".."
},

"customizations": {
"vscode": {
"settings": {},

"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
Expand All @@ -28,18 +24,17 @@
"quarto.quarto",
"shd101wyy.markdown-preview-enhanced",
"notzaki.pandocciter"

]
}
},

"hostRequirements": {
"memory": "4gb"
},
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
},

"mounts": [
"source=${localWorkspaceFolderBasename}-pixi,target=${containerWorkspaceFolder}/.pixi,type=volume"
],

"postCreateCommand": "sudo chown vscode .pixi && pixi install"
}
}
23 changes: 18 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
# `rypyr`
# `rypyrx`

[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/knaaptime/rypyr)
reproducible research environments, cross language/cross-platform

pronounced 'ripper', like [repr](), but so that R people can grok reproducible Python environments
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/knaaptime/rypyrx)

tl;dr: I write in quarto and do my work in both python and R. But lots of people still hate Python environments. I swear they are straightforward for this task now!
pronounced 'rip-rex', like [reprex](https://reprex.tidyverse.org/), but so that R people can grok reproducible Python environments for papers et al

tl;dr: I write in quarto and do my work in both Python and R. I work with lots of people who are new to Python environments, or hate them altogether. I swear they are straightforward for this task now!

the important pieces are:

- the `pixi.toml` file defines the dependencies and when installed pixi creates a lockfile to make sure you can re-create that *exact* environment anywhere
- the files in `.devcontainer` setup codespaces to install the project dependencies and some useful vscode extensions (so you can run whatever notebooks you create in the cloud)
- the files in `.github/workflows` setup the repo to serve a static website from the `slides` directory, so when you use quarto to generate slides in that directory, they're available immediately at `<{your-github}.github.io/{project_name}>`
- the slides and paper are separate quarto projects which allows you to keep the repo private while you work on code and paper, but publish the slides (using the same materials) for giving conference talks etc while the paper is in draft.

## Goals

Expand Down Expand Up @@ -42,10 +51,14 @@ edit the notebooks as you like

## Execute and Build

`cd paper`
`cd paper`
`pixi run quarto render`

will run the python and r noteooks and generate the html and pdf in `paper/_manuscript`

**note** this workflow works perfectly when run locally (on my mac). Currently, quarto's default latex engine (tinytex) has a `PATH` issue when running through pixi in codespaces (which, given pixi's hyper-sandboxing, is not terribly surprising). You can get around that at the moment by using the tectonic engine for the pdf, like:

`pixi run quarto render --pdf-engine tectonic`

you can use `pixi run quarto preview` to preview while you work

5 changes: 3 additions & 2 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
channels = ["conda-forge", "r", "main"]
description = "A demo project using quarto and pixi for full-stack reproducibility"
name = "rypyr"
platforms = ["linux-64", "win-64", "osx-64"] # I left osx-arm because theres no r-satellite <https://pixi.sh/v0.27.1/reference/project_configuration/#the-project-table>
platforms = ["linux-64", "win-64", "osx-64", "linux-aarch64"] # I left out osx-arm because theres no r-satellite build <https://pixi.sh/v0.27.1/reference/project_configuration/#the-project-table>
version = "0.1.0"

[tasks]
Expand Down Expand Up @@ -34,7 +34,7 @@ rpy2 = "*"
# R deps
r-irkernel = "*"
r-tidymodels = "*"
#r-spdep = "*" # sfdep hasn't made it onto conda-forge yet
#r-spdep = "*" # sfdep hasn't made it onto conda-forge yet
r-nlme = "*"
r-lme4 = "*"
r-tidycensus = "*"
Expand All @@ -43,3 +43,4 @@ r-reticulate = "*"
r-mapview = "*"
r-languageserver = "*"
r-tinytex = "*"
r-devtools = "*" # use install.packages() to get whatever, but you wont have a lockfile for those
1 change: 1 addition & 0 deletions slides/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.quarto/
11 changes: 11 additions & 0 deletions slides/_quarto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
project:
type: website
output-dir: "." # publish from root of this dir
format:
html:
embed-resources: true
theme:
light:
- flatly
dark:
- cyborg
Loading

0 comments on commit 0c0c267

Please sign in to comment.