dscforge 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dscforge-0.1.0/PKG-INFO +7 -0
- dscforge-0.1.0/README.md +153 -0
- dscforge-0.1.0/dscforge/__init__.py +0 -0
- dscforge-0.1.0/dscforge/cli.py +30 -0
- dscforge-0.1.0/dscforge/generator.py +129 -0
- dscforge-0.1.0/dscforge/templates/basic/main.py +9 -0
- dscforge-0.1.0/dscforge/templates/premium/src/__init__.py +0 -0
- dscforge-0.1.0/dscforge/templates/premium/src/config.py +33 -0
- dscforge-0.1.0/dscforge/templates/premium/src/main.py +14 -0
- dscforge-0.1.0/dscforge/templates/premium/src/utils.py +11 -0
- dscforge-0.1.0/dscforge/templates/premium/tests/test.py +15 -0
- dscforge-0.1.0/dscforge/templates/standard/src/main.py +11 -0
- dscforge-0.1.0/dscforge/utils.py +0 -0
- dscforge-0.1.0/dscforge.egg-info/PKG-INFO +7 -0
- dscforge-0.1.0/dscforge.egg-info/SOURCES.txt +19 -0
- dscforge-0.1.0/dscforge.egg-info/dependency_links.txt +1 -0
- dscforge-0.1.0/dscforge.egg-info/entry_points.txt +2 -0
- dscforge-0.1.0/dscforge.egg-info/requires.txt +1 -0
- dscforge-0.1.0/dscforge.egg-info/top_level.txt +1 -0
- dscforge-0.1.0/pyproject.toml +12 -0
- dscforge-0.1.0/setup.cfg +4 -0
dscforge-0.1.0/PKG-INFO
ADDED
dscforge-0.1.0/README.md
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# Welcome to dscforge!
|
|
2
|
+
|
|
3
|
+
A CLI tool to quickly generate data science project templates.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install dscforge
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Step 1:
|
|
14
|
+
|
|
15
|
+
Navigate to the directory where you want your project created.
|
|
16
|
+
|
|
17
|
+
### Step 2:
|
|
18
|
+
|
|
19
|
+
Run the command below:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
dscforge <project_name>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Flags
|
|
26
|
+
|
|
27
|
+
- `--template <template_type>` : generates using the specified template
|
|
28
|
+
- `--git` : initializes git when generating the template
|
|
29
|
+
|
|
30
|
+
## Example Usages
|
|
31
|
+
|
|
32
|
+
- `dscforge my_project` : Creates a default basic project template called "my_project".
|
|
33
|
+
- `dscforge my_project --template basic` : Creates a basic project template called "my_project".
|
|
34
|
+
- `dscforge my_project --template standard` : Creates a standard project template called "my_project".
|
|
35
|
+
- `dscforge my_project --template premium` : Creates a premium project template called "my_project".
|
|
36
|
+
- `dscforge my_project --git` : Creates a default basic project template called "my_project" with git initialization.
|
|
37
|
+
- `dscforge my_project --template basic --git` : Creates a basic project template called "my_project" with git initialization.
|
|
38
|
+
- `dscforge my_project --template standard --git` : Creates a standard project template called "my_project" with git initialization.
|
|
39
|
+
- `dscforge my_project --template premium --git` : Creates a premium project template called "my_project" with git initialization.
|
|
40
|
+
|
|
41
|
+
# Project Templates
|
|
42
|
+
|
|
43
|
+
## Basic Template
|
|
44
|
+
|
|
45
|
+
A minimal setup for quick experiments, scripts, or small assignments.
|
|
46
|
+
|
|
47
|
+
```text id="basic_md"
|
|
48
|
+
my_project/
|
|
49
|
+
├── main.py
|
|
50
|
+
├── main.ipynb
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### What it’s for
|
|
54
|
+
|
|
55
|
+
* Quick prototyping
|
|
56
|
+
* Small coursework / assignments
|
|
57
|
+
* Scratch work / experiments
|
|
58
|
+
* No setup overhead
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Standard Template
|
|
63
|
+
|
|
64
|
+
A structured setup for data science coursework and small projects.
|
|
65
|
+
|
|
66
|
+
```text id="standard_md"
|
|
67
|
+
my_project/
|
|
68
|
+
├── data/
|
|
69
|
+
│ ├── raw/
|
|
70
|
+
│ └── processed/
|
|
71
|
+
│
|
|
72
|
+
├── figures/
|
|
73
|
+
│
|
|
74
|
+
├── notebooks/
|
|
75
|
+
│ └── main.ipynb
|
|
76
|
+
│
|
|
77
|
+
├── src/
|
|
78
|
+
│ └── main.py
|
|
79
|
+
│
|
|
80
|
+
├── .gitignore
|
|
81
|
+
├── pyproject.toml
|
|
82
|
+
├── README.md
|
|
83
|
+
└── requirements.txt
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### What it’s for
|
|
87
|
+
|
|
88
|
+
* Data analysis projects
|
|
89
|
+
* Coursework / assignments with datasets
|
|
90
|
+
* Small research projects
|
|
91
|
+
* Clean separation of code and data
|
|
92
|
+
|
|
93
|
+
### Each standard template includes its own isolated virtual environment (`.venv`)
|
|
94
|
+
- Dependencies: numpy, pandas, matplotlib, ipykernel
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Premium Template
|
|
99
|
+
|
|
100
|
+
A production-style data science project structure with scalability in mind.
|
|
101
|
+
|
|
102
|
+
```text id="premium_md"
|
|
103
|
+
my_project/
|
|
104
|
+
├── data/
|
|
105
|
+
│ ├── raw/
|
|
106
|
+
│ └── processed/
|
|
107
|
+
│
|
|
108
|
+
├── figures/
|
|
109
|
+
│
|
|
110
|
+
├── logs/
|
|
111
|
+
│ └── app.log
|
|
112
|
+
│
|
|
113
|
+
├── models/
|
|
114
|
+
│
|
|
115
|
+
├── notebooks/
|
|
116
|
+
│ └── main.ipynb
|
|
117
|
+
│
|
|
118
|
+
├── src/
|
|
119
|
+
│ ├── __init__.py
|
|
120
|
+
│ ├── config.py
|
|
121
|
+
│ ├── main.py
|
|
122
|
+
│ └── utils.py
|
|
123
|
+
│
|
|
124
|
+
├── tests/
|
|
125
|
+
│ └── test.py
|
|
126
|
+
│
|
|
127
|
+
├── web/
|
|
128
|
+
│ ├── pages/
|
|
129
|
+
│ │ └── index.html
|
|
130
|
+
│ ├── styles/
|
|
131
|
+
│ │ └── style.css
|
|
132
|
+
│ └── scripts/
|
|
133
|
+
│ └── main.js
|
|
134
|
+
│
|
|
135
|
+
├── .gitignore
|
|
136
|
+
├── pyproject.toml
|
|
137
|
+
├── README.md
|
|
138
|
+
└── requirements.txt
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### What it’s for
|
|
142
|
+
|
|
143
|
+
* End-to-end data science projects
|
|
144
|
+
* Research pipelines
|
|
145
|
+
* ML experimentation
|
|
146
|
+
* Dashboards or web-integrated projects
|
|
147
|
+
* Scalable production-like structure
|
|
148
|
+
|
|
149
|
+
### Each premium template includes its own isolated virtual environment (`.venv`)
|
|
150
|
+
- Dependencies: numpy, pandas, matplotlib, ipykernel
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
File without changes
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Imports
|
|
2
|
+
import click
|
|
3
|
+
from .generator import create_project
|
|
4
|
+
|
|
5
|
+
@click.command()
|
|
6
|
+
@click.argument("name")
|
|
7
|
+
|
|
8
|
+
# Click option for --template
|
|
9
|
+
@click.option(
|
|
10
|
+
"--template",
|
|
11
|
+
type=click.Choice(["basic", "standard", "premium"]),
|
|
12
|
+
default="basic",
|
|
13
|
+
show_default=True,
|
|
14
|
+
help="Select a project template"
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
# Click option for --git
|
|
18
|
+
@click.option(
|
|
19
|
+
"--git",
|
|
20
|
+
is_flag=True,
|
|
21
|
+
default=False,
|
|
22
|
+
help="Initialize a git repository in the project"
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
# Creating the template
|
|
26
|
+
def main(name, template, git):
|
|
27
|
+
create_project(name, template, git)
|
|
28
|
+
|
|
29
|
+
if __name__ == "__main__":
|
|
30
|
+
main()
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Imports
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
import shutil
|
|
4
|
+
import subprocess
|
|
5
|
+
import sys
|
|
6
|
+
|
|
7
|
+
# Base Dependencies
|
|
8
|
+
# The packages that will be installed if a venv comes with the template
|
|
9
|
+
BASE_DEPS = ["numpy", "pandas", "matplotlib", "ipykernel"]
|
|
10
|
+
|
|
11
|
+
# Function to create a project template
|
|
12
|
+
def create_project(name: str, template: str, git: bool):
|
|
13
|
+
"""
|
|
14
|
+
Function to create a project template.
|
|
15
|
+
Inputs:
|
|
16
|
+
- name (str): the project/root directory name
|
|
17
|
+
- template (str): the type of template that will be made
|
|
18
|
+
- git (bool): whether to initialize git or not
|
|
19
|
+
"""
|
|
20
|
+
base = Path(name)
|
|
21
|
+
|
|
22
|
+
# Failsafe if a project name already exists in the current directory
|
|
23
|
+
if base.exists():
|
|
24
|
+
raise FileExistsError(f"{name} already exists in the current \
|
|
25
|
+
directory. \nPlease select another project name.")
|
|
26
|
+
|
|
27
|
+
# Creates the empty project folder in the current directory
|
|
28
|
+
base.mkdir()
|
|
29
|
+
|
|
30
|
+
# Copies the desired template (if avaliable)
|
|
31
|
+
template_dir = Path(__file__).parent / "templates" / template
|
|
32
|
+
|
|
33
|
+
if not template_dir.exists():
|
|
34
|
+
raise ValueError(f"Template '{template}' is not avaliable in \
|
|
35
|
+
the templates directory.")
|
|
36
|
+
|
|
37
|
+
# Applies the desired template onto the empty project folder
|
|
38
|
+
shutil.copytree(template_dir, base, dirs_exist_ok=True)
|
|
39
|
+
|
|
40
|
+
# Initializes git (if applicable)
|
|
41
|
+
if git:
|
|
42
|
+
try:
|
|
43
|
+
subprocess.run(
|
|
44
|
+
["git", "init"],
|
|
45
|
+
cwd=base,
|
|
46
|
+
check=True,
|
|
47
|
+
stdout=subprocess.DEVNULL,
|
|
48
|
+
stderr=subprocess.DEVNULL
|
|
49
|
+
)
|
|
50
|
+
print("Successfully initialized a git repository.")
|
|
51
|
+
except FileNotFoundError:
|
|
52
|
+
print("Warning: git is not installed. \
|
|
53
|
+
\nSkipping git initialization.")
|
|
54
|
+
|
|
55
|
+
# Creates a virtual environment (if applicable)
|
|
56
|
+
venv_python = None
|
|
57
|
+
|
|
58
|
+
if template in ["standard", "premium"]:
|
|
59
|
+
try:
|
|
60
|
+
subprocess.run(
|
|
61
|
+
[sys.executable, "-m", "venv", ".venv"],
|
|
62
|
+
cwd=base,
|
|
63
|
+
check=True
|
|
64
|
+
)
|
|
65
|
+
print("Successfully created a virtual environment (.venv)")
|
|
66
|
+
|
|
67
|
+
# detect venv python path (cross-platform)
|
|
68
|
+
if sys.platform == "win32":
|
|
69
|
+
venv_bin = "Scripts/python.exe"
|
|
70
|
+
else:
|
|
71
|
+
venv_bin = "bin/python"
|
|
72
|
+
venv_python = base / ".venv" / venv_bin
|
|
73
|
+
|
|
74
|
+
except subprocess.CalledProcessError:
|
|
75
|
+
print("Warning: failed to create virtual environment. \
|
|
76
|
+
\nSkipping virtual environment setup.")
|
|
77
|
+
|
|
78
|
+
# Setting up dependencies (if applicable)
|
|
79
|
+
if template in ["standard", "premium"]:
|
|
80
|
+
|
|
81
|
+
deps = BASE_DEPS.copy()
|
|
82
|
+
|
|
83
|
+
# install into venv if available,
|
|
84
|
+
# otherwise fallback to system python
|
|
85
|
+
if venv_python and venv_python.exists():
|
|
86
|
+
python_exec = venv_python
|
|
87
|
+
else:
|
|
88
|
+
python_exec = sys.executable
|
|
89
|
+
|
|
90
|
+
try:
|
|
91
|
+
subprocess.run(
|
|
92
|
+
[str(python_exec), "-m", "pip", "install", *deps],
|
|
93
|
+
check=True
|
|
94
|
+
)
|
|
95
|
+
print("Successfully installed starter libraries: \
|
|
96
|
+
\n(numpy, pandas, matplotlib, ipykernel)")
|
|
97
|
+
except subprocess.CalledProcessError:
|
|
98
|
+
print("Warning: failed to install starter libraries.")
|
|
99
|
+
|
|
100
|
+
# Creating requirements.txt
|
|
101
|
+
result = subprocess.run(
|
|
102
|
+
[str(python_exec), "-m", "pip", "freeze"],
|
|
103
|
+
capture_output=True,
|
|
104
|
+
text=True,
|
|
105
|
+
check=True
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
req_file = base / "requirements.txt"
|
|
109
|
+
req_file.write_text(result.stdout)
|
|
110
|
+
|
|
111
|
+
print("Successfully generated requirements.txt")
|
|
112
|
+
|
|
113
|
+
# Creating pyproject.toml
|
|
114
|
+
toml_file = base / "pyproject.toml"
|
|
115
|
+
|
|
116
|
+
toml_content = f"""[project]
|
|
117
|
+
name = "{name}"
|
|
118
|
+
version = "0.1.0"
|
|
119
|
+
|
|
120
|
+
dependencies = [
|
|
121
|
+
{chr(10).join(f' "{d}",' for d in deps)}
|
|
122
|
+
]
|
|
123
|
+
"""
|
|
124
|
+
|
|
125
|
+
toml_file.write_text(toml_content)
|
|
126
|
+
print("Successfully generated pyproject.toml")
|
|
127
|
+
|
|
128
|
+
print(f"Successfully created project: \
|
|
129
|
+
{name} ({template.upper()} EDITION)")
|
|
File without changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Imports
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
# Configurations
|
|
5
|
+
|
|
6
|
+
# ROOT
|
|
7
|
+
PROJECT_ROOT = Path(__file__).resolve().parent.parent
|
|
8
|
+
|
|
9
|
+
# DATA
|
|
10
|
+
DATA_DIR = PROJECT_ROOT / "data"
|
|
11
|
+
RAW_DATA_DIR = DATA_DIR / "raw"
|
|
12
|
+
PROCESSED_DATA_DIR = DATA_DIR / "processed"
|
|
13
|
+
|
|
14
|
+
# FIGURES
|
|
15
|
+
FIGURES_DIR = PROJECT_ROOT / "figures"
|
|
16
|
+
|
|
17
|
+
# LOGS
|
|
18
|
+
LOGS_DIR = PROJECT_ROOT / "logs"
|
|
19
|
+
|
|
20
|
+
# MODELS
|
|
21
|
+
MODELS_DIR = PROJECT_ROOT / "models"
|
|
22
|
+
|
|
23
|
+
# NOTEBOOKS
|
|
24
|
+
NOTEBOOKS_DIR = PROJECT_ROOT / "notebooks"
|
|
25
|
+
|
|
26
|
+
# SRC
|
|
27
|
+
SRC_DIR = PROJECT_ROOT / "src"
|
|
28
|
+
|
|
29
|
+
# WEB
|
|
30
|
+
WEB_DIR = PROJECT_ROOT / "web"
|
|
31
|
+
|
|
32
|
+
# GENERAL SETTINGS
|
|
33
|
+
RANDOM_SEED = 42
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Imports
|
|
2
|
+
import numpy as np
|
|
3
|
+
import pandas as pd
|
|
4
|
+
from matplotlib import pyplot as plt
|
|
5
|
+
|
|
6
|
+
from src import config
|
|
7
|
+
from src import utils
|
|
8
|
+
|
|
9
|
+
# Tests
|
|
10
|
+
def test():
|
|
11
|
+
assert 1 + 1 == 2
|
|
12
|
+
|
|
13
|
+
if __name__ == "__main__":
|
|
14
|
+
test()
|
|
15
|
+
print("All tests passed!")
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
dscforge/__init__.py
|
|
4
|
+
dscforge/cli.py
|
|
5
|
+
dscforge/generator.py
|
|
6
|
+
dscforge/utils.py
|
|
7
|
+
dscforge.egg-info/PKG-INFO
|
|
8
|
+
dscforge.egg-info/SOURCES.txt
|
|
9
|
+
dscforge.egg-info/dependency_links.txt
|
|
10
|
+
dscforge.egg-info/entry_points.txt
|
|
11
|
+
dscforge.egg-info/requires.txt
|
|
12
|
+
dscforge.egg-info/top_level.txt
|
|
13
|
+
dscforge/templates/basic/main.py
|
|
14
|
+
dscforge/templates/premium/src/__init__.py
|
|
15
|
+
dscforge/templates/premium/src/config.py
|
|
16
|
+
dscforge/templates/premium/src/main.py
|
|
17
|
+
dscforge/templates/premium/src/utils.py
|
|
18
|
+
dscforge/templates/premium/tests/test.py
|
|
19
|
+
dscforge/templates/standard/src/main.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
click
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dscforge
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "dscforge"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "CLI tool for generating data science project templates"
|
|
5
|
+
authors = [{ name = "Jacob Doan" }]
|
|
6
|
+
requires-python = ">=3.8"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"click"
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
[project.scripts]
|
|
12
|
+
dscforge = "dscforge.cli:main"
|
dscforge-0.1.0/setup.cfg
ADDED