pyforge-init 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,221 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyforge-init
3
+ Version: 0.1.0
4
+ Summary: A CLI tool to scaffold new Python projects, similar to create-react-app.
5
+ Author-email: Your Name <your.email@example.com>
6
+ Requires-Python: >=3.9
7
+ Requires-Dist: click>=8.0.0
8
+ Requires-Dist: httpx>=0.27.0
9
+ Requires-Dist: jinja2>=3.0.0
10
+ Requires-Dist: questionary>=2.0.0
11
+ Requires-Dist: rich>=13.0.0
12
+ Requires-Dist: tomli>=2.0.0; python_version < '3.11'
13
+ Provides-Extra: dev
14
+ Requires-Dist: pytest-mock>=3.0.0; extra == 'dev'
15
+ Requires-Dist: pytest>=7.0.0; extra == 'dev'
16
+ Description-Content-Type: text/markdown
17
+
18
+ # pyforge
19
+
20
+ `pyforge` is a lightweight, interactive command-line interface (CLI) tool designed to scaffold production-ready Python projects in seconds. Inspired by standard scaffolding tools, `pyforge` automates project initialization, environment setup, testing configuration, linting, formatting, and dependency management.
21
+
22
+ ---
23
+
24
+ ## Key Features
25
+
26
+ * **Interactive TUI**: Driven by `questionary` for guided project configuration (supports non-interactive overrides).
27
+ * **Multiple Built-in Templates**: Native templates for `basic` packages, `cli` tools, `fastapi` microservices, and `flask` applications.
28
+ * **Remote Templates**: Pull custom project layouts directly from public GitHub repositories using the `gh:owner/repo` syntax.
29
+ * **Configurable Defaults**: Save persistent author, license, and tool choices in a `~/.newpythonrc` configuration file.
30
+ * **Standards-Compliant**: Generates PEP 621-compliant `pyproject.toml` using `hatchling` as the build backend.
31
+ * **Tooling Configuration**: Preconfigured integration with `pytest`, `ruff` (linter and formatter), and `pre-commit` hooks.
32
+ * **Task Automation**: Automated creation of a local virtual environment, Git repository initialization, and generation of a template-aware `Makefile` or `Justfile`.
33
+
34
+ ---
35
+
36
+ ## Installation
37
+
38
+ Install `pyforge-init` globally via PyPI:
39
+
40
+ ```bash
41
+ pip install pyforge-init
42
+ ```
43
+
44
+ Or install it in an isolated environment using `pipx`:
45
+
46
+ ```bash
47
+ pipx install pyforge-init
48
+ ```
49
+
50
+ ---
51
+
52
+ ## Quick Start
53
+
54
+ Initialize a new project by running:
55
+
56
+ ```bash
57
+ newpython myproject
58
+ ```
59
+
60
+ The CLI will start the interactive configuration wizard:
61
+
62
+ ```
63
+ ? Project description: A new Python project
64
+ ? Author name: Jane Doe
65
+ ? License: MIT
66
+ ? Initialize a virtual environment (.venv)? Yes
67
+ ? Initialize a git repository? Yes
68
+ ```
69
+
70
+ Once the wizard completes, your project directory is created and populated. Execute the following commands to begin development:
71
+
72
+ ```bash
73
+ cd myproject
74
+ source .venv/bin/activate # On Windows use: .venv\Scripts\activate
75
+ make install # Installs the package and all dev dependencies
76
+ make run # Runs the application (varies by template)
77
+ ```
78
+
79
+ ---
80
+
81
+ ## CLI Reference
82
+
83
+ ```
84
+ Usage: newpython [OPTIONS] PROJECT_NAME
85
+
86
+ Scaffold a new Python project.
87
+
88
+ Arguments:
89
+ PROJECT_NAME Name of the project (must be a valid Python identifier)
90
+
91
+ Options:
92
+ --template TEXT Built-in template (basic, cli, fastapi, flask)
93
+ or a remote GitHub repo (gh:owner/repo[@ref]) [default: basic]
94
+ --no-pre-commit Skip generating .pre-commit-config.yaml
95
+ --justfile Generate a Justfile instead of a Makefile
96
+ -y, --yes Skip interactive prompts and accept defaults
97
+ --help Show this message and exit.
98
+ ```
99
+
100
+ ---
101
+
102
+ ## Project Structure (Basic Template)
103
+
104
+ The default template (`basic`) generates the following directory structure:
105
+
106
+ ```
107
+ myproject/
108
+ ├── src/
109
+ │ └── myproject/
110
+ │ └── __init__.py # Package initialization
111
+ ├── tests/
112
+ │ └── test_main.py # Starter unit test
113
+ ├── .env.example # Example environment variables
114
+ ├── .gitignore # Standard Python git ignore rules
115
+ ├── .pre-commit-config.yaml # Pre-configured linting/formatting hooks
116
+ ├── Makefile # Task runner
117
+ ├── README.md # Generated project documentation
118
+ ├── pyproject.toml # Metadata, dependencies, and tool settings
119
+ └── requirements.txt # Project dependencies
120
+ ```
121
+
122
+ ---
123
+
124
+ ## Templates
125
+
126
+ ### Built-in Templates
127
+
128
+ | Template | Primary Stack | Generated Entry Point | Run Command |
129
+ |---|---|---|---|
130
+ | `basic` | Pure Python | `src/package/__init__.py` | `python -m package` |
131
+ | `cli` | `click` | `src/package/cli.py` & `__main__.py` | Registered console script |
132
+ | `fastapi` | `fastapi`, `uvicorn`, `httpx` | `src/package/main.py` | `uvicorn src.package.main:app` |
133
+ | `flask` | `flask` (Factory pattern) | `src/package/app.py` | `flask run` |
134
+
135
+ ### Remote Templates
136
+
137
+ You can import any public GitHub repository to use as a project template:
138
+
139
+ ```bash
140
+ # Uses the main/master branch
141
+ newpython myproject --template gh:username/repo-name
142
+
143
+ # Pin to a specific branch, tag, or commit hash
144
+ newpython myproject --template gh:username/repo-name@v1.0.0
145
+ ```
146
+
147
+ #### Remote Repository Requirements
148
+ Remote templates are fetched and copied as-is (no Jinja template rendering is performed on remote files).
149
+ * If the remote repository has a top-level `template/` directory, only the contents of that folder are copied to the destination.
150
+ * If no `template/` directory is present, the entire contents of the repository root will be copied.
151
+
152
+ ---
153
+
154
+ ## Configuration File (`~/.newpythonrc`)
155
+
156
+ You can persist configuration defaults in a `~/.newpythonrc` (TOML format) file to pre-fill prompt values and skip entering them on every run.
157
+
158
+ ```toml
159
+ # ~/.newpythonrc
160
+ author = "Jane Doe"
161
+ license = "MIT"
162
+ template = "basic"
163
+ pre_commit = true
164
+ justfile = false
165
+ ```
166
+
167
+ ### Precedence Order
168
+ When resolving configurations, `pyforge` applies overrides in the following order (highest to lowest):
169
+ 1. **CLI Flags** (e.g. `--template`, `--justfile`)
170
+ 2. **Configuration file** (`~/.newpythonrc`)
171
+ 3. **Interactive Prompt Defaults**
172
+
173
+ To override the default config location, set the `NEWPYTHON_CONFIG` environment variable:
174
+ ```bash
175
+ export NEWPYTHON_CONFIG="/path/to/custom/config.toml"
176
+ ```
177
+
178
+ ---
179
+
180
+ ## Automated Task Runner
181
+
182
+ The generated `Makefile` (or `Justfile` if `--justfile` is passed) exposes standard commands for project maintenance:
183
+
184
+ * `make install`: Installs the project locally in editable mode alongside all development dependencies (`pip install -e ".[dev]"`).
185
+ * `make test`: Executes the test suite using `pytest`.
186
+ * `make lint`: Performs static analysis checking with `ruff`.
187
+ * `make format`: Auto-formats code styles using `ruff format`.
188
+ * `make run`: Starts the application server or CLI script (template-aware).
189
+ * `make clean`: Recursively cleans local cache directories (`__pycache__`, `.pytest_cache`, `.ruff_cache`, `build`, `dist`).
190
+
191
+ ---
192
+
193
+ ## Publishing to PyPI
194
+
195
+ Projects generated by `pyforge` use `hatchling` as the build system and are ready to be built and uploaded to PyPI:
196
+
197
+ 1. Install build and publication dependencies:
198
+ ```bash
199
+ pip install build twine
200
+ ```
201
+ 2. Build the project distribution packages (source archive and wheel):
202
+ ```bash
203
+ python -m build
204
+ ```
205
+ 3. Upload to PyPI (or TestPyPI first):
206
+ ```bash
207
+ python -m twine upload dist/*
208
+ ```
209
+
210
+ ---
211
+
212
+ ## Contributing
213
+
214
+ Contributions to `pyforge` are welcome. To set up a local development environment:
215
+
216
+ ```bash
217
+ git clone https://github.com/your-name/pyforge.git
218
+ cd pyforge
219
+ pip install -e ".[dev]"
220
+ python -m pytest -v
221
+ ```
@@ -0,0 +1,28 @@
1
+ pyforge/__init__.py,sha256=cByAUJAaGo8zE4nISvOJR_8JBORLOfE0CtE2nT5HtW8,65
2
+ pyforge/cli.py,sha256=n-BtHvmkpdR46TjsKUf7u2OeteN1-4wD7hY3ELXybNY,7120
3
+ pyforge/config.py,sha256=KHLWmrWUDtAvLieJI7fH6zEKcy9XLe_SbvgkZTBRklg,3574
4
+ pyforge/generator.py,sha256=WgM4c1rdt2o9ofYVMGlD2DKdootz9rHtufSTHXe_TnM,5985
5
+ pyforge/prompts.py,sha256=Zo9tPjJRGqQhENdMoEroJn6RbCmbR8sBxQNs2Y3IdAM,6095
6
+ pyforge/remote.py,sha256=EfvavkpWbeDnumgoTjRfLqPAb3A6wKu1gdD4piyNCUY,6041
7
+ pyforge/utils.py,sha256=2jjaHc1KeoqRD_W3qAYtm6TfPJO7bBqYgXRST4WYDG4,1973
8
+ pyforge/templates/basic/tests/test_main.py.jinja,sha256=1Z659NQdKdN6JRgugwHeFyOmicszqYEEIC60-0kgumw,79
9
+ pyforge/templates/cli/src/package/__main__.py.jinja,sha256=y5WriDGWdwrXKv5igEd5MltM3hKaFq6VZTPxD7oAeXY,79
10
+ pyforge/templates/cli/src/package/cli.py.jinja,sha256=xtR8iPXJpiwwz4mvBpY0TAnB9SUjgi0G3lhJYowvkyA,182
11
+ pyforge/templates/cli/tests/test_cli.py.jinja,sha256=__qCaJ-SaSuubFj7OpEMuUvlzSkns1B8nfSlNR-nHcQ,248
12
+ pyforge/templates/fastapi/src/package/main.py.jinja,sha256=GChD5xohSCN-MOLOUR5JFydS__IpjMCC_09OJyjYCak,143
13
+ pyforge/templates/fastapi/tests/test_main.py.jinja,sha256=HwG61zwgEFwSgDHK4GIPM59wchwpxcrNgD-NTtOpGGc,260
14
+ pyforge/templates/flask/src/package/app.py.jinja,sha256=Ryx8UGf8EbH9G_EriOOfZY9swu22aamM0DV1N5heK4U,167
15
+ pyforge/templates/flask/tests/test_app.py.jinja,sha256=IcJ5YFvH1M5Moko9HiP6VXrtMI18tr8NviN4iV2z5sM,396
16
+ pyforge/templates/shared/Justfile.jinja,sha256=28X37B0jvgwi3yB2i8q0I-5oquqIuyrAGJ1JDsPwsJw,605
17
+ pyforge/templates/shared/Makefile.jinja,sha256=DxfxIKQw5Lnytq2iX-ZkQszWk5lwSTx9Ai8bi3CZNZo,613
18
+ pyforge/templates/shared/README.md.jinja,sha256=ltieQX-L7e9uSscVhTN4qxJ3yhTaoZTMkQgj0ahpRvc,474
19
+ pyforge/templates/shared/env.example.jinja,sha256=prkabCyzO2_YL5AWFm9AQpfvTxmb18lspPSaHvNhWhA,211
20
+ pyforge/templates/shared/gitignore.jinja,sha256=jCGyE4uk6GUSfwTJw0lK2dplb6v7cKaar5VbXwH6MUU,115
21
+ pyforge/templates/shared/pre-commit-config.yaml.jinja,sha256=Z55GQtZtAKGW05msYtrCrUhD-DmXO63t73QdfnqteiQ,382
22
+ pyforge/templates/shared/pyproject.toml.jinja,sha256=pYnlYm_G-QfdhldE0592KIwG870ocHvn5chh2otEzac,1067
23
+ pyforge/templates/shared/requirements.txt.jinja,sha256=u8_CUdsIpkFibfCXwv-Ca_YMo3Q7gWZAYSnDVancw_I,37
24
+ pyforge/templates/shared/src/package/__init__.py.jinja,sha256=VRdil8MpsJxZrevfQsOK_fKvalf8kJmld74ttLKOzew,27
25
+ pyforge_init-0.1.0.dist-info/METADATA,sha256=VQukOhMklSPjFs9q8GVaUoMC79u1S42_h9Oigxiag0o,7346
26
+ pyforge_init-0.1.0.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
27
+ pyforge_init-0.1.0.dist-info/entry_points.txt,sha256=Jxhn-m0OgG3Hgz80byUqEeApRpM2B6O1f-hDYl03mtE,47
28
+ pyforge_init-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.30.1
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ newpython = pyforge.cli:main