main > main: init
This commit is contained in:
commit
669796b805
37
.gitignore
vendored
Normal file
37
.gitignore
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
*
|
||||
!/.gitignore
|
||||
|
||||
################################################################
|
||||
# MAIN FOLDER
|
||||
################################################################
|
||||
|
||||
!/.env
|
||||
!/README.md
|
||||
!/LICENSE
|
||||
!/justfile
|
||||
!/requirements.txt
|
||||
|
||||
################################################################
|
||||
# PROJECT FILES
|
||||
################################################################
|
||||
|
||||
!/src
|
||||
!/src/**/
|
||||
!/src/**/*.py
|
||||
|
||||
!/docs
|
||||
!/docs/*.ipynb
|
||||
|
||||
################################################################
|
||||
# ARTEFACTS
|
||||
################################################################
|
||||
|
||||
**/.DS_Store
|
||||
**/__pycache__
|
||||
**/*__archive__*
|
||||
|
||||
################################################################
|
||||
# Git Keep
|
||||
################################################################
|
||||
|
||||
!/**/.gitkeep
|
12
README.md
Normal file
12
README.md
Normal file
@ -0,0 +1,12 @@
|
||||
# Notebooks #
|
||||
|
||||
This repository is for presenting purely supplementary material to research papers.
|
||||
These intended for the purposes of presentation only.
|
||||
|
||||
All scripts have been written by the owner of this repository.
|
||||
|
||||
## Presentations ##
|
||||
|
||||
See the [docs/*.ipynb](docs) files.
|
||||
To run these, users require python v3.10.x and the jupyter module.
|
||||
To install the package requirements, call `just build` or `python3 -m pip install -r requirements.txt`.
|
107
justfile
Normal file
107
justfile
Normal file
@ -0,0 +1,107 @@
|
||||
# set shell := [ "bash", "-uc" ]
|
||||
_default:
|
||||
@- just --unsorted --list
|
||||
menu:
|
||||
@- just --unsorted --choose
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# Justfile
|
||||
# NOTE: Do not change the contents of this file!
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# VARIABLES
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
OS := if os_family() == "windows" { "windows" } else { "linux" }
|
||||
PYTHON := if os_family() == "windows" { "py -3" } else { "python3" }
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# Macros
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
_create-file-if-not-exists fname:
|
||||
@touch "{{fname}}";
|
||||
|
||||
_create-folder-if-not-exists path:
|
||||
@if ! [ -d "{{path}}" ]; then mkdir "{{path}}"; fi
|
||||
|
||||
_delete-if-file-exists fname:
|
||||
@if [ -f "{{fname}}" ]; then rm "{{fname}}"; fi
|
||||
|
||||
_delete-if-folder-exists path:
|
||||
@if [ -d "{{path}}" ]; then rm -rf "{{path}}"; fi
|
||||
|
||||
_clean-all-files pattern:
|
||||
@find . -type f -name "{{pattern}}" -exec basename {} \; 2> /dev/null
|
||||
@- find . -type f -name "{{pattern}}" -exec rm {} \; 2> /dev/null
|
||||
|
||||
_clean-all-folders pattern:
|
||||
@find . -type d -name "{{pattern}}" -exec basename {} \; 2> /dev/null
|
||||
@- find . -type d -name "{{pattern}}" -exec rm -rf {} \; 2> /dev/null
|
||||
|
||||
_copy-file-if-not-exists path_from path_to:
|
||||
@- cp -n "{{path_from}}" "{{path_to}}"
|
||||
|
||||
_check-python-tool tool name:
|
||||
#!/usr/bin/env bash
|
||||
success=false
|
||||
{{tool}} --help >> /dev/null 2> /dev/null && success=true;
|
||||
# NOTE: if exitcode is 251 (= help or print version), then render success.
|
||||
[[ "$?" == "251" ]] && success=true;
|
||||
# FAIL tool not installed
|
||||
if ( $success ); then
|
||||
echo -e "Tool \x1b[2;3m{{tool}}\x1b[0m installed correctly.";
|
||||
exit 0;
|
||||
else
|
||||
echo -e "Tool \x1b[2;3m{{tool}}\x1b[0m did not work." >> /dev/stderr;
|
||||
echo -e "Ensure that \x1b[2;3m{{name}}\x1b[0m (-> \x1b[1mjust build\x1b[0m) installed correctly and system paths are set." >> /dev/stderr;
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# TARGETS
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# TARGETS: build
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
build:
|
||||
@{{PYTHON}} -m pip install --disable-pip-version-check -r requirements.txt
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# TARGETS: run
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# runs python notebook (in browser)
|
||||
run name:
|
||||
@# create config/data folders if missing:
|
||||
@just build-misc
|
||||
@# run notebook
|
||||
@{{PYTHON}} -m jupyter notebook notebooks/{{name}}.ipynb
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# TARGETS: clean
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
clean:
|
||||
@just clean-basic
|
||||
@just clean-notebooks
|
||||
clean-notebooks:
|
||||
@echo "Clean python notebooks."
|
||||
@#{{PYTHON}} -m jupyter nbconvert --clear-output --inplace docs/*.ipynb
|
||||
@- {{PYTHON}} -m jupytext --update-metadata '{"vscode":""}' docs/*.ipynb 2> /dev/null
|
||||
@- {{PYTHON}} -m jupytext --update-metadata '{"vscode":null}' docs/*.ipynb 2> /dev/null
|
||||
clean-basic:
|
||||
@echo "All system artefacts will be force removed."
|
||||
@- just _clean-all-files ".DS_Store" 2> /dev/null
|
||||
@echo "All build artefacts will be force removed."
|
||||
@- just _clean-all-folders "__pycache__" 2> /dev/null
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# TARGETS: requirements
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
_check-system:
|
||||
@echo "Operating System detected: {{os_family()}}."
|
||||
@echo "Python command used: {{PYTHON}}."
|
22
requirements.txt
Normal file
22
requirements.txt
Normal file
@ -0,0 +1,22 @@
|
||||
pip>=22.2.2
|
||||
wheel>=0.37.1
|
||||
|
||||
# jupyter
|
||||
ipython>=8.3.0
|
||||
jupyter>=1.0.0
|
||||
|
||||
# running
|
||||
codetiming>=1.3.0
|
||||
|
||||
# misc
|
||||
importlib>=1.0.4
|
||||
authlib>=1.0.1
|
||||
pathlib>=1.0.1
|
||||
lorem>=0.1.1
|
||||
safetywrap>=1.5.0
|
||||
typing>=3.7.4.3
|
||||
nptyping>=2.1.1
|
||||
typing-extensions==3.10.0.2 # <- need this instead of >= 4.2.0 for compatibility with tgintegration
|
||||
|
||||
# maths
|
||||
numpy>=1.22.4
|
Loading…
x
Reference in New Issue
Block a user