autodir 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.
- autodir-0.1.0/PKG-INFO +273 -0
- autodir-0.1.0/README.md +264 -0
- autodir-0.1.0/pyproject.toml +22 -0
- autodir-0.1.0/setup.cfg +4 -0
- autodir-0.1.0/src/autodir.egg-info/PKG-INFO +273 -0
- autodir-0.1.0/src/autodir.egg-info/SOURCES.txt +20 -0
- autodir-0.1.0/src/autodir.egg-info/dependency_links.txt +1 -0
- autodir-0.1.0/src/autodir.egg-info/entry_points.txt +2 -0
- autodir-0.1.0/src/autodir.egg-info/requires.txt +1 -0
- autodir-0.1.0/src/autodir.egg-info/top_level.txt +1 -0
- autodir-0.1.0/src/scaffolder/__init__.py +0 -0
- autodir-0.1.0/src/scaffolder/cli.py +62 -0
- autodir-0.1.0/src/scaffolder/extractor.py +64 -0
- autodir-0.1.0/src/scaffolder/generator.py +20 -0
- autodir-0.1.0/src/scaffolder/model.py +46 -0
- autodir-0.1.0/src/scaffolder/parser.py +57 -0
- autodir-0.1.0/src/scaffolder/templates.py +50 -0
- autodir-0.1.0/tests/test_cli.py +113 -0
- autodir-0.1.0/tests/test_extractor.py +0 -0
- autodir-0.1.0/tests/test_generator.py +23 -0
- autodir-0.1.0/tests/test_parser.py +133 -0
- autodir-0.1.0/tests/test_templates.py +8 -0
autodir-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: autodir
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A CLI tool for generating project structures from Markdown
|
|
5
|
+
Author: Hrishikesh
|
|
6
|
+
Requires-Python: >=3.11
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: typer<1.0,>=0.27.1
|
|
9
|
+
|
|
10
|
+
# autodir
|
|
11
|
+
|
|
12
|
+
autodir is a useful Python CLI tool that generates project
|
|
13
|
+
directory structures from a Markdown description.
|
|
14
|
+
|
|
15
|
+
Instead of manually creating directories and empty files, you can
|
|
16
|
+
describe the desired structure in a simple Markdown-style tree and let
|
|
17
|
+
autodir create it automatically.
|
|
18
|
+
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
- Generate directories and files from a Markdown tree
|
|
22
|
+
- Create starter templates for supported file types
|
|
23
|
+
- Support custom templates
|
|
24
|
+
- Preview changes with `--dry-run`
|
|
25
|
+
- Safely generate into existing directories with `--force`
|
|
26
|
+
- Simple command-line interface built with Typer
|
|
27
|
+
- Designed to be easy to extend with additional templates and project
|
|
28
|
+
structures
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
Install autodir from PyPI:
|
|
33
|
+
|
|
34
|
+
``` bash
|
|
35
|
+
pip install autodir
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Verify the installation:
|
|
39
|
+
|
|
40
|
+
``` bash
|
|
41
|
+
autodir --help
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Usage
|
|
45
|
+
|
|
46
|
+
The basic command is:
|
|
47
|
+
|
|
48
|
+
``` bash
|
|
49
|
+
autodir <markdown_file> <target>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
For example:
|
|
53
|
+
|
|
54
|
+
``` bash
|
|
55
|
+
autodir README.md ./output
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
autodir reads the structure from `README.md` and creates it inside
|
|
59
|
+
`./output`.
|
|
60
|
+
|
|
61
|
+
## Defining a Project Structure
|
|
62
|
+
|
|
63
|
+
Create a Markdown file describing the desired project structure:
|
|
64
|
+
|
|
65
|
+
``` text
|
|
66
|
+
project/
|
|
67
|
+
src/
|
|
68
|
+
main.py
|
|
69
|
+
utils.cpp
|
|
70
|
+
tests/
|
|
71
|
+
test_main.py
|
|
72
|
+
pyproject.toml
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Then run:
|
|
76
|
+
|
|
77
|
+
``` bash
|
|
78
|
+
autodir README.md ./output
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The resulting directory will look like:
|
|
82
|
+
|
|
83
|
+
``` text
|
|
84
|
+
output/
|
|
85
|
+
└── project/
|
|
86
|
+
├── src/
|
|
87
|
+
│ ├── main.py
|
|
88
|
+
│ └── utils.cpp
|
|
89
|
+
├── tests/
|
|
90
|
+
│ └── test_main.py
|
|
91
|
+
└── pyproject.toml
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## File Templates
|
|
95
|
+
|
|
96
|
+
autodir can create starter content for supported file types.
|
|
97
|
+
|
|
98
|
+
For example, a Python file is initialized with:
|
|
99
|
+
|
|
100
|
+
``` python
|
|
101
|
+
def main():
|
|
102
|
+
pass
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
if __name__ == "__main__":
|
|
106
|
+
main()
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
A C++ file is initialized with a minimal program:
|
|
110
|
+
|
|
111
|
+
``` cpp
|
|
112
|
+
#include <iostream>
|
|
113
|
+
using namespace std;
|
|
114
|
+
|
|
115
|
+
int main() {
|
|
116
|
+
return 0;
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Currently supported built-in templates include:
|
|
121
|
+
|
|
122
|
+
- `.py`
|
|
123
|
+
- `.cpp`
|
|
124
|
+
- `.hpp`
|
|
125
|
+
|
|
126
|
+
Files without a matching template are created as empty files.
|
|
127
|
+
|
|
128
|
+
## Dry Run
|
|
129
|
+
|
|
130
|
+
Use `--dry-run` to preview what autodir would create without
|
|
131
|
+
modifying the target directory:
|
|
132
|
+
|
|
133
|
+
``` bash
|
|
134
|
+
autodir README.md ./output --dry-run
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
This is useful for checking a structure before actually generating it.
|
|
138
|
+
|
|
139
|
+
## Existing Directories
|
|
140
|
+
|
|
141
|
+
By default, autodir avoids generating into a non-empty target
|
|
142
|
+
directory.
|
|
143
|
+
|
|
144
|
+
If you intentionally want to generate into an existing non-empty
|
|
145
|
+
directory, use:
|
|
146
|
+
|
|
147
|
+
``` bash
|
|
148
|
+
autodir README.md ./output --force
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
`--force` allows generation to proceed without deleting unrelated files
|
|
152
|
+
already present in the target directory.
|
|
153
|
+
|
|
154
|
+
## Custom Templates
|
|
155
|
+
|
|
156
|
+
autodir also supports supplying a custom template directory.
|
|
157
|
+
|
|
158
|
+
A template directory can contain files whose extensions correspond to
|
|
159
|
+
the file types you want to customize.
|
|
160
|
+
|
|
161
|
+
For example:
|
|
162
|
+
|
|
163
|
+
``` text
|
|
164
|
+
templates/
|
|
165
|
+
├── .py
|
|
166
|
+
├── .cpp
|
|
167
|
+
└── .hpp
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
When a matching template is available, autodir uses its contents
|
|
171
|
+
instead of the built-in template.
|
|
172
|
+
|
|
173
|
+
## Project Architecture
|
|
174
|
+
|
|
175
|
+
The project is organized into several components:
|
|
176
|
+
|
|
177
|
+
``` text
|
|
178
|
+
src/autodir/
|
|
179
|
+
├── cli.py
|
|
180
|
+
├── extractor.py
|
|
181
|
+
├── generator.py
|
|
182
|
+
├── model.py
|
|
183
|
+
├── parser.py
|
|
184
|
+
└── templates.py
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Parser
|
|
188
|
+
|
|
189
|
+
Converts the textual directory structure into a tree representation.
|
|
190
|
+
|
|
191
|
+
### Model
|
|
192
|
+
|
|
193
|
+
Defines the tree nodes used to represent files and directories.
|
|
194
|
+
|
|
195
|
+
### Extractor
|
|
196
|
+
|
|
197
|
+
Extracts the relevant directory structure from the Markdown input.
|
|
198
|
+
|
|
199
|
+
### Generator
|
|
200
|
+
|
|
201
|
+
Traverses the parsed tree and creates the corresponding directories and
|
|
202
|
+
files.
|
|
203
|
+
|
|
204
|
+
### Templates
|
|
205
|
+
|
|
206
|
+
Provides built-in and custom file templates.
|
|
207
|
+
|
|
208
|
+
### CLI
|
|
209
|
+
|
|
210
|
+
Provides the user-facing command-line interface.
|
|
211
|
+
|
|
212
|
+
## Development
|
|
213
|
+
|
|
214
|
+
Clone the repository and create a virtual environment:
|
|
215
|
+
|
|
216
|
+
``` bash
|
|
217
|
+
git clone https://github.com/Hrishi11572/autodir.git
|
|
218
|
+
cd autodir
|
|
219
|
+
|
|
220
|
+
python3 -m venv .venv
|
|
221
|
+
source .venv/bin/activate
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
Install the development dependencies and package:
|
|
225
|
+
|
|
226
|
+
``` bash
|
|
227
|
+
pip install -e .
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Run the test suite:
|
|
231
|
+
|
|
232
|
+
``` bash
|
|
233
|
+
python -m pytest
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Run tests with coverage:
|
|
237
|
+
|
|
238
|
+
``` bash
|
|
239
|
+
python -m pytest --cov=autodir --cov-report=term-missing
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## Building the Package
|
|
243
|
+
|
|
244
|
+
Install the build tools:
|
|
245
|
+
|
|
246
|
+
``` bash
|
|
247
|
+
python -m pip install build
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Build the source distribution and wheel:
|
|
251
|
+
|
|
252
|
+
``` bash
|
|
253
|
+
python -m build
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
The generated packages will be placed in:
|
|
257
|
+
|
|
258
|
+
``` text
|
|
259
|
+
dist/
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
## Why autodir?
|
|
263
|
+
|
|
264
|
+
Project setup often involves repetitive work: creating directories,
|
|
265
|
+
adding placeholder files, and writing standard boilerplate. autodir
|
|
266
|
+
separates the description of a project from the process of creating it.
|
|
267
|
+
|
|
268
|
+
You describe the structure once, and autodir turns that description
|
|
269
|
+
into a real filesystem structure.
|
|
270
|
+
|
|
271
|
+
## License
|
|
272
|
+
|
|
273
|
+
MIT License
|
autodir-0.1.0/README.md
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
# autodir
|
|
2
|
+
|
|
3
|
+
autodir is a useful Python CLI tool that generates project
|
|
4
|
+
directory structures from a Markdown description.
|
|
5
|
+
|
|
6
|
+
Instead of manually creating directories and empty files, you can
|
|
7
|
+
describe the desired structure in a simple Markdown-style tree and let
|
|
8
|
+
autodir create it automatically.
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- Generate directories and files from a Markdown tree
|
|
13
|
+
- Create starter templates for supported file types
|
|
14
|
+
- Support custom templates
|
|
15
|
+
- Preview changes with `--dry-run`
|
|
16
|
+
- Safely generate into existing directories with `--force`
|
|
17
|
+
- Simple command-line interface built with Typer
|
|
18
|
+
- Designed to be easy to extend with additional templates and project
|
|
19
|
+
structures
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
Install autodir from PyPI:
|
|
24
|
+
|
|
25
|
+
``` bash
|
|
26
|
+
pip install autodir
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Verify the installation:
|
|
30
|
+
|
|
31
|
+
``` bash
|
|
32
|
+
autodir --help
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
The basic command is:
|
|
38
|
+
|
|
39
|
+
``` bash
|
|
40
|
+
autodir <markdown_file> <target>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
For example:
|
|
44
|
+
|
|
45
|
+
``` bash
|
|
46
|
+
autodir README.md ./output
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
autodir reads the structure from `README.md` and creates it inside
|
|
50
|
+
`./output`.
|
|
51
|
+
|
|
52
|
+
## Defining a Project Structure
|
|
53
|
+
|
|
54
|
+
Create a Markdown file describing the desired project structure:
|
|
55
|
+
|
|
56
|
+
``` text
|
|
57
|
+
project/
|
|
58
|
+
src/
|
|
59
|
+
main.py
|
|
60
|
+
utils.cpp
|
|
61
|
+
tests/
|
|
62
|
+
test_main.py
|
|
63
|
+
pyproject.toml
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Then run:
|
|
67
|
+
|
|
68
|
+
``` bash
|
|
69
|
+
autodir README.md ./output
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The resulting directory will look like:
|
|
73
|
+
|
|
74
|
+
``` text
|
|
75
|
+
output/
|
|
76
|
+
└── project/
|
|
77
|
+
├── src/
|
|
78
|
+
│ ├── main.py
|
|
79
|
+
│ └── utils.cpp
|
|
80
|
+
├── tests/
|
|
81
|
+
│ └── test_main.py
|
|
82
|
+
└── pyproject.toml
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## File Templates
|
|
86
|
+
|
|
87
|
+
autodir can create starter content for supported file types.
|
|
88
|
+
|
|
89
|
+
For example, a Python file is initialized with:
|
|
90
|
+
|
|
91
|
+
``` python
|
|
92
|
+
def main():
|
|
93
|
+
pass
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
if __name__ == "__main__":
|
|
97
|
+
main()
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
A C++ file is initialized with a minimal program:
|
|
101
|
+
|
|
102
|
+
``` cpp
|
|
103
|
+
#include <iostream>
|
|
104
|
+
using namespace std;
|
|
105
|
+
|
|
106
|
+
int main() {
|
|
107
|
+
return 0;
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Currently supported built-in templates include:
|
|
112
|
+
|
|
113
|
+
- `.py`
|
|
114
|
+
- `.cpp`
|
|
115
|
+
- `.hpp`
|
|
116
|
+
|
|
117
|
+
Files without a matching template are created as empty files.
|
|
118
|
+
|
|
119
|
+
## Dry Run
|
|
120
|
+
|
|
121
|
+
Use `--dry-run` to preview what autodir would create without
|
|
122
|
+
modifying the target directory:
|
|
123
|
+
|
|
124
|
+
``` bash
|
|
125
|
+
autodir README.md ./output --dry-run
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
This is useful for checking a structure before actually generating it.
|
|
129
|
+
|
|
130
|
+
## Existing Directories
|
|
131
|
+
|
|
132
|
+
By default, autodir avoids generating into a non-empty target
|
|
133
|
+
directory.
|
|
134
|
+
|
|
135
|
+
If you intentionally want to generate into an existing non-empty
|
|
136
|
+
directory, use:
|
|
137
|
+
|
|
138
|
+
``` bash
|
|
139
|
+
autodir README.md ./output --force
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
`--force` allows generation to proceed without deleting unrelated files
|
|
143
|
+
already present in the target directory.
|
|
144
|
+
|
|
145
|
+
## Custom Templates
|
|
146
|
+
|
|
147
|
+
autodir also supports supplying a custom template directory.
|
|
148
|
+
|
|
149
|
+
A template directory can contain files whose extensions correspond to
|
|
150
|
+
the file types you want to customize.
|
|
151
|
+
|
|
152
|
+
For example:
|
|
153
|
+
|
|
154
|
+
``` text
|
|
155
|
+
templates/
|
|
156
|
+
├── .py
|
|
157
|
+
├── .cpp
|
|
158
|
+
└── .hpp
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
When a matching template is available, autodir uses its contents
|
|
162
|
+
instead of the built-in template.
|
|
163
|
+
|
|
164
|
+
## Project Architecture
|
|
165
|
+
|
|
166
|
+
The project is organized into several components:
|
|
167
|
+
|
|
168
|
+
``` text
|
|
169
|
+
src/autodir/
|
|
170
|
+
├── cli.py
|
|
171
|
+
├── extractor.py
|
|
172
|
+
├── generator.py
|
|
173
|
+
├── model.py
|
|
174
|
+
├── parser.py
|
|
175
|
+
└── templates.py
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Parser
|
|
179
|
+
|
|
180
|
+
Converts the textual directory structure into a tree representation.
|
|
181
|
+
|
|
182
|
+
### Model
|
|
183
|
+
|
|
184
|
+
Defines the tree nodes used to represent files and directories.
|
|
185
|
+
|
|
186
|
+
### Extractor
|
|
187
|
+
|
|
188
|
+
Extracts the relevant directory structure from the Markdown input.
|
|
189
|
+
|
|
190
|
+
### Generator
|
|
191
|
+
|
|
192
|
+
Traverses the parsed tree and creates the corresponding directories and
|
|
193
|
+
files.
|
|
194
|
+
|
|
195
|
+
### Templates
|
|
196
|
+
|
|
197
|
+
Provides built-in and custom file templates.
|
|
198
|
+
|
|
199
|
+
### CLI
|
|
200
|
+
|
|
201
|
+
Provides the user-facing command-line interface.
|
|
202
|
+
|
|
203
|
+
## Development
|
|
204
|
+
|
|
205
|
+
Clone the repository and create a virtual environment:
|
|
206
|
+
|
|
207
|
+
``` bash
|
|
208
|
+
git clone https://github.com/Hrishi11572/autodir.git
|
|
209
|
+
cd autodir
|
|
210
|
+
|
|
211
|
+
python3 -m venv .venv
|
|
212
|
+
source .venv/bin/activate
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Install the development dependencies and package:
|
|
216
|
+
|
|
217
|
+
``` bash
|
|
218
|
+
pip install -e .
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Run the test suite:
|
|
222
|
+
|
|
223
|
+
``` bash
|
|
224
|
+
python -m pytest
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Run tests with coverage:
|
|
228
|
+
|
|
229
|
+
``` bash
|
|
230
|
+
python -m pytest --cov=autodir --cov-report=term-missing
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## Building the Package
|
|
234
|
+
|
|
235
|
+
Install the build tools:
|
|
236
|
+
|
|
237
|
+
``` bash
|
|
238
|
+
python -m pip install build
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
Build the source distribution and wheel:
|
|
242
|
+
|
|
243
|
+
``` bash
|
|
244
|
+
python -m build
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
The generated packages will be placed in:
|
|
248
|
+
|
|
249
|
+
``` text
|
|
250
|
+
dist/
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## Why autodir?
|
|
254
|
+
|
|
255
|
+
Project setup often involves repetitive work: creating directories,
|
|
256
|
+
adding placeholder files, and writing standard boilerplate. autodir
|
|
257
|
+
separates the description of a project from the process of creating it.
|
|
258
|
+
|
|
259
|
+
You describe the structure once, and autodir turns that description
|
|
260
|
+
into a real filesystem structure.
|
|
261
|
+
|
|
262
|
+
## License
|
|
263
|
+
|
|
264
|
+
MIT License
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "autodir"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A CLI tool for generating project structures from Markdown"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
dependencies = [
|
|
12
|
+
"typer>=0.27.1,<1.0"
|
|
13
|
+
]
|
|
14
|
+
authors = [
|
|
15
|
+
{ name = "Hrishikesh" }
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
[project.scripts]
|
|
19
|
+
autodir = "scaffolder.cli:app"
|
|
20
|
+
|
|
21
|
+
[tool.setuptools.packages.find]
|
|
22
|
+
where = ["src"]
|
autodir-0.1.0/setup.cfg
ADDED