ghinit 1.0.1__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.
Files changed (48) hide show
  1. ghinit-1.0.1/LICENSE +21 -0
  2. ghinit-1.0.1/PKG-INFO +225 -0
  3. ghinit-1.0.1/README.md +188 -0
  4. ghinit-1.0.1/ghinit/__init__.py +3 -0
  5. ghinit-1.0.1/ghinit/cli.py +416 -0
  6. ghinit-1.0.1/ghinit/config.py +92 -0
  7. ghinit-1.0.1/ghinit/core.py +250 -0
  8. ghinit-1.0.1/ghinit/detect.py +66 -0
  9. ghinit-1.0.1/ghinit/templates/cli/pyproject.toml +16 -0
  10. ghinit-1.0.1/ghinit/templates/cli/template.toml +5 -0
  11. ghinit-1.0.1/ghinit/templates/cli/{{repo_name}}/__init__.py +3 -0
  12. ghinit-1.0.1/ghinit/templates/cli/{{repo_name}}/cli.py +10 -0
  13. ghinit-1.0.1/ghinit/templates/django/manage.py +14 -0
  14. ghinit-1.0.1/ghinit/templates/django/requirements.txt +1 -0
  15. ghinit-1.0.1/ghinit/templates/django/template.toml +5 -0
  16. ghinit-1.0.1/ghinit/templates/django/{{repo_name}}/settings.py +39 -0
  17. ghinit-1.0.1/ghinit/templates/django/{{repo_name}}/urls.py +13 -0
  18. ghinit-1.0.1/ghinit/templates/django/{{repo_name}}/wsgi.py +7 -0
  19. ghinit-1.0.1/ghinit/templates/fastapi/main.py +8 -0
  20. ghinit-1.0.1/ghinit/templates/fastapi/requirements.txt +2 -0
  21. ghinit-1.0.1/ghinit/templates/fastapi/template.toml +5 -0
  22. ghinit-1.0.1/ghinit/templates/flask/app.py +12 -0
  23. ghinit-1.0.1/ghinit/templates/flask/requirements.txt +1 -0
  24. ghinit-1.0.1/ghinit/templates/flask/template.toml +5 -0
  25. ghinit-1.0.1/ghinit/templates/ml/README.md +9 -0
  26. ghinit-1.0.1/ghinit/templates/ml/notebooks/starter.ipynb +24 -0
  27. ghinit-1.0.1/ghinit/templates/ml/requirements.txt +4 -0
  28. ghinit-1.0.1/ghinit/templates/ml/src/__init__.py +1 -0
  29. ghinit-1.0.1/ghinit/templates/ml/src/train.py +6 -0
  30. ghinit-1.0.1/ghinit/templates/ml/template.toml +5 -0
  31. ghinit-1.0.1/ghinit/templates/react/index.html +12 -0
  32. ghinit-1.0.1/ghinit/templates/react/package.json +16 -0
  33. ghinit-1.0.1/ghinit/templates/react/src/main.jsx +8 -0
  34. ghinit-1.0.1/ghinit/templates/react/template.toml +5 -0
  35. ghinit-1.0.1/ghinit/templates.py +83 -0
  36. ghinit-1.0.1/ghinit.egg-info/PKG-INFO +225 -0
  37. ghinit-1.0.1/ghinit.egg-info/SOURCES.txt +46 -0
  38. ghinit-1.0.1/ghinit.egg-info/dependency_links.txt +1 -0
  39. ghinit-1.0.1/ghinit.egg-info/entry_points.txt +2 -0
  40. ghinit-1.0.1/ghinit.egg-info/requires.txt +13 -0
  41. ghinit-1.0.1/ghinit.egg-info/top_level.txt +1 -0
  42. ghinit-1.0.1/pyproject.toml +64 -0
  43. ghinit-1.0.1/setup.cfg +4 -0
  44. ghinit-1.0.1/tests/test_cli.py +303 -0
  45. ghinit-1.0.1/tests/test_config.py +64 -0
  46. ghinit-1.0.1/tests/test_core.py +147 -0
  47. ghinit-1.0.1/tests/test_detect.py +25 -0
  48. ghinit-1.0.1/tests/test_templates.py +33 -0
ghinit-1.0.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ghinit contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
ghinit-1.0.1/PKG-INFO ADDED
@@ -0,0 +1,225 @@
1
+ Metadata-Version: 2.4
2
+ Name: ghinit
3
+ Version: 1.0.1
4
+ Summary: CLI tool for creating and initializing GitHub repositories from the terminal.
5
+ Author: ghinit contributors
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/xyzprtk/ghinit
8
+ Project-URL: Repository, https://github.com/xyzprtk/ghinit
9
+ Project-URL: Issues, https://github.com/xyzprtk/ghinit/issues
10
+ Keywords: cli,github,git,developer-tools,automation
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: MacOS
15
+ Classifier: Operating System :: Microsoft :: Windows
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Topic :: Software Development :: Version Control :: Git
24
+ Classifier: Topic :: Utilities
25
+ Requires-Python: >=3.8
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: click>=8.0
29
+ Requires-Dist: questionary>=2.0
30
+ Requires-Dist: tomli>=2.0; python_version < "3.11"
31
+ Provides-Extra: dev
32
+ Requires-Dist: pytest>=7.0; extra == "dev"
33
+ Requires-Dist: build>=1.2.0; extra == "dev"
34
+ Requires-Dist: twine>=5.0.0; extra == "dev"
35
+ Requires-Dist: tomli>=2.0; python_version < "3.11" and extra == "dev"
36
+ Dynamic: license-file
37
+
38
+ # ghinit
39
+
40
+ `ghinit` is a Python CLI for creating GitHub repositories and bootstrapping the
41
+ current directory without leaving the terminal.
42
+
43
+ It wraps `gh` and `git`, adds interactive prompts with sensible defaults, and
44
+ can scaffold a starter project template before the first push.
45
+
46
+ ## Why ghinit
47
+
48
+ - Create a GitHub repo from the terminal with one command.
49
+ - Avoid the repeated `git init`, `git add`, `git commit`, remote setup, and push flow.
50
+ - Reuse starter templates for APIs, CLIs, frontends, and ML projects.
51
+ - Keep defaults in `~/.ghinit.toml` so repeated setup takes less time.
52
+
53
+ ## Requirements
54
+
55
+ - Python 3.8+
56
+ - `git`
57
+ - `gh` authenticated with `gh auth login`
58
+
59
+ ## Install
60
+
61
+ From PyPI:
62
+
63
+ ```bash
64
+ pip install ghinit
65
+ ```
66
+
67
+ For local development:
68
+
69
+ ```bash
70
+ pip install -e ".[dev]"
71
+ ```
72
+
73
+ If your shell does not find the installed `repo` command, add:
74
+
75
+ ```bash
76
+ export PATH="$HOME/.local/bin:$PATH"
77
+ ```
78
+
79
+ ## Quick Start
80
+
81
+ Create a repo with guided prompts:
82
+
83
+ ```bash
84
+ repo
85
+ ```
86
+
87
+ Create a private Flask project without confirmation:
88
+
89
+ ```bash
90
+ repo my-api --private --template flask --yes
91
+ ```
92
+
93
+ Create a public React repo and open it in the browser after push:
94
+
95
+ ```bash
96
+ repo my-ui --public --template react --open
97
+ ```
98
+
99
+ ## How It Works
100
+
101
+ When you run `repo`, ghinit:
102
+
103
+ 1. Verifies `git` and `gh` are installed and that `gh` is authenticated.
104
+ 2. Creates the remote GitHub repository with `gh repo create`.
105
+ 3. Applies an optional bundled or custom template.
106
+ 4. Fetches a `.gitignore` suggestion from GitHub's gitignore templates API.
107
+ 5. Initializes the local git repository, commits, adds the remote, and pushes.
108
+
109
+ ## Commands
110
+
111
+ ### `repo`
112
+
113
+ Create a repository in the current directory.
114
+
115
+ Options:
116
+
117
+ - `--public` create a public repository
118
+ - `--private` create a private repository
119
+ - `--template <name>` choose a scaffold template
120
+ - `-y, --yes` skip the confirmation prompt
121
+ - `--open` open the repository in the browser after a successful push
122
+ - `--version` print the installed version
123
+
124
+ ### `repo config`
125
+
126
+ View or update persistent defaults stored in `~/.ghinit.toml`.
127
+
128
+ Examples:
129
+
130
+ ```bash
131
+ repo config
132
+ repo config --show
133
+ repo config --reset
134
+ ```
135
+
136
+ Config shape:
137
+
138
+ ```toml
139
+ [defaults]
140
+ visibility = "private"
141
+ template = "none"
142
+ remote = "origin"
143
+
144
+ [templates]
145
+ custom_dir = "~/my-templates"
146
+ ```
147
+
148
+ ### `repo templates`
149
+
150
+ List the available built-in templates plus any templates discovered in the
151
+ configured custom template directory.
152
+
153
+ ## Built-In Templates
154
+
155
+ - `flask`: Minimal Flask API with a health check route
156
+ - `fastapi`: Minimal FastAPI service
157
+ - `react`: React + Vite starter
158
+ - `django`: Minimal Django project scaffold
159
+ - `cli`: Click-based Python CLI scaffold
160
+ - `ml`: Notebook-first machine learning project scaffold
161
+
162
+ Templates can declare metadata through `template.toml` and may use:
163
+
164
+ - `{{repo_name}}`
165
+ - `{{author}}`
166
+
167
+ These variables are rendered into file contents and template paths during copy.
168
+
169
+ ## Custom Templates
170
+
171
+ Set a custom template directory:
172
+
173
+ ```bash
174
+ repo config
175
+ ```
176
+
177
+ Point `custom_dir` to a folder that contains one subdirectory per template. Each
178
+ template can include a `template.toml` file:
179
+
180
+ ```toml
181
+ [meta]
182
+ name = "Internal API"
183
+ description = "Company starter service"
184
+ language = "Python"
185
+ post_install = "Run: uv sync"
186
+ ```
187
+
188
+ ## Development
189
+
190
+ Run tests:
191
+
192
+ ```bash
193
+ python -m unittest discover -s tests -v
194
+ ```
195
+
196
+ Build a distribution locally:
197
+
198
+ ```bash
199
+ python -m build
200
+ ```
201
+
202
+ ## Release Process
203
+
204
+ The repository includes GitHub Actions workflows for:
205
+
206
+ - running tests on every push and pull request
207
+ - building and publishing to PyPI when a tag like `v1.0.0` is pushed
208
+
209
+ To publish a release:
210
+
211
+ 1. Update code and docs.
212
+ 2. Push to `main` and confirm CI passes.
213
+ 3. Create and push a version tag:
214
+
215
+ ```bash
216
+ git tag v1.0.0
217
+ git push origin v1.0.0
218
+ ```
219
+
220
+ 4. Ensure the repository has a `PYPI_API_TOKEN` secret configured.
221
+
222
+ ## Demo
223
+
224
+ The README is prepared for a future GIF or terminal recording section. No demo
225
+ asset is bundled in the repository yet.
ghinit-1.0.1/README.md ADDED
@@ -0,0 +1,188 @@
1
+ # ghinit
2
+
3
+ `ghinit` is a Python CLI for creating GitHub repositories and bootstrapping the
4
+ current directory without leaving the terminal.
5
+
6
+ It wraps `gh` and `git`, adds interactive prompts with sensible defaults, and
7
+ can scaffold a starter project template before the first push.
8
+
9
+ ## Why ghinit
10
+
11
+ - Create a GitHub repo from the terminal with one command.
12
+ - Avoid the repeated `git init`, `git add`, `git commit`, remote setup, and push flow.
13
+ - Reuse starter templates for APIs, CLIs, frontends, and ML projects.
14
+ - Keep defaults in `~/.ghinit.toml` so repeated setup takes less time.
15
+
16
+ ## Requirements
17
+
18
+ - Python 3.8+
19
+ - `git`
20
+ - `gh` authenticated with `gh auth login`
21
+
22
+ ## Install
23
+
24
+ From PyPI:
25
+
26
+ ```bash
27
+ pip install ghinit
28
+ ```
29
+
30
+ For local development:
31
+
32
+ ```bash
33
+ pip install -e ".[dev]"
34
+ ```
35
+
36
+ If your shell does not find the installed `repo` command, add:
37
+
38
+ ```bash
39
+ export PATH="$HOME/.local/bin:$PATH"
40
+ ```
41
+
42
+ ## Quick Start
43
+
44
+ Create a repo with guided prompts:
45
+
46
+ ```bash
47
+ repo
48
+ ```
49
+
50
+ Create a private Flask project without confirmation:
51
+
52
+ ```bash
53
+ repo my-api --private --template flask --yes
54
+ ```
55
+
56
+ Create a public React repo and open it in the browser after push:
57
+
58
+ ```bash
59
+ repo my-ui --public --template react --open
60
+ ```
61
+
62
+ ## How It Works
63
+
64
+ When you run `repo`, ghinit:
65
+
66
+ 1. Verifies `git` and `gh` are installed and that `gh` is authenticated.
67
+ 2. Creates the remote GitHub repository with `gh repo create`.
68
+ 3. Applies an optional bundled or custom template.
69
+ 4. Fetches a `.gitignore` suggestion from GitHub's gitignore templates API.
70
+ 5. Initializes the local git repository, commits, adds the remote, and pushes.
71
+
72
+ ## Commands
73
+
74
+ ### `repo`
75
+
76
+ Create a repository in the current directory.
77
+
78
+ Options:
79
+
80
+ - `--public` create a public repository
81
+ - `--private` create a private repository
82
+ - `--template <name>` choose a scaffold template
83
+ - `-y, --yes` skip the confirmation prompt
84
+ - `--open` open the repository in the browser after a successful push
85
+ - `--version` print the installed version
86
+
87
+ ### `repo config`
88
+
89
+ View or update persistent defaults stored in `~/.ghinit.toml`.
90
+
91
+ Examples:
92
+
93
+ ```bash
94
+ repo config
95
+ repo config --show
96
+ repo config --reset
97
+ ```
98
+
99
+ Config shape:
100
+
101
+ ```toml
102
+ [defaults]
103
+ visibility = "private"
104
+ template = "none"
105
+ remote = "origin"
106
+
107
+ [templates]
108
+ custom_dir = "~/my-templates"
109
+ ```
110
+
111
+ ### `repo templates`
112
+
113
+ List the available built-in templates plus any templates discovered in the
114
+ configured custom template directory.
115
+
116
+ ## Built-In Templates
117
+
118
+ - `flask`: Minimal Flask API with a health check route
119
+ - `fastapi`: Minimal FastAPI service
120
+ - `react`: React + Vite starter
121
+ - `django`: Minimal Django project scaffold
122
+ - `cli`: Click-based Python CLI scaffold
123
+ - `ml`: Notebook-first machine learning project scaffold
124
+
125
+ Templates can declare metadata through `template.toml` and may use:
126
+
127
+ - `{{repo_name}}`
128
+ - `{{author}}`
129
+
130
+ These variables are rendered into file contents and template paths during copy.
131
+
132
+ ## Custom Templates
133
+
134
+ Set a custom template directory:
135
+
136
+ ```bash
137
+ repo config
138
+ ```
139
+
140
+ Point `custom_dir` to a folder that contains one subdirectory per template. Each
141
+ template can include a `template.toml` file:
142
+
143
+ ```toml
144
+ [meta]
145
+ name = "Internal API"
146
+ description = "Company starter service"
147
+ language = "Python"
148
+ post_install = "Run: uv sync"
149
+ ```
150
+
151
+ ## Development
152
+
153
+ Run tests:
154
+
155
+ ```bash
156
+ python -m unittest discover -s tests -v
157
+ ```
158
+
159
+ Build a distribution locally:
160
+
161
+ ```bash
162
+ python -m build
163
+ ```
164
+
165
+ ## Release Process
166
+
167
+ The repository includes GitHub Actions workflows for:
168
+
169
+ - running tests on every push and pull request
170
+ - building and publishing to PyPI when a tag like `v1.0.0` is pushed
171
+
172
+ To publish a release:
173
+
174
+ 1. Update code and docs.
175
+ 2. Push to `main` and confirm CI passes.
176
+ 3. Create and push a version tag:
177
+
178
+ ```bash
179
+ git tag v1.0.0
180
+ git push origin v1.0.0
181
+ ```
182
+
183
+ 4. Ensure the repository has a `PYPI_API_TOKEN` secret configured.
184
+
185
+ ## Demo
186
+
187
+ The README is prepared for a future GIF or terminal recording section. No demo
188
+ asset is bundled in the repository yet.
@@ -0,0 +1,3 @@
1
+ """ghinit package metadata."""
2
+
3
+ __version__ = "1.0.1"