This commit is contained in:
wassname
2023-01-10 13:20:16 +08:00
parent 189923221e
commit a7ea65d19a
5 changed files with 105 additions and 29 deletions
+23
View File
@@ -0,0 +1,23 @@
{
"workbench.colorCustomizations": {
"activityBar.activeBackground": "#68cd21",
"activityBar.activeBorder": "#236fdc",
"activityBar.background": "#68cd21",
"activityBar.foreground": "#15202b",
"activityBar.inactiveForeground": "#15202b99",
"activityBarBadge.background": "#236fdc",
"activityBarBadge.foreground": "#e7e7e7",
"sash.hoverBorder": "#68cd21",
"statusBar.background": "#52a11a",
"statusBar.foreground": "#e7e7e7",
"statusBarItem.hoverBackground": "#68cd21",
"statusBarItem.remoteBackground": "#52a11a",
"statusBarItem.remoteForeground": "#e7e7e7",
"titleBar.activeBackground": "#52a11a",
"titleBar.activeForeground": "#e7e7e7",
"titleBar.inactiveBackground": "#52a11a99",
"titleBar.inactiveForeground": "#e7e7e799",
"commandCenter.border": "#e7e7e799"
},
"peacock.color": "#52a11a"
}
-3
View File
@@ -12,9 +12,6 @@
│   ├── processed <- The final, canonical data sets for modeling. │   ├── processed <- The final, canonical data sets for modeling.
│   └── raw <- The original, immutable data dump. │   └── raw <- The original, immutable data dump.
├── docs <- A default Sphinx project; see sphinx-doc.org for details
├── models <- Trained and serialized models, model predictions, or model summaries
├── notebooks <- Jupyter notebooks. Naming convention is a number (for ordering), ├── notebooks <- Jupyter notebooks. Naming convention is a number (for ordering),
│ the creator's initials, and a short `-` delimited description, e.g. │ the creator's initials, and a short `-` delimited description, e.g.
@@ -22,7 +22,7 @@
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
"# import your package\n", "# autoreload your package\n",
"%load_ext autoreload\n", "%load_ext autoreload\n",
"%autoreload 2\n", "%autoreload 2\n",
"import {{ cookiecutter.project_name.lower().replace(' ', '_') }}" "import {{ cookiecutter.project_name.lower().replace(' ', '_') }}"
@@ -40,10 +40,49 @@
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
"## secrets\n",
"from dotenv import load_dotenv\n", "from dotenv import load_dotenv\n",
"load_dotenv() # take environment variables from .env." "load_dotenv() # take environment variables from .env.\n",
"\n",
"import warnings\n",
"# warnings.simplefilter(\"ignore\")\n",
"warnings.filterwarnings(\"ignore\", \".*does not have many workers.*\")\n",
"warnings.filterwarnings(\"ignore\", \".*divide by zero.*\")\n",
"\n",
"## numeric, plotting\n",
"import numpy as np\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"%matplotlib inline\n",
"plt.style.use('ggplot')\n",
"plt.rcParams['figure.figsize'] = (7.0, 4)\n",
"\n",
"## utils\n",
"from pathlib import Path\n",
"from tqdm.auto import tqdm\n",
"import logging, os, re\n",
"import collections, functools, itertools\n",
"\n",
"# torch\n",
"import pytorch_lightning as pl\n",
"from einops import rearrange, repeat, reduce\n",
"import torch\n",
"import torch.nn as nn\n",
"\n",
"# logging\n",
"from loguru import logger\n",
"logger.remove()\n",
"logger.add(os.sys.stdout, level=\"ERROR\", colorize=True, format=\"<level>{time} | {message}</level>\")"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"id": "54a03c3a",
"metadata": {},
"outputs": [],
"source": []
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
@@ -55,19 +94,15 @@
} }
}, },
"outputs": [], "outputs": [],
"source": [ "source": []
"# I like using ggplot colors\n", },
"\n", {
"import matplotlib.pyplot as plt\n", "cell_type": "code",
"%matplotlib inline\n", "execution_count": null,
"plt.style.use('ggplot')\n", "id": "1d4da6fa",
"\n", "metadata": {},
"import numpy as np\n", "outputs": [],
"import pandas as pd\n", "source": []
"\n",
"from pathlib import Path\n",
"from tqdm.auto import tqdm"
]
}, },
{ {
"cell_type": "code", "cell_type": "code",
@@ -75,15 +110,7 @@
"id": "6d102e3d", "id": "6d102e3d",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": []
"# and using the logger\n",
"import logging\n",
"import os\n",
"\n",
"logging.basicConfig(stream=os.sys.stdout, level=logging.INFO)\n",
"logger = logging.getLogger('nb')\n",
"logger.setLevel(logging.INFO)"
]
} }
], ],
"metadata": { "metadata": {
@@ -0,0 +1,26 @@
#!/bin/bash
set -e -x
# This script will document the requirements for multiple conda environments, see ./readme.md for more
# inputs
PROJECT_NAMES='{{ cookiecutter.python_interpreter }}'
for PROJECT_NAME in $PROJECT_NAMES
do
echo $PROJECT_NAME
PYTHON_INTERPRETER=~/miniforge3/envs/$PROJECT_NAME/bin/python
# minimal requirement, simpler, but no versions or pip
conda env export --no-builds --from-history > requirements/environment.min.yaml
# extensive requirements including pip and information overload
conda env export > requirements/environment.max.yaml
# requirements in a modified pip spec, usefull for dependabot and so on
$PYTHON_INTERPRETER -m pip freeze > requirements/conda.requirements.txt
done
# inputs
for PROJECT_NAME in $PROJECT_NAMES
do
echo $PROJECT_NAME
# conda lock is good for not overspecifying version, but it misses pip
cd requirements && conda-lock -f environment.max.yaml -p linux-64
done
@@ -1,6 +1,9 @@
This project has multiple ways of documenting requirements This project has multiple ways of documenting requirements. Since it doesn't cost anything we include them all.
- environment.yaml - This is the manual requirements, use it to install a new test or dev environment - environment.yaml - This is the manual requirements, use it to install a new test or dev environment
- environment.min.yaml - This is the minimum requirements, use it to install a new test or dev environment - environment.min.yaml - This is the minimum requirements, use it to install a new test or dev environment
- environment.max.yaml - This pins all conda packages, use for production or finding vulnerabilities - environment.max.yaml - This pins all conda packages, use for production or finding vulnerabilities
- requirements.txt - For people or bots not using conda - conda.requirements.txt - For people or bots not using conda
To update the files run
`bash requiresments/doc_reqs.sh`