-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #81 from nmfs-opensci/main
update from main
- Loading branch information
Showing
43 changed files
with
11,221 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/.quarto/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
project: | ||
type: book | ||
output-dir: ../docs # Path to output directory, relative to _quarto.yml | ||
|
||
book: | ||
page-navigation: true | ||
title: "py-rocket-base documentation" | ||
site-url: "https://nmfs-opensci.github.io/py-rocket-base" | ||
repo-url: "https://github.com/nmfs-opensci/py-rocket-base" | ||
repo-actions: [edit, source, issue] | ||
favicon: assets/favicon.ico | ||
search: true | ||
author: | ||
- name: Eli Holmes | ||
affiliations: | ||
- name: NOAA Fisheres | ||
department: NMFS Open Science | ||
chapters: | ||
- index.qmd | ||
- customizing.qmd | ||
- configuration_files.qmd | ||
- desktop.qmd | ||
- tex.qmd | ||
- py-rocket-base.qmd | ||
|
||
sidebar: | ||
background: "#D9E3E4" | ||
logo: "https://raw.githubusercontent.com/nmfs-opensci/assets/main/logo/nmfs-opensci-logo3.png" | ||
pinned: true | ||
align: center | ||
tools: | ||
- icon: globe | ||
href: https://nmfs-opensci.github.io | ||
text: "NMFS Open Science" | ||
style: "docked" | ||
search: true | ||
collapse-level: 1 | ||
|
||
|
||
format: | ||
html: | ||
theme: | ||
light: [cosmo, theme.scss] | ||
dark: [cosmo, theme-dark.scss] | ||
code-copy: true | ||
code-overflow: wrap | ||
toc: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This folder has various formatting files. |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
--- include-files.lua – filter to include Markdown files | ||
--- | ||
--- Copyright: © 2019–2021 Albert Krewinkel | ||
--- License: MIT – see LICENSE file for details | ||
|
||
-- Module pandoc.path is required and was added in version 2.12 | ||
PANDOC_VERSION:must_be_at_least '2.12' | ||
|
||
local List = require 'pandoc.List' | ||
local path = require 'pandoc.path' | ||
local system = require 'pandoc.system' | ||
|
||
--- Get include auto mode | ||
local include_auto = false | ||
function get_vars (meta) | ||
if meta['include-auto'] then | ||
include_auto = true | ||
end | ||
end | ||
|
||
--- Keep last heading level found | ||
local last_heading_level = 0 | ||
function update_last_level(header) | ||
last_heading_level = header.level | ||
end | ||
|
||
--- Update contents of included file | ||
local function update_contents(blocks, shift_by, include_path) | ||
local update_contents_filter = { | ||
-- Shift headings in block list by given number | ||
Header = function (header) | ||
if shift_by then | ||
header.level = header.level + shift_by | ||
end | ||
return header | ||
end, | ||
-- If image paths are relative then prepend include file path | ||
Image = function (image) | ||
if path.is_relative(image.src) then | ||
image.src = path.normalize(path.join({include_path, image.src})) | ||
end | ||
return image | ||
end, | ||
-- Update path for include-code-files.lua filter style CodeBlocks | ||
CodeBlock = function (cb) | ||
if cb.attributes.include and path.is_relative(cb.attributes.include) then | ||
cb.attributes.include = | ||
path.normalize(path.join({include_path, cb.attributes.include})) | ||
end | ||
return cb | ||
end | ||
} | ||
|
||
return pandoc.walk_block(pandoc.Div(blocks), update_contents_filter).content | ||
end | ||
|
||
--- Filter function for code blocks | ||
local transclude | ||
function transclude (cb) | ||
-- ignore code blocks which are not of class "include". | ||
if not cb.classes:includes 'include' then | ||
return | ||
end | ||
|
||
-- Markdown is used if this is nil. | ||
local format = cb.attributes['format'] | ||
|
||
-- Attributes shift headings | ||
local shift_heading_level_by = 0 | ||
local shift_input = cb.attributes['shift-heading-level-by'] | ||
if shift_input then | ||
shift_heading_level_by = tonumber(shift_input) | ||
else | ||
if include_auto then | ||
-- Auto shift headings | ||
shift_heading_level_by = last_heading_level | ||
end | ||
end | ||
|
||
--- keep track of level before recusion | ||
local buffer_last_heading_level = last_heading_level | ||
|
||
local blocks = List:new() | ||
for line in cb.text:gmatch('[^\n]+') do | ||
if line:sub(1,2) ~= '//' then | ||
local fh = io.open(line) | ||
if not fh then | ||
io.stderr:write("Cannot open file " .. line .. " | Skipping includes\n") | ||
else | ||
local contents = pandoc.read(fh:read '*a', format).blocks | ||
last_heading_level = 0 | ||
-- recursive transclusion | ||
contents = system.with_working_directory( | ||
path.directory(line), | ||
function () | ||
return pandoc.walk_block( | ||
pandoc.Div(contents), | ||
{ Header = update_last_level, CodeBlock = transclude } | ||
) | ||
end).content | ||
--- reset to level before recursion | ||
last_heading_level = buffer_last_heading_level | ||
blocks:extend(update_contents(contents, shift_heading_level_by, | ||
path.directory(line))) | ||
fh:close() | ||
end | ||
end | ||
end | ||
return blocks | ||
end | ||
|
||
return { | ||
{ Meta = get_vars }, | ||
{ Header = update_last_level, CodeBlock = transclude } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/*-- scss:defaults --*/ | ||
|
||
@import 'https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible&display=swap'; | ||
|
||
$font-family: "Atkinson Hyperlegible", sans-serif; | ||
|
||
// Base document colors | ||
$body-bg: #181818; | ||
$body-color: white; | ||
$link-color: #75AADB; | ||
|
||
$light: #525252; | ||
|
||
// Navigation element colors | ||
$footer-bg: #181818; | ||
$navbar-bg: #303030; | ||
$sidebar-bg: #303030; | ||
|
||
// Code blocks | ||
$code-block-bg-alpha: -.8; | ||
|
||
// Bootstrap popovers | ||
$popover-bg: #242424; | ||
|
||
// Bootstrap inputs | ||
$input-bg: #242424; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/*-- scss:defaults --*/ | ||
|
||
@import 'https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible&display=swap'; | ||
|
||
$font-family: "Atkinson Hyperlegible", sans-serif; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Configuration files | ||
|
||
The presence of these files will trigger the following behavior. Do not use these names if you do not want this behavior and you instead want | ||
to write you own code in your Dockerfile. | ||
|
||
## environment.yml | ||
|
||
## install.R | ||
|
||
## apt.txt | ||
|
||
## postBuild | ||
|
||
## Desktop directory | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Using py-rocket-base | ||
|
||
py-rocket-base is designed to be used in the FROM line of a Dockerfile. It behaves like repo2docker in that it looks for special files and will | ||
install Python package or R packages if those special files are present. You do not need to add anything to the Dockerfile to have it process these files. py-rocker-base does this automatically for you. | ||
|
||
If you don't want it to do this then do not name your files one of these names: | ||
|
||
- environment.yml | ||
- install.R | ||
- postBuild | ||
- apt.txt | ||
- start | ||
|
||
## File structure | ||
|
||
Only Dockerfile is required. The rest are optional. | ||
|
||
``` | ||
your-repo/ | ||
├── Dockerfile | ||
├── apt.txt | ||
├── environment.yml | ||
├── install.R | ||
├── postBuild | ||
├── start | ||
├── Desktop/ | ||
│ ├── qgis.desktop | ||
│ ├── qgis.xml | ||
│ └── qgis.png | ||
``` | ||
|
||
Read [configuration_files](configuration_files.html) to learn about apt.txt, environment.yml, install.R, postBuild, and start. Read [Desktop](desktop.html) to learn about the Desktop folder and files for applications. | ||
|
||
## Examples | ||
|
||
You want to add some Python packages to py-rocker-base. | ||
|
||
``` | ||
your-repo/ | ||
├── Dockerfile | ||
├── environment.yml | ||
``` | ||
|
||
Dockerfile | ||
``` | ||
FROM ghcr.io/nmfs-opensci/py-rocket-base:latest | ||
``` | ||
|
||
environment.yml | ||
``` | ||
name: optional | ||
channels: | ||
- conda-forge | ||
dependencies: | ||
- cmocean | ||
- numpy | ||
``` |
Oops, something went wrong.