mirror of
https://github.com/wassname/cookiecutter-data-science.git
synced 2026-06-27 15:15:12 +08:00
misc
This commit is contained in:
Vendored
+23
@@ -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"
|
||||
}
|
||||
@@ -12,9 +12,6 @@
|
||||
│ ├── processed <- The final, canonical data sets for modeling.
|
||||
│ └── 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),
|
||||
│ the creator's initials, and a short `-` delimited description, e.g.
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# import your package\n",
|
||||
"# autoreload your package\n",
|
||||
"%load_ext autoreload\n",
|
||||
"%autoreload 2\n",
|
||||
"import {{ cookiecutter.project_name.lower().replace(' ', '_') }}"
|
||||
@@ -40,10 +40,49 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"## secrets\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",
|
||||
"execution_count": null,
|
||||
@@ -55,19 +94,15 @@
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# I like using ggplot colors\n",
|
||||
"\n",
|
||||
"import matplotlib.pyplot as plt\n",
|
||||
"%matplotlib inline\n",
|
||||
"plt.style.use('ggplot')\n",
|
||||
"\n",
|
||||
"import numpy as np\n",
|
||||
"import pandas as pd\n",
|
||||
"\n",
|
||||
"from pathlib import Path\n",
|
||||
"from tqdm.auto import tqdm"
|
||||
]
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "1d4da6fa",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
@@ -75,15 +110,7 @@
|
||||
"id": "6d102e3d",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"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)"
|
||||
]
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"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.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
|
||||
- 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`
|
||||
|
||||
Reference in New Issue
Block a user