-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WIP * Remove setuptools, add tqdm * Lint * Don't need setuptools or wheel * Add comment fences * Can't believe E266 is a thing * Whitespace * Add linting to tests * Remove template from project linting and formatting * Reorganize boilerplate modules * Get rid of editable check * Actually run linting * Actually test linting * Update verify_files test * Update verify_folders * Remove duplicate file * Fix lint --------- Co-authored-by: Jay Qi <[email protected]>
- Loading branch information
Showing
21 changed files
with
230 additions
and
54 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
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
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 @@ | ||
import config # noqa: F401 |
32 changes: 32 additions & 0 deletions
32
{{ cookiecutter.repo_name }}/{{ cookiecutter.module_name }}/config.py
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,32 @@ | ||
from pathlib import Path | ||
|
||
from dotenv import load_dotenv | ||
from loguru import logger | ||
|
||
# Load environment variables from .env file if it exists | ||
load_dotenv() | ||
|
||
# Paths | ||
PROJ_ROOT = Path(__file__).resolve().parents[1] | ||
logger.info(f"PROJ_ROOT path is: {PROJ_ROOT}") | ||
|
||
DATA_DIR = PROJ_ROOT / "data" | ||
RAW_DATA_DIR = DATA_DIR / "raw" | ||
INTERIM_DATA_DIR = DATA_DIR / "interim" | ||
PROCESSED_DATA_DIR = DATA_DIR / "processed" | ||
EXTERNAL_DATA_DIR = DATA_DIR / "external" | ||
|
||
MODELS_DIR = PROJ_ROOT / "models" | ||
|
||
REPORTS_DIR = PROJ_ROOT / "reports" | ||
FIGURES_DIR = REPORTS_DIR / "figures" | ||
|
||
# If tqdm is installed, configure loguru with tqdm.write | ||
# https://github.com/Delgan/loguru/issues/135 | ||
try: | ||
from tqdm import tqdm | ||
|
||
logger.remove(0) | ||
logger.add(lambda msg: tqdm.write(msg, end=""), colorize=True) | ||
except ModuleNotFoundError: | ||
pass |
31 changes: 0 additions & 31 deletions
31
{{ cookiecutter.repo_name }}/{{ cookiecutter.module_name }}/data/make_dataset.py
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
{{ cookiecutter.repo_name }}/{{ cookiecutter.module_name }}/dataset.py
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,29 @@ | ||
from pathlib import Path | ||
|
||
import typer | ||
from loguru import logger | ||
from tqdm import tqdm | ||
|
||
from {{ cookiecutter.module_name }}.config import PROCESSED_DATA_DIR, RAW_DATA_DIR | ||
|
||
app = typer.Typer() | ||
|
||
|
||
@app.command() | ||
def main( | ||
# ---- REPLACE DEFAULT PATHS AS APPROPRIATE ---- | ||
input_path: Path = RAW_DATA_DIR / "dataset.csv", | ||
output_path: Path = PROCESSED_DATA_DIR / "dataset.csv", | ||
# ---------------------------------------------- | ||
): | ||
# ---- REPLACE THIS WITH YOUR OWN CODE ---- | ||
logger.info("Processing dataset...") | ||
for i in tqdm(range(10), total=10): | ||
if i == 5: | ||
logger.info("Something happened for iteration 5.") | ||
logger.success("Processing dataset complete.") | ||
# ----------------------------------------- | ||
|
||
|
||
if __name__ == "__main__": | ||
app() |
29 changes: 29 additions & 0 deletions
29
{{ cookiecutter.repo_name }}/{{ cookiecutter.module_name }}/features.py
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,29 @@ | ||
from pathlib import Path | ||
|
||
import typer | ||
from loguru import logger | ||
from tqdm import tqdm | ||
|
||
from {{ cookiecutter.module_name }}.config import PROCESSED_DATA_DIR | ||
|
||
app = typer.Typer() | ||
|
||
|
||
@app.command() | ||
def main( | ||
# ---- REPLACE DEFAULT PATHS AS APPROPRIATE ---- | ||
input_path: Path = PROCESSED_DATA_DIR / "dataset.csv", | ||
output_path: Path = PROCESSED_DATA_DIR / "features.csv", | ||
# ----------------------------------------- | ||
): | ||
# ---- REPLACE THIS WITH YOUR OWN CODE ---- | ||
logger.info("Generating features from dataset...") | ||
for i in tqdm(range(10), total=10): | ||
if i == 5: | ||
logger.info("Something happened for iteration 5.") | ||
logger.success("Features generation complete.") | ||
# ----------------------------------------- | ||
|
||
|
||
if __name__ == "__main__": | ||
app() |
Empty file removed
0
{{ cookiecutter.repo_name }}/{{ cookiecutter.module_name }}/features/__init__.py
Empty file.
Empty file.
File renamed without changes.
30 changes: 30 additions & 0 deletions
30
{{ cookiecutter.repo_name }}/{{ cookiecutter.module_name }}/modeling/predict.py
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,30 @@ | ||
from pathlib import Path | ||
|
||
import typer | ||
from loguru import logger | ||
from tqdm import tqdm | ||
|
||
from {{ cookiecutter.module_name }}.config import MODELS_DIR, PROCESSED_DATA_DIR | ||
|
||
app = typer.Typer() | ||
|
||
|
||
@app.command() | ||
def main( | ||
# ---- REPLACE DEFAULT PATHS AS APPROPRIATE ---- | ||
features_path: Path = PROCESSED_DATA_DIR / "test_features.csv", | ||
model_path: Path = MODELS_DIR / "model.pkl", | ||
predictions_path: Path = PROCESSED_DATA_DIR / "test_predictions.csv", | ||
# ----------------------------------------- | ||
): | ||
# ---- REPLACE THIS WITH YOUR OWN CODE ---- | ||
logger.info("Performing inference for model...") | ||
for i in tqdm(range(10), total=10): | ||
if i == 5: | ||
logger.info("Something happened for iteration 5.") | ||
logger.success("Inference complete.") | ||
# ----------------------------------------- | ||
|
||
|
||
if __name__ == "__main__": | ||
app() |
30 changes: 30 additions & 0 deletions
30
{{ cookiecutter.repo_name }}/{{ cookiecutter.module_name }}/modeling/train.py
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,30 @@ | ||
from pathlib import Path | ||
|
||
import typer | ||
from loguru import logger | ||
from tqdm import tqdm | ||
|
||
from {{ cookiecutter.module_name }}.config import MODELS_DIR, PROCESSED_DATA_DIR | ||
|
||
app = typer.Typer() | ||
|
||
|
||
@app.command() | ||
def main( | ||
# ---- REPLACE DEFAULT PATHS AS APPROPRIATE ---- | ||
features_path: Path = PROCESSED_DATA_DIR / "features.csv", | ||
labels_path: Path = PROCESSED_DATA_DIR / "labels.csv", | ||
model_path: Path = MODELS_DIR / "model.pkl", | ||
# ----------------------------------------- | ||
): | ||
# ---- REPLACE THIS WITH YOUR OWN CODE ---- | ||
logger.info("Training some model...") | ||
for i in tqdm(range(10), total=10): | ||
if i == 5: | ||
logger.info("Something happened for iteration 5.") | ||
logger.success("Modeling training complete.") | ||
# ----------------------------------------- | ||
|
||
|
||
if __name__ == "__main__": | ||
app() |
Empty file.
Empty file removed
0
{{ cookiecutter.repo_name }}/{{ cookiecutter.module_name }}/models/predict_model.py
Empty file.
Empty file removed
0
{{ cookiecutter.repo_name }}/{{ cookiecutter.module_name }}/models/train_model.py
Empty file.
29 changes: 29 additions & 0 deletions
29
{{ cookiecutter.repo_name }}/{{ cookiecutter.module_name }}/plots.py
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,29 @@ | ||
from pathlib import Path | ||
|
||
import typer | ||
from loguru import logger | ||
from tqdm import tqdm | ||
|
||
from {{ cookiecutter.module_name }}.config import FIGURES_DIR, PROCESSED_DATA_DIR | ||
|
||
app = typer.Typer() | ||
|
||
|
||
@app.command() | ||
def main( | ||
# ---- REPLACE DEFAULT PATHS AS APPROPRIATE ---- | ||
input_path: Path = PROCESSED_DATA_DIR / "dataset.csv", | ||
output_path: Path = FIGURES_DIR / "plot.png", | ||
# ----------------------------------------- | ||
): | ||
# ---- REPLACE THIS WITH YOUR OWN CODE ---- | ||
logger.info("Generating plot from data...") | ||
for i in tqdm(range(10), total=10): | ||
if i == 5: | ||
logger.info("Something happened for iteration 5.") | ||
logger.success("Plot generation complete.") | ||
# ----------------------------------------- | ||
|
||
|
||
if __name__ == "__main__": | ||
app() |
Empty file.
Empty file.