Skip to content

Commit 8bc871e

Browse files
authored
Merge pull request #81 from nmfs-opensci/main
update from main
2 parents e28353f + a03c5ea commit 8bc871e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+11221
-87
lines changed

.gitignore

+2-24
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
__pycache__/
33
*.py[cod]
44
*$py.class
5-
65
# C extensions
76
*.so
8-
97
# Distribution / packaging
108
.Python
119
build/
@@ -26,17 +24,14 @@ share/python-wheels/
2624
.installed.cfg
2725
*.egg
2826
MANIFEST
29-
3027
# PyInstaller
3128
# Usually these files are written by a python script from a template
3229
# before PyInstaller builds the exe, so as to inject date/other infos into it.
3330
*.manifest
3431
*.spec
35-
3632
# Installer logs
3733
pip-log.txt
3834
pip-delete-this-directory.txt
39-
4035
# Unit test / coverage reports
4136
htmlcov/
4237
.tox/
@@ -50,57 +45,43 @@ coverage.xml
5045
*.py,cover
5146
.hypothesis/
5247
.pytest_cache/
53-
5448
# Translations
5549
*.mo
5650
*.pot
57-
5851
# Django stuff:
5952
*.log
6053
local_settings.py
6154
db.sqlite3
6255
db.sqlite3-journal
63-
6456
# Flask stuff:
6557
instance/
6658
.webassets-cache
67-
6859
# Scrapy stuff:
6960
.scrapy
70-
7161
# Sphinx documentation
7262
docs/_build/
73-
7463
# PyBuilder
7564
target/
76-
7765
# Jupyter Notebook
7866
.ipynb_checkpoints
79-
8067
# IPython
8168
profile_default/
8269
ipython_config.py
83-
8470
# pyenv
8571
.python-version
86-
8772
# pipenv
8873
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
8974
# However, in case of collaboration, if having platform-specific dependencies or dependencies
9075
# having no cross-platform support, pipenv may install dependencies that don't work, or not
9176
# install all needed dependencies.
9277
#Pipfile.lock
93-
9478
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
9579
__pypackages__/
96-
9780
# Celery stuff
9881
celerybeat-schedule
9982
celerybeat.pid
100-
10183
# SageMath parsed files
10284
*.sage.py
103-
10485
# Environments
10586
.env
10687
.venv
@@ -109,21 +90,18 @@ venv/
10990
ENV/
11091
env.bak/
11192
venv.bak/
112-
11393
# Spyder project settings
11494
.spyderproject
11595
.spyproject
116-
11796
# Rope project settings
11897
.ropeproject
119-
12098
# mkdocs documentation
12199
/site
122-
123100
# mypy
124101
.mypy_cache/
125102
.dmypy.json
126103
dmypy.json
127-
128104
# Pyre type checker
129105
.pyre/
106+
.Rproj.user
107+
py-rocket-base.Rproj

book/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.quarto/

book/_quarto.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
project:
2+
type: book
3+
output-dir: ../docs # Path to output directory, relative to _quarto.yml
4+
5+
book:
6+
page-navigation: true
7+
title: "py-rocket-base documentation"
8+
site-url: "https://nmfs-opensci.github.io/py-rocket-base"
9+
repo-url: "https://github.com/nmfs-opensci/py-rocket-base"
10+
repo-actions: [edit, source, issue]
11+
favicon: assets/favicon.ico
12+
search: true
13+
author:
14+
- name: Eli Holmes
15+
affiliations:
16+
- name: NOAA Fisheres
17+
department: NMFS Open Science
18+
chapters:
19+
- index.qmd
20+
- customizing.qmd
21+
- configuration_files.qmd
22+
- desktop.qmd
23+
- tex.qmd
24+
- py-rocket-base.qmd
25+
26+
sidebar:
27+
background: "#D9E3E4"
28+
logo: "https://raw.githubusercontent.com/nmfs-opensci/assets/main/logo/nmfs-opensci-logo3.png"
29+
pinned: true
30+
align: center
31+
tools:
32+
- icon: globe
33+
href: https://nmfs-opensci.github.io
34+
text: "NMFS Open Science"
35+
style: "docked"
36+
search: true
37+
collapse-level: 1
38+
39+
40+
format:
41+
html:
42+
theme:
43+
light: [cosmo, theme.scss]
44+
dark: [cosmo, theme-dark.scss]
45+
code-copy: true
46+
code-overflow: wrap
47+
toc: true

book/assets/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This folder has various formatting files.

book/assets/favicon.ico

15 KB
Binary file not shown.

book/assets/include-files.lua

+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
--- include-files.lua – filter to include Markdown files
2+
---
3+
--- Copyright: © 2019–2021 Albert Krewinkel
4+
--- License: MIT – see LICENSE file for details
5+
6+
-- Module pandoc.path is required and was added in version 2.12
7+
PANDOC_VERSION:must_be_at_least '2.12'
8+
9+
local List = require 'pandoc.List'
10+
local path = require 'pandoc.path'
11+
local system = require 'pandoc.system'
12+
13+
--- Get include auto mode
14+
local include_auto = false
15+
function get_vars (meta)
16+
if meta['include-auto'] then
17+
include_auto = true
18+
end
19+
end
20+
21+
--- Keep last heading level found
22+
local last_heading_level = 0
23+
function update_last_level(header)
24+
last_heading_level = header.level
25+
end
26+
27+
--- Update contents of included file
28+
local function update_contents(blocks, shift_by, include_path)
29+
local update_contents_filter = {
30+
-- Shift headings in block list by given number
31+
Header = function (header)
32+
if shift_by then
33+
header.level = header.level + shift_by
34+
end
35+
return header
36+
end,
37+
-- If image paths are relative then prepend include file path
38+
Image = function (image)
39+
if path.is_relative(image.src) then
40+
image.src = path.normalize(path.join({include_path, image.src}))
41+
end
42+
return image
43+
end,
44+
-- Update path for include-code-files.lua filter style CodeBlocks
45+
CodeBlock = function (cb)
46+
if cb.attributes.include and path.is_relative(cb.attributes.include) then
47+
cb.attributes.include =
48+
path.normalize(path.join({include_path, cb.attributes.include}))
49+
end
50+
return cb
51+
end
52+
}
53+
54+
return pandoc.walk_block(pandoc.Div(blocks), update_contents_filter).content
55+
end
56+
57+
--- Filter function for code blocks
58+
local transclude
59+
function transclude (cb)
60+
-- ignore code blocks which are not of class "include".
61+
if not cb.classes:includes 'include' then
62+
return
63+
end
64+
65+
-- Markdown is used if this is nil.
66+
local format = cb.attributes['format']
67+
68+
-- Attributes shift headings
69+
local shift_heading_level_by = 0
70+
local shift_input = cb.attributes['shift-heading-level-by']
71+
if shift_input then
72+
shift_heading_level_by = tonumber(shift_input)
73+
else
74+
if include_auto then
75+
-- Auto shift headings
76+
shift_heading_level_by = last_heading_level
77+
end
78+
end
79+
80+
--- keep track of level before recusion
81+
local buffer_last_heading_level = last_heading_level
82+
83+
local blocks = List:new()
84+
for line in cb.text:gmatch('[^\n]+') do
85+
if line:sub(1,2) ~= '//' then
86+
local fh = io.open(line)
87+
if not fh then
88+
io.stderr:write("Cannot open file " .. line .. " | Skipping includes\n")
89+
else
90+
local contents = pandoc.read(fh:read '*a', format).blocks
91+
last_heading_level = 0
92+
-- recursive transclusion
93+
contents = system.with_working_directory(
94+
path.directory(line),
95+
function ()
96+
return pandoc.walk_block(
97+
pandoc.Div(contents),
98+
{ Header = update_last_level, CodeBlock = transclude }
99+
)
100+
end).content
101+
--- reset to level before recursion
102+
last_heading_level = buffer_last_heading_level
103+
blocks:extend(update_contents(contents, shift_heading_level_by,
104+
path.directory(line)))
105+
fh:close()
106+
end
107+
end
108+
end
109+
return blocks
110+
end
111+
112+
return {
113+
{ Meta = get_vars },
114+
{ Header = update_last_level, CodeBlock = transclude }
115+
}

book/assets/theme-dark.scss

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*-- scss:defaults --*/
2+
3+
@import 'https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible&display=swap';
4+
5+
$font-family: "Atkinson Hyperlegible", sans-serif;
6+
7+
// Base document colors
8+
$body-bg: #181818;
9+
$body-color: white;
10+
$link-color: #75AADB;
11+
12+
$light: #525252;
13+
14+
// Navigation element colors
15+
$footer-bg: #181818;
16+
$navbar-bg: #303030;
17+
$sidebar-bg: #303030;
18+
19+
// Code blocks
20+
$code-block-bg-alpha: -.8;
21+
22+
// Bootstrap popovers
23+
$popover-bg: #242424;
24+
25+
// Bootstrap inputs
26+
$input-bg: #242424;

book/assets/theme.scss

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/*-- scss:defaults --*/
2+
3+
@import 'https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible&display=swap';
4+
5+
$font-family: "Atkinson Hyperlegible", sans-serif;
6+

book/configuration_files.qmd

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Configuration files
2+
3+
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
4+
to write you own code in your Dockerfile.
5+
6+
## environment.yml
7+
8+
## install.R
9+
10+
## apt.txt
11+
12+
## postBuild
13+
14+
## Desktop directory
15+

book/customizing.qmd

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Using py-rocket-base
2+
3+
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
4+
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.
5+
6+
If you don't want it to do this then do not name your files one of these names:
7+
8+
- environment.yml
9+
- install.R
10+
- postBuild
11+
- apt.txt
12+
- start
13+
14+
## File structure
15+
16+
Only Dockerfile is required. The rest are optional.
17+
18+
```
19+
your-repo/
20+
├── Dockerfile
21+
├── apt.txt
22+
├── environment.yml
23+
├── install.R
24+
├── postBuild
25+
├── start
26+
├── Desktop/
27+
│ ├── qgis.desktop
28+
│ ├── qgis.xml
29+
│ └── qgis.png
30+
```
31+
32+
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.
33+
34+
## Examples
35+
36+
You want to add some Python packages to py-rocker-base.
37+
38+
```
39+
your-repo/
40+
├── Dockerfile
41+
├── environment.yml
42+
```
43+
44+
Dockerfile
45+
```
46+
FROM ghcr.io/nmfs-opensci/py-rocket-base:latest
47+
```
48+
49+
environment.yml
50+
```
51+
name: optional
52+
channels:
53+
- conda-forge
54+
dependencies:
55+
- cmocean
56+
- numpy
57+
```

0 commit comments

Comments
 (0)