plain.start 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.
- plain_start-0.1.0/.gitignore +19 -0
- plain_start-0.1.0/LICENSE +28 -0
- plain_start-0.1.0/PKG-INFO +88 -0
- plain_start-0.1.0/README.md +1 -0
- plain_start-0.1.0/plain/start/CHANGELOG.md +11 -0
- plain_start-0.1.0/plain/start/README.md +77 -0
- plain_start-0.1.0/plain/start/__init__.py +0 -0
- plain_start-0.1.0/plain/start/cli.py +120 -0
- plain_start-0.1.0/pyproject.toml +21 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025, Dropseed, LLC
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: plain.start
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Bootstrap a new Plain project from starter templates
|
|
5
|
+
Author-email: Dave Gaeddert <dave.gaeddert@dropseed.dev>
|
|
6
|
+
License-Expression: BSD-3-Clause
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Python: >=3.13
|
|
9
|
+
Requires-Dist: click>=8.0.0
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
|
|
12
|
+
# Plain Start
|
|
13
|
+
|
|
14
|
+
**Bootstrap a new Plain project from official starter templates.**
|
|
15
|
+
|
|
16
|
+
- [Overview](#overview)
|
|
17
|
+
- [Starter types](#starter-types)
|
|
18
|
+
- [Options](#options)
|
|
19
|
+
- [FAQs](#faqs)
|
|
20
|
+
- [Installation](#installation)
|
|
21
|
+
|
|
22
|
+
## Overview
|
|
23
|
+
|
|
24
|
+
The `plain-start` command provides a streamlined way to create new Plain projects from official starter templates. It clones the starter repository, configures your project name, and optionally runs the installation script to get you up and running quickly.
|
|
25
|
+
|
|
26
|
+
Basic usage:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
uvx plain-start my-project
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
This creates a new project called `my-project` using the full app starter template (with ORM, auth, admin, etc.).
|
|
33
|
+
|
|
34
|
+
## Starter types
|
|
35
|
+
|
|
36
|
+
Plain provides two official starter templates:
|
|
37
|
+
|
|
38
|
+
### App starter (default)
|
|
39
|
+
|
|
40
|
+
The app starter includes a full-featured setup with:
|
|
41
|
+
|
|
42
|
+
- Database ORM
|
|
43
|
+
- Authentication system
|
|
44
|
+
- Admin interface
|
|
45
|
+
- Session management
|
|
46
|
+
- All core Plain packages
|
|
47
|
+
|
|
48
|
+
Create an app starter project:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
uvx plain-start my-app
|
|
52
|
+
# or explicitly:
|
|
53
|
+
uvx plain-start my-app --type app
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Bare starter
|
|
57
|
+
|
|
58
|
+
The bare starter is a minimal setup with:
|
|
59
|
+
|
|
60
|
+
- Plain framework core
|
|
61
|
+
- Development tools only
|
|
62
|
+
- No database or auth by default
|
|
63
|
+
|
|
64
|
+
Create a bare starter project:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
uvx plain-start my-project --type bare
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Options
|
|
71
|
+
|
|
72
|
+
The [`cli`](./cli.py#cli) command accepts the following options:
|
|
73
|
+
|
|
74
|
+
### `--type`
|
|
75
|
+
|
|
76
|
+
Choose between `app` (default) or `bare` starter templates.
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
uvx plain-start my-project --type bare
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### `--no-install`
|
|
83
|
+
|
|
84
|
+
Skip running the `./scripts/install` script after cloning. Useful if you want to review the project structure before installing dependencies.
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
uvx plain-start my-project --no-install
|
|
88
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
plain/start/README.md
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Plain Start
|
|
2
|
+
|
|
3
|
+
**Bootstrap a new Plain project from official starter templates.**
|
|
4
|
+
|
|
5
|
+
- [Overview](#overview)
|
|
6
|
+
- [Starter types](#starter-types)
|
|
7
|
+
- [Options](#options)
|
|
8
|
+
- [FAQs](#faqs)
|
|
9
|
+
- [Installation](#installation)
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
The `plain-start` command provides a streamlined way to create new Plain projects from official starter templates. It clones the starter repository, configures your project name, and optionally runs the installation script to get you up and running quickly.
|
|
14
|
+
|
|
15
|
+
Basic usage:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
uvx plain-start my-project
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
This creates a new project called `my-project` using the full app starter template (with ORM, auth, admin, etc.).
|
|
22
|
+
|
|
23
|
+
## Starter types
|
|
24
|
+
|
|
25
|
+
Plain provides two official starter templates:
|
|
26
|
+
|
|
27
|
+
### App starter (default)
|
|
28
|
+
|
|
29
|
+
The app starter includes a full-featured setup with:
|
|
30
|
+
|
|
31
|
+
- Database ORM
|
|
32
|
+
- Authentication system
|
|
33
|
+
- Admin interface
|
|
34
|
+
- Session management
|
|
35
|
+
- All core Plain packages
|
|
36
|
+
|
|
37
|
+
Create an app starter project:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
uvx plain-start my-app
|
|
41
|
+
# or explicitly:
|
|
42
|
+
uvx plain-start my-app --type app
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Bare starter
|
|
46
|
+
|
|
47
|
+
The bare starter is a minimal setup with:
|
|
48
|
+
|
|
49
|
+
- Plain framework core
|
|
50
|
+
- Development tools only
|
|
51
|
+
- No database or auth by default
|
|
52
|
+
|
|
53
|
+
Create a bare starter project:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
uvx plain-start my-project --type bare
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Options
|
|
60
|
+
|
|
61
|
+
The [`cli`](./cli.py#cli) command accepts the following options:
|
|
62
|
+
|
|
63
|
+
### `--type`
|
|
64
|
+
|
|
65
|
+
Choose between `app` (default) or `bare` starter templates.
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
uvx plain-start my-project --type bare
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### `--no-install`
|
|
72
|
+
|
|
73
|
+
Skip running the `./scripts/install` script after cloning. Useful if you want to review the project structure before installing dependencies.
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
uvx plain-start my-project --no-install
|
|
77
|
+
```
|
|
File without changes
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import re
|
|
2
|
+
import shutil
|
|
3
|
+
import subprocess
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
import click
|
|
7
|
+
|
|
8
|
+
STARTER_REPOS = {
|
|
9
|
+
"app": "https://github.com/dropseed/plain-starter-app",
|
|
10
|
+
"bare": "https://github.com/dropseed/plain-starter-bare",
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@click.command()
|
|
15
|
+
@click.argument("project_name")
|
|
16
|
+
@click.option(
|
|
17
|
+
"--type",
|
|
18
|
+
"starter_type",
|
|
19
|
+
type=click.Choice(["app", "bare"]),
|
|
20
|
+
default="app",
|
|
21
|
+
help="Type of starter template to use",
|
|
22
|
+
)
|
|
23
|
+
@click.option(
|
|
24
|
+
"--no-install",
|
|
25
|
+
is_flag=True,
|
|
26
|
+
help="Skip running ./scripts/install after setup",
|
|
27
|
+
)
|
|
28
|
+
def cli(project_name: str, starter_type: str, no_install: bool) -> None:
|
|
29
|
+
"""Bootstrap a new Plain project from starter templates"""
|
|
30
|
+
project_path = Path.cwd() / project_name
|
|
31
|
+
|
|
32
|
+
if project_path.exists():
|
|
33
|
+
click.secho(
|
|
34
|
+
f"Error: Directory '{project_name}' already exists", fg="red", err=True
|
|
35
|
+
)
|
|
36
|
+
raise click.Abort()
|
|
37
|
+
|
|
38
|
+
# Clone the starter repository
|
|
39
|
+
repo_url = STARTER_REPOS[starter_type]
|
|
40
|
+
click.secho(f"Cloning {starter_type} starter template...", dim=True)
|
|
41
|
+
|
|
42
|
+
try:
|
|
43
|
+
subprocess.run(
|
|
44
|
+
["git", "clone", "--depth", "1", repo_url, project_name],
|
|
45
|
+
check=True,
|
|
46
|
+
capture_output=True,
|
|
47
|
+
)
|
|
48
|
+
except subprocess.CalledProcessError as e:
|
|
49
|
+
click.secho(
|
|
50
|
+
f"Error cloning repository: {e.stderr.decode()}", fg="red", err=True
|
|
51
|
+
)
|
|
52
|
+
raise click.Abort()
|
|
53
|
+
|
|
54
|
+
# Remove .git directory and reinitialize
|
|
55
|
+
click.secho("Initializing new git repository...", dim=True)
|
|
56
|
+
git_dir = project_path / ".git"
|
|
57
|
+
if git_dir.exists():
|
|
58
|
+
shutil.rmtree(git_dir)
|
|
59
|
+
|
|
60
|
+
subprocess.run(
|
|
61
|
+
["git", "init"],
|
|
62
|
+
cwd=project_path,
|
|
63
|
+
check=True,
|
|
64
|
+
capture_output=True,
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
# Replace project name in pyproject.toml
|
|
68
|
+
click.secho("Configuring project...", dim=True)
|
|
69
|
+
pyproject_path = project_path / "pyproject.toml"
|
|
70
|
+
|
|
71
|
+
if pyproject_path.exists():
|
|
72
|
+
content = pyproject_path.read_text()
|
|
73
|
+
# Replace the name field in pyproject.toml
|
|
74
|
+
# Matches: name = "anything" or name = 'anything'
|
|
75
|
+
content = re.sub(
|
|
76
|
+
r'^name\s*=\s*["\'].*?["\']',
|
|
77
|
+
f'name = "{project_name}"',
|
|
78
|
+
content,
|
|
79
|
+
count=1,
|
|
80
|
+
flags=re.MULTILINE,
|
|
81
|
+
)
|
|
82
|
+
pyproject_path.write_text(content)
|
|
83
|
+
|
|
84
|
+
# Run install script unless --no-install
|
|
85
|
+
if not no_install:
|
|
86
|
+
install_script = project_path / "scripts" / "install"
|
|
87
|
+
if install_script.exists():
|
|
88
|
+
click.echo(
|
|
89
|
+
click.style("Running installation:", bold=True)
|
|
90
|
+
+ click.style(" ./scripts/install", dim=True)
|
|
91
|
+
)
|
|
92
|
+
try:
|
|
93
|
+
subprocess.run(
|
|
94
|
+
["./scripts/install"],
|
|
95
|
+
cwd=project_path,
|
|
96
|
+
check=True,
|
|
97
|
+
)
|
|
98
|
+
except subprocess.CalledProcessError as e:
|
|
99
|
+
click.secho(
|
|
100
|
+
f"Warning: Installation script failed with exit code {e.returncode}",
|
|
101
|
+
fg="yellow",
|
|
102
|
+
err=True,
|
|
103
|
+
)
|
|
104
|
+
click.secho(
|
|
105
|
+
"You may need to run './scripts/install' manually.",
|
|
106
|
+
fg="yellow",
|
|
107
|
+
err=True,
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
# Success message
|
|
111
|
+
click.echo()
|
|
112
|
+
click.secho(
|
|
113
|
+
f"✓ Project '{project_name}' created successfully!", fg="green", bold=True
|
|
114
|
+
)
|
|
115
|
+
click.echo()
|
|
116
|
+
click.secho("Next steps:", bold=True)
|
|
117
|
+
click.secho(f" cd {project_name}")
|
|
118
|
+
if no_install:
|
|
119
|
+
click.secho(" ./scripts/install")
|
|
120
|
+
click.secho(" uv run plain dev")
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "plain.start"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Bootstrap a new Plain project from starter templates"
|
|
5
|
+
authors = [{name = "Dave Gaeddert", email = "dave.gaeddert@dropseed.dev"}]
|
|
6
|
+
license = "BSD-3-Clause"
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
requires-python = ">=3.13"
|
|
9
|
+
dependencies = [
|
|
10
|
+
"click>=8.0.0",
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
[project.scripts]
|
|
14
|
+
"plain-start" = "plain.start.cli:cli"
|
|
15
|
+
|
|
16
|
+
[tool.hatch.build.targets.wheel]
|
|
17
|
+
packages = ["plain"]
|
|
18
|
+
|
|
19
|
+
[build-system]
|
|
20
|
+
requires = ["hatchling"]
|
|
21
|
+
build-backend = "hatchling.build"
|