plain.dev 0.19.1__tar.gz → 0.19.3__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_dev-0.19.1 → plain_dev-0.19.3}/PKG-INFO +1 -3
- plain_dev-0.19.3/README.md +1 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/plain/dev/cli.py +9 -1
- plain_dev-0.19.3/plain/dev/contribute/README.md +5 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/pyproject.toml +6 -1
- plain_dev-0.19.1/README.md +0 -98
- {plain_dev-0.19.1 → plain_dev-0.19.3}/.gitignore +0 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/LICENSE +0 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/plain/dev/README.md +0 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/plain/dev/__init__.py +0 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/plain/dev/contribute/__init__.py +0 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/plain/dev/contribute/cli.py +0 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/plain/dev/db/__init__.py +0 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/plain/dev/db/cli.py +0 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/plain/dev/db/container.py +0 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/plain/dev/debug.py +0 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/plain/dev/default_settings.py +0 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/plain/dev/entrypoints.py +0 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/plain/dev/gunicorn_logging.json +0 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/plain/dev/mkcert.py +0 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/plain/dev/pdb.py +0 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/plain/dev/pid.py +0 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/plain/dev/poncho/__init__.py +0 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/plain/dev/poncho/color.py +0 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/plain/dev/poncho/compat.py +0 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/plain/dev/poncho/manager.py +0 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/plain/dev/poncho/printer.py +0 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/plain/dev/poncho/process.py +0 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/plain/dev/precommit/__init__.py +0 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/plain/dev/precommit/cli.py +0 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/plain/dev/requests.py +0 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/plain/dev/services.py +0 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/plain/dev/templates/dev/requests.html +0 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/plain/dev/urls.py +0 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/plain/dev/utils.py +0 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/plain/dev/views.py +0 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/tests/settings.py +0 -0
- {plain_dev-0.19.1 → plain_dev-0.19.3}/uv.lock +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: plain.dev
|
3
|
-
Version: 0.19.
|
3
|
+
Version: 0.19.3
|
4
4
|
Summary: Local development tools for Plain.
|
5
5
|
Author-email: Dave Gaeddert <dave.gaeddert@dropseed.dev>
|
6
6
|
License-Expression: BSD-3-Clause
|
@@ -15,8 +15,6 @@ Requires-Dist: requests>=2.0.0
|
|
15
15
|
Requires-Dist: rich
|
16
16
|
Description-Content-Type: text/markdown
|
17
17
|
|
18
|
-
<!-- This file is compiled from plain-dev/plain/dev/README.md. Do not edit this file directly. -->
|
19
|
-
|
20
18
|
# plain.dev
|
21
19
|
|
22
20
|
A single command that runs everything you need for local development.
|
@@ -0,0 +1 @@
|
|
1
|
+
./plain/dev/README.md
|
@@ -58,7 +58,15 @@ def cli(ctx, port, hostname, log_level):
|
|
58
58
|
return
|
59
59
|
|
60
60
|
if not hostname:
|
61
|
-
project_name = os.path.basename(
|
61
|
+
project_name = os.path.basename(
|
62
|
+
os.getcwd()
|
63
|
+
) # Use the directory name by default
|
64
|
+
|
65
|
+
if has_pyproject_toml(APP_PATH.parent):
|
66
|
+
with open(Path(APP_PATH.parent, "pyproject.toml"), "rb") as f:
|
67
|
+
pyproject = tomllib.load(f)
|
68
|
+
project_name = pyproject.get("project", {}).get("name", project_name)
|
69
|
+
|
62
70
|
hostname = f"{project_name}.localhost"
|
63
71
|
|
64
72
|
returncode = Dev(port=port, hostname=hostname, log_level=log_level).run()
|
@@ -0,0 +1,5 @@
|
|
1
|
+
## FAQs
|
2
|
+
|
3
|
+
### What if the plain cli isn't working?
|
4
|
+
|
5
|
+
When working on packages locally you can sometimes end up in a weird state where Plain can't load. The `plain contrib` command is also available as `plain-contrib`, which won't go through any of the setup processes for Plain, so you can always run that directly if you need to.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "plain.dev"
|
3
|
-
version = "0.19.
|
3
|
+
version = "0.19.3"
|
4
4
|
description = "Local development tools for Plain."
|
5
5
|
authors = [{name = "Dave Gaeddert", email = "dave.gaeddert@dropseed.dev"}]
|
6
6
|
license = "BSD-3-Clause"
|
@@ -16,6 +16,11 @@ dependencies = [
|
|
16
16
|
"rich",
|
17
17
|
]
|
18
18
|
|
19
|
+
# Make this available as a standalone command
|
20
|
+
# in case plain can't load or something (this can run anyways)
|
21
|
+
[project.scripts]
|
22
|
+
plain-contrib = "plain.dev.contribute:cli"
|
23
|
+
|
19
24
|
# Make the CLI available without adding to INSTALLED_APPS
|
20
25
|
[project.entry-points."plain.cli"]
|
21
26
|
"dev" = "plain.dev:cli"
|
plain_dev-0.19.1/README.md
DELETED
@@ -1,98 +0,0 @@
|
|
1
|
-
<!-- This file is compiled from plain-dev/plain/dev/README.md. Do not edit this file directly. -->
|
2
|
-
|
3
|
-
# plain.dev
|
4
|
-
|
5
|
-
A single command that runs everything you need for local development.
|
6
|
-
|
7
|
-

|
8
|
-
|
9
|
-
The `plain.dev` package can be [installed from PyPI](https://pypi.org/project/plain.dev/), and does *not* need to be added to `INSTALLED_PACKAGES`.
|
10
|
-
|
11
|
-
- [`plain dev`](#plain-dev)
|
12
|
-
- [`plain dev services`](#plain-dev-services)
|
13
|
-
- [`plain pre-commit`](#plain-pre-commit)
|
14
|
-
- [`plain contrib`](#plain-contrib)
|
15
|
-
- [VS Code debugging](#vscode-debugging)
|
16
|
-
|
17
|
-
## `plain dev`
|
18
|
-
|
19
|
-
The `plain dev` command does several things:
|
20
|
-
|
21
|
-
- Sets `PLAIN_CSRF_TRUSTED_ORIGINS` to localhost by default
|
22
|
-
- Runs `plain preflight` to check for any issues
|
23
|
-
- Executes any pending model migrations
|
24
|
-
- Starts `gunicorn` with `--reload`
|
25
|
-
- Runs `plain tailwind compile --watch`, if `plain.tailwind` is installed
|
26
|
-
- Any custom process defined in `pyproject.toml` at `tool.plain.dev.run`
|
27
|
-
- Necessary services (ex. Postgres) defined in `pyproject.toml` at `tool.plain.dev.services`
|
28
|
-
|
29
|
-
### Services
|
30
|
-
|
31
|
-
Use services to define databases or other processes that your app *needs* to be functional. The services will be started automatically in `plain dev`, but also in `plain pre-commit` (so preflight and tests have a database).
|
32
|
-
|
33
|
-
Ultimately, how you run your development database is up to you. But a recommended starting point is to use Docker:
|
34
|
-
|
35
|
-
```toml
|
36
|
-
# pyproject.toml
|
37
|
-
[tool.plain.dev.services]
|
38
|
-
postgres = {cmd = "docker run --name app-postgres --rm -p 54321:5432 -v $(pwd)/.plain/dev/pgdata:/var/lib/postgresql/data -e POSTGRES_PASSWORD=postgres postgres:15 postgres"}
|
39
|
-
```
|
40
|
-
|
41
|
-
### Custom processes
|
42
|
-
|
43
|
-
Unlike [services](#services), custom processes are *only* run during `plain dev`. This is a good place to run something like [ngrok](https://ngrok.com/) or a [Plain worker](../../../plain-worker), which you might need to use your local site, but don't need running for executing tests, for example.
|
44
|
-
|
45
|
-
```toml
|
46
|
-
# pyproject.toml
|
47
|
-
[tool.plain.dev.run]
|
48
|
-
ngrok = {command = "ngrok http $PORT"}
|
49
|
-
```
|
50
|
-
|
51
|
-
## `plain dev services`
|
52
|
-
|
53
|
-
Starts your [services](#services) by themselves.
|
54
|
-
|
55
|
-
## `plain pre-commit`
|
56
|
-
|
57
|
-
A built-in pre-commit hook that can be installed with `plain pre-commit --install`.
|
58
|
-
|
59
|
-
Runs:
|
60
|
-
|
61
|
-
- Custom commands defined in `pyproject.toml` at `tool.plain.pre-commit.run`
|
62
|
-
- `plain code check`, if [`plain.code`](https://plainframework.com/docs/plain-code/plain/code/) is installed
|
63
|
-
- `uv lock --locked`, if using uv
|
64
|
-
- `plain preflight --database default`
|
65
|
-
- `plain migrate --check`
|
66
|
-
- `plain makemigrations --dry-run --check`
|
67
|
-
- `plain compile`
|
68
|
-
- `plain test`
|
69
|
-
|
70
|
-
## VS Code debugging
|
71
|
-
|
72
|
-

|
73
|
-
|
74
|
-
Since `plain dev` runs multiple processes at once, the regular [pdb](https://docs.python.org/3/library/pdb.html) debuggers don't quite work.
|
75
|
-
|
76
|
-
Instead, we include [microsoft/debugpy](https://github.com/microsoft/debugpy) and an `attach` function to make it even easier to use VS Code's debugger.
|
77
|
-
|
78
|
-
First, import and run the `debug.attach()` function:
|
79
|
-
|
80
|
-
```python
|
81
|
-
class HomeView(TemplateView):
|
82
|
-
template_name = "home.html"
|
83
|
-
|
84
|
-
def get_template_context(self):
|
85
|
-
context = super().get_template_context()
|
86
|
-
|
87
|
-
# Make sure the debugger is attached (will need to be if runserver reloads)
|
88
|
-
from plain.dev import debug; debug.attach()
|
89
|
-
|
90
|
-
# Add a breakpoint (or use the gutter in VS Code to add one)
|
91
|
-
breakpoint()
|
92
|
-
|
93
|
-
return context
|
94
|
-
```
|
95
|
-
|
96
|
-
When you load the page, you'll see "Waiting for debugger to attach...".
|
97
|
-
|
98
|
-
You can then run the VS Code debugger and attach to an existing Python process, at localhost:5678.
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|