plain.dev 0.0.1__tar.gz → 0.2.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.
Files changed (27) hide show
  1. plain_dev-0.2.0/PKG-INFO +124 -0
  2. plain_dev-0.2.0/README.md +98 -0
  3. plain_dev-0.2.0/plain/dev/README.md +96 -0
  4. {plain_dev-0.0.1 → plain_dev-0.2.0}/plain/dev/precommit/cli.py +1 -1
  5. {plain_dev-0.0.1 → plain_dev-0.2.0}/pyproject.toml +13 -8
  6. plain_dev-0.0.1/PKG-INFO +0 -178
  7. plain_dev-0.0.1/README.md +0 -150
  8. plain_dev-0.0.1/plain/dev/README.md +0 -148
  9. {plain_dev-0.0.1 → plain_dev-0.2.0}/LICENSE +0 -0
  10. {plain_dev-0.0.1 → plain_dev-0.2.0}/plain/dev/__init__.py +0 -0
  11. {plain_dev-0.0.1 → plain_dev-0.2.0}/plain/dev/cli.py +0 -0
  12. {plain_dev-0.0.1 → plain_dev-0.2.0}/plain/dev/config.py +0 -0
  13. {plain_dev-0.0.1 → plain_dev-0.2.0}/plain/dev/contribute/__init__.py +0 -0
  14. {plain_dev-0.0.1 → plain_dev-0.2.0}/plain/dev/contribute/cli.py +0 -0
  15. {plain_dev-0.0.1 → plain_dev-0.2.0}/plain/dev/db/__init__.py +0 -0
  16. {plain_dev-0.0.1 → plain_dev-0.2.0}/plain/dev/db/cli.py +0 -0
  17. {plain_dev-0.0.1 → plain_dev-0.2.0}/plain/dev/db/container.py +0 -0
  18. {plain_dev-0.0.1 → plain_dev-0.2.0}/plain/dev/debug.py +0 -0
  19. {plain_dev-0.0.1 → plain_dev-0.2.0}/plain/dev/default_settings.py +0 -0
  20. {plain_dev-0.0.1 → plain_dev-0.2.0}/plain/dev/pid.py +0 -0
  21. {plain_dev-0.0.1 → plain_dev-0.2.0}/plain/dev/precommit/__init__.py +0 -0
  22. {plain_dev-0.0.1 → plain_dev-0.2.0}/plain/dev/requests.py +0 -0
  23. {plain_dev-0.0.1 → plain_dev-0.2.0}/plain/dev/services.py +0 -0
  24. {plain_dev-0.0.1 → plain_dev-0.2.0}/plain/dev/templates/dev/requests.html +0 -0
  25. {plain_dev-0.0.1 → plain_dev-0.2.0}/plain/dev/urls.py +0 -0
  26. {plain_dev-0.0.1 → plain_dev-0.2.0}/plain/dev/utils.py +0 -0
  27. {plain_dev-0.0.1 → plain_dev-0.2.0}/plain/dev/views.py +0 -0
@@ -0,0 +1,124 @@
1
+ Metadata-Version: 2.1
2
+ Name: plain.dev
3
+ Version: 0.2.0
4
+ Summary: Local development tools for Plain.
5
+ Home-page: https://plainframework.com
6
+ License: BSD-3-Clause
7
+ Author: Dave Gaeddert
8
+ Author-email: dave.gaeddert@dropseed.dev
9
+ Requires-Python: >=3.11,<4.0
10
+ Classifier: License :: OSI Approved :: BSD License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Requires-Dist: click (>=8.0.0)
15
+ Requires-Dist: debugpy (>=1.6.3,<2.0.0)
16
+ Requires-Dist: gunicorn (>20)
17
+ Requires-Dist: honcho (>=1.1.0,<2.0.0)
18
+ Requires-Dist: plain (<1.0.0)
19
+ Requires-Dist: psycopg2-binary (>=2.9.3,<3.0.0)
20
+ Requires-Dist: requests (>=2.0.0)
21
+ Requires-Dist: tomli (>=2.0.1,<3.0.0) ; python_version < "3.11"
22
+ Project-URL: Documentation, https://plainframework.com/docs/
23
+ Project-URL: Repository, https://github.com/dropseed/plain
24
+ Description-Content-Type: text/markdown
25
+
26
+ <!-- This file is compiled from plain-dev/plain/dev/README.md. Do not edit this file directly. -->
27
+
28
+ # plain.dev
29
+
30
+ A single command that runs everything you need for local development.
31
+
32
+ ![Plain dev command example](https://github.com/dropseed/plain/assets/649496/3643bb64-a99b-4a8e-adab-8c6b81791ea9)
33
+
34
+ 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`.
35
+
36
+ - [`plain dev`](#plain-dev)
37
+ - [`plain dev services`](#plain-dev-services)
38
+ - [`plain pre-commit`](#plain-pre-commit)
39
+ - [`plain contrib`](#plain-contrib)
40
+ - [VS Code debugging](#vscode-debugging)
41
+
42
+ ## `plain dev`
43
+
44
+ The `plain dev` command does several things:
45
+
46
+ - Sets `PLAIN_CSRF_TRUSTED_ORIGINS` to localhost by default
47
+ - Runs `plain preflight` to check for any issues
48
+ - Executes any pending model migrations
49
+ - Starts `gunicorn` with `--reload`
50
+ - Runs `plain tailwind compile --watch`, if `plain.tailwind` is installed
51
+ - Any custom process defined in `pyproject.toml` at `tool.plain.dev.run`
52
+ - Necessary services (ex. Postgres) defined in `pyproject.toml` at `tool.plain.dev.services`
53
+
54
+ ### Services
55
+
56
+ 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).
57
+
58
+ Ultimately, how you run your development database is up to you. But a recommended starting point is to use Docker:
59
+
60
+ ```toml
61
+ # pyproject.toml
62
+ [tool.plain.dev.services]
63
+ 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"}
64
+ ```
65
+
66
+ ### Custom processes
67
+
68
+ 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.
69
+
70
+ ```toml
71
+ # pyproject.toml
72
+ [tool.plain.dev.run]
73
+ ngrok = {command = "ngrok http $PORT"}
74
+ ```
75
+
76
+ ## `plain dev services`
77
+
78
+ Starts your [services](#services) by themselves.
79
+
80
+ ## `plain pre-commit`
81
+
82
+ A built-in pre-commit hook that can be installed with `plain pre-commit --install`.
83
+
84
+ Runs:
85
+
86
+ - Custom commands defined in `pyproject.toml` at `tool.plain.pre-commit.run`
87
+ - `plain code check`, if [`plain.code`](https://plainframework.com/docs/plain-code/plain/code/) is installed
88
+ - `poetry check --lock`, if using [Poetry](https://python-poetry.org/)
89
+ - `plain preflight --database default`
90
+ - `plain legacy migrate --check`
91
+ - `plain legacy makemigrations --dry-run --check`
92
+ - `plain compile`
93
+ - `plain test`
94
+
95
+ ## VS Code debugging
96
+
97
+ ![Debug Plain with VS Code](https://github.com/dropseed/plain-public/assets/649496/250138b6-7702-4ab6-bf38-e0c8e3c56d06)
98
+
99
+ Since `plain dev` runs multiple processes at once, the regular [pdb](https://docs.python.org/3/library/pdb.html) debuggers don't quite work.
100
+
101
+ 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.
102
+
103
+ First, import and run the `debug.attach()` function:
104
+
105
+ ```python
106
+ class HomeView(TemplateView):
107
+ template_name = "home.html"
108
+
109
+ def get_template_context(self):
110
+ context = super().get_template_context()
111
+
112
+ # Make sure the debugger is attached (will need to be if runserver reloads)
113
+ from plain.dev import debug; debug.attach()
114
+
115
+ # Add a breakpoint (or use the gutter in VS Code to add one)
116
+ breakpoint()
117
+
118
+ return context
119
+ ```
120
+
121
+ When you load the page, you'll see "Waiting for debugger to attach...".
122
+
123
+ You can then run the VS Code debugger and attach to an existing Python process, at localhost:5678.
124
+
@@ -0,0 +1,98 @@
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
+ ![Plain dev command example](https://github.com/dropseed/plain/assets/649496/3643bb64-a99b-4a8e-adab-8c6b81791ea9)
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
+ - `poetry check --lock`, if using [Poetry](https://python-poetry.org/)
64
+ - `plain preflight --database default`
65
+ - `plain legacy migrate --check`
66
+ - `plain legacy makemigrations --dry-run --check`
67
+ - `plain compile`
68
+ - `plain test`
69
+
70
+ ## VS Code debugging
71
+
72
+ ![Debug Plain with VS Code](https://github.com/dropseed/plain-public/assets/649496/250138b6-7702-4ab6-bf38-e0c8e3c56d06)
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.
@@ -0,0 +1,96 @@
1
+ # plain.dev
2
+
3
+ A single command that runs everything you need for local development.
4
+
5
+ ![Plain dev command example](https://github.com/dropseed/plain/assets/649496/3643bb64-a99b-4a8e-adab-8c6b81791ea9)
6
+
7
+ 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`.
8
+
9
+ - [`plain dev`](#plain-dev)
10
+ - [`plain dev services`](#plain-dev-services)
11
+ - [`plain pre-commit`](#plain-pre-commit)
12
+ - [`plain contrib`](#plain-contrib)
13
+ - [VS Code debugging](#vscode-debugging)
14
+
15
+ ## `plain dev`
16
+
17
+ The `plain dev` command does several things:
18
+
19
+ - Sets `PLAIN_CSRF_TRUSTED_ORIGINS` to localhost by default
20
+ - Runs `plain preflight` to check for any issues
21
+ - Executes any pending model migrations
22
+ - Starts `gunicorn` with `--reload`
23
+ - Runs `plain tailwind compile --watch`, if `plain.tailwind` is installed
24
+ - Any custom process defined in `pyproject.toml` at `tool.plain.dev.run`
25
+ - Necessary services (ex. Postgres) defined in `pyproject.toml` at `tool.plain.dev.services`
26
+
27
+ ### Services
28
+
29
+ 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).
30
+
31
+ Ultimately, how you run your development database is up to you. But a recommended starting point is to use Docker:
32
+
33
+ ```toml
34
+ # pyproject.toml
35
+ [tool.plain.dev.services]
36
+ 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"}
37
+ ```
38
+
39
+ ### Custom processes
40
+
41
+ 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.
42
+
43
+ ```toml
44
+ # pyproject.toml
45
+ [tool.plain.dev.run]
46
+ ngrok = {command = "ngrok http $PORT"}
47
+ ```
48
+
49
+ ## `plain dev services`
50
+
51
+ Starts your [services](#services) by themselves.
52
+
53
+ ## `plain pre-commit`
54
+
55
+ A built-in pre-commit hook that can be installed with `plain pre-commit --install`.
56
+
57
+ Runs:
58
+
59
+ - Custom commands defined in `pyproject.toml` at `tool.plain.pre-commit.run`
60
+ - `plain code check`, if [`plain.code`](https://plainframework.com/docs/plain-code/plain/code/) is installed
61
+ - `poetry check --lock`, if using [Poetry](https://python-poetry.org/)
62
+ - `plain preflight --database default`
63
+ - `plain legacy migrate --check`
64
+ - `plain legacy makemigrations --dry-run --check`
65
+ - `plain compile`
66
+ - `plain test`
67
+
68
+ ## VS Code debugging
69
+
70
+ ![Debug Plain with VS Code](https://github.com/dropseed/plain-public/assets/649496/250138b6-7702-4ab6-bf38-e0c8e3c56d06)
71
+
72
+ Since `plain dev` runs multiple processes at once, the regular [pdb](https://docs.python.org/3/library/pdb.html) debuggers don't quite work.
73
+
74
+ 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.
75
+
76
+ First, import and run the `debug.attach()` function:
77
+
78
+ ```python
79
+ class HomeView(TemplateView):
80
+ template_name = "home.html"
81
+
82
+ def get_template_context(self):
83
+ context = super().get_template_context()
84
+
85
+ # Make sure the debugger is attached (will need to be if runserver reloads)
86
+ from plain.dev import debug; debug.attach()
87
+
88
+ # Add a breakpoint (or use the gutter in VS Code to add one)
89
+ breakpoint()
90
+
91
+ return context
92
+ ```
93
+
94
+ When you load the page, you'll see "Waiting for debugger to attach...".
95
+
96
+ You can then run the VS Code debugger and attach to an existing Python process, at localhost:5678.
@@ -61,7 +61,7 @@ def cli(install):
61
61
  check_short("Running plain code checks", "plain", "code", "check")
62
62
 
63
63
  if Path("poetry.lock").exists():
64
- check_short("Checking poetry.lock", "poetry", "lock", "--check")
64
+ check_short("Checking poetry.lock", "poetry", "check", "--lock")
65
65
 
66
66
  if plain_db_connected():
67
67
  check_short(
@@ -5,14 +5,14 @@ packages = [
5
5
  { include = "plain" },
6
6
  ]
7
7
 
8
- version = "0.0.1"
9
- description = "Work library for Plain"
8
+ version = "0.2.0"
9
+ description = "Local development tools for Plain."
10
10
  authors = ["Dave Gaeddert <dave.gaeddert@dropseed.dev>"]
11
- license = "MIT"
11
+ license = "BSD-3-Clause"
12
12
  readme = "README.md"
13
- homepage = "https://www.plainpackages.com/"
14
- documentation = "https://www.plainpackages.com/docs/"
15
- repository = "https://github.com/plainpackages/plain-dev"
13
+ homepage = "https://plainframework.com"
14
+ documentation = "https://plainframework.com/docs/"
15
+ repository = "https://github.com/dropseed/plain"
16
16
 
17
17
  # Make the CLI available without adding to INSTALLED_APPS
18
18
  [tool.poetry.plugins."plain.cli"]
@@ -21,7 +21,10 @@ repository = "https://github.com/plainpackages/plain-dev"
21
21
  "contrib" = "plain.dev.contribute:cli"
22
22
 
23
23
  [tool.poetry.dependencies]
24
- python = "^3.8"
24
+ python = "^3.11"
25
+
26
+ plain = "<1.0.0"
27
+
25
28
  click = ">=8.0.0"
26
29
  honcho = "^1.1.0"
27
30
  debugpy = "^1.6.3"
@@ -36,7 +39,9 @@ requests = ">=2.0.0"
36
39
  psycopg2-binary = "^2.9.3"
37
40
 
38
41
 
39
- [tool.poetry.dev-dependencies]
42
+ [tool.poetry.group.dev.dependencies]
43
+ plain = {path = "../plain", develop = true}
44
+
40
45
  pytest = "^7.1.2"
41
46
  ipdb = "^0.13.9"
42
47
 
plain_dev-0.0.1/PKG-INFO DELETED
@@ -1,178 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: plain.dev
3
- Version: 0.0.1
4
- Summary: Work library for Plain
5
- Home-page: https://www.plainpackages.com/
6
- License: MIT
7
- Author: Dave Gaeddert
8
- Author-email: dave.gaeddert@dropseed.dev
9
- Requires-Python: >=3.8,<4.0
10
- Classifier: License :: OSI Approved :: MIT License
11
- Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.8
13
- Classifier: Programming Language :: Python :: 3.9
14
- Classifier: Programming Language :: Python :: 3.10
15
- Classifier: Programming Language :: Python :: 3.11
16
- Classifier: Programming Language :: Python :: 3.12
17
- Requires-Dist: click (>=8.0.0)
18
- Requires-Dist: debugpy (>=1.6.3,<2.0.0)
19
- Requires-Dist: gunicorn (>20)
20
- Requires-Dist: honcho (>=1.1.0,<2.0.0)
21
- Requires-Dist: psycopg2-binary (>=2.9.3,<3.0.0)
22
- Requires-Dist: requests (>=2.0.0)
23
- Requires-Dist: tomli (>=2.0.1,<3.0.0) ; python_version < "3.11"
24
- Project-URL: Documentation, https://www.plainpackages.com/docs/
25
- Project-URL: Repository, https://github.com/plainpackages/plain-dev
26
- Description-Content-Type: text/markdown
27
-
28
- <!-- This file is compiled from plain-dev/plain/dev/README.md. Do not edit this file directly. -->
29
-
30
- # plain-dev
31
-
32
- A single command to run everything you need for local Plain development.
33
-
34
- ![Plain work command example](https://user-images.githubusercontent.com/649496/176533533-cfd44dc5-afe5-42af-8b5d-33a9fa23f8d9.gif)
35
-
36
- The `plain dev` command runs a combination of local commands + a Docker container for your database.
37
-
38
- The following processes will run simultaneously (some will only run if they are detected as available):
39
-
40
- <!-- - [`manage.py runserver` (and migrations)](#runserver)
41
- - [`plain-models start --logs`](#plain-models)
42
- - [`plain-tailwind compile --watch`](#plain-tailwind)
43
- - [`npm run watch`](#package-json)
44
- - [`stripe listen --forward-to`](#stripe)
45
- - [`ngrok http --subdomain`](#ngrok)
46
-
47
- It also comes with [debugging](#debugging) tools to make local debugging easier with VS Code. -->
48
-
49
- ## Installation
50
-
51
- ```sh
52
- pip install plain-dev
53
- ```
54
-
55
- If you have `plain-models` installed (i.e. you're using a database),
56
- then add `DATABASE_URL` to your `.env` file.
57
-
58
- ```sh
59
- DATABASE_URL=postgres://postgres:postgres@localhost:54321/postgres
60
- ```
61
-
62
- ```toml
63
- # pyproject.toml
64
- [tool.plain.dev.services]
65
- 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"}
66
- ```
67
-
68
- ```sh
69
- plain dev
70
- ```
71
-
72
- ## `plain dev`
73
-
74
- ### Default processes
75
-
76
- - plain preflight
77
- - gunicorn
78
- - migrations
79
- - tailwind
80
-
81
- ### Custom processes
82
-
83
- - package.json "dev" script
84
- - pyproject.toml `tool.plain.dev.run = {command = "..."}`
85
-
86
- ### GitHub Codespaces
87
-
88
- The `BASE_URL` setting is automatically set to the Codespace URL.
89
-
90
- TODO
91
-
92
- ## `plain dev db`
93
-
94
- Only supports Postgres currently.
95
-
96
- - snapshot
97
- - import
98
- - export
99
-
100
-
101
- ## Development processes
102
-
103
- ### Gunicorn
104
-
105
- The key process here is still `manage.py runserver`.
106
- But, before that runs, it will also wait for the database to be available and run `manage.py migrate`.
107
-
108
- ### plain-models
109
-
110
- If [`plain-models`](https://github.com/plainpackages/plain-models) is installed, it will automatically start and show the logs of the running database container.
111
-
112
- ### plain-tailwind
113
-
114
- If [`plain-tailwind`](https://github.com/plainpackages/plain-tailwind) is installed, it will automatically run the Tailwind `compile --watch` process.
115
-
116
- ## Debugging
117
-
118
- [View on YouTube →](https://www.youtube.com/watch?v=pG0KaJSVyBw)
119
-
120
- Since `plain work` runs multiple processes at once, the regular [pdb](https://docs.python.org/3/library/pdb.html) debuggers can be hard to use.
121
- 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.
122
-
123
- First, import and run the `debug.attach()` function:
124
-
125
- ```python
126
- class HomeView(TemplateView):
127
- template_name = "home.html"
128
-
129
- def get_context(self, **kwargs):
130
- context = super().get_context(**kwargs)
131
-
132
- # Make sure the debugger is attached (will need to be if runserver reloads)
133
- from plain.work import debug; debug.attach()
134
-
135
- # Add a breakpoint (or use the gutter in VSCode to add one)
136
- breakpoint()
137
-
138
- return context
139
- ```
140
-
141
- When you load the page, you'll see "Waiting for debugger to attach...".
142
-
143
- Add a new VS Code debug configuration (using localhost and port 5768) by saving this to `.vscode/launch.json` or using the GUI:
144
-
145
- ```json
146
- // .vscode/launch.json
147
- {
148
- // Use IntelliSense to learn about possible attributes.
149
- // Hover to view descriptions of existing attributes.
150
- // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
151
- "version": "0.2.0",
152
- "configurations": [
153
- {
154
- "name": "Plain: Attach to Django",
155
- "type": "python",
156
- "request": "attach",
157
- "connect": {
158
- "host": "localhost",
159
- "port": 5678
160
- },
161
- "pathMappings": [
162
- {
163
- "localRoot": "${workspaceFolder}",
164
- "remoteRoot": "."
165
- }
166
- ],
167
- "justMyCode": true,
168
- "django": true
169
- }
170
- ]
171
- }
172
- ```
173
-
174
- Then in the "Run and Debug" tab, you can click the green arrow next to "Plain: Attach to Django" to start the debugger.
175
-
176
- In your terminal is should tell you it was attached, and when you hit a breakpoint you'll see the debugger information in VS Code.
177
- If Django's runserver reloads, you'll be prompted to reattach by clicking the green arrow again.
178
-
plain_dev-0.0.1/README.md DELETED
@@ -1,150 +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 to run everything you need for local Plain development.
6
-
7
- ![Plain work command example](https://user-images.githubusercontent.com/649496/176533533-cfd44dc5-afe5-42af-8b5d-33a9fa23f8d9.gif)
8
-
9
- The `plain dev` command runs a combination of local commands + a Docker container for your database.
10
-
11
- The following processes will run simultaneously (some will only run if they are detected as available):
12
-
13
- <!-- - [`manage.py runserver` (and migrations)](#runserver)
14
- - [`plain-models start --logs`](#plain-models)
15
- - [`plain-tailwind compile --watch`](#plain-tailwind)
16
- - [`npm run watch`](#package-json)
17
- - [`stripe listen --forward-to`](#stripe)
18
- - [`ngrok http --subdomain`](#ngrok)
19
-
20
- It also comes with [debugging](#debugging) tools to make local debugging easier with VS Code. -->
21
-
22
- ## Installation
23
-
24
- ```sh
25
- pip install plain-dev
26
- ```
27
-
28
- If you have `plain-models` installed (i.e. you're using a database),
29
- then add `DATABASE_URL` to your `.env` file.
30
-
31
- ```sh
32
- DATABASE_URL=postgres://postgres:postgres@localhost:54321/postgres
33
- ```
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
- ```sh
42
- plain dev
43
- ```
44
-
45
- ## `plain dev`
46
-
47
- ### Default processes
48
-
49
- - plain preflight
50
- - gunicorn
51
- - migrations
52
- - tailwind
53
-
54
- ### Custom processes
55
-
56
- - package.json "dev" script
57
- - pyproject.toml `tool.plain.dev.run = {command = "..."}`
58
-
59
- ### GitHub Codespaces
60
-
61
- The `BASE_URL` setting is automatically set to the Codespace URL.
62
-
63
- TODO
64
-
65
- ## `plain dev db`
66
-
67
- Only supports Postgres currently.
68
-
69
- - snapshot
70
- - import
71
- - export
72
-
73
-
74
- ## Development processes
75
-
76
- ### Gunicorn
77
-
78
- The key process here is still `manage.py runserver`.
79
- But, before that runs, it will also wait for the database to be available and run `manage.py migrate`.
80
-
81
- ### plain-models
82
-
83
- If [`plain-models`](https://github.com/plainpackages/plain-models) is installed, it will automatically start and show the logs of the running database container.
84
-
85
- ### plain-tailwind
86
-
87
- If [`plain-tailwind`](https://github.com/plainpackages/plain-tailwind) is installed, it will automatically run the Tailwind `compile --watch` process.
88
-
89
- ## Debugging
90
-
91
- [View on YouTube →](https://www.youtube.com/watch?v=pG0KaJSVyBw)
92
-
93
- Since `plain work` runs multiple processes at once, the regular [pdb](https://docs.python.org/3/library/pdb.html) debuggers can be hard to use.
94
- 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.
95
-
96
- First, import and run the `debug.attach()` function:
97
-
98
- ```python
99
- class HomeView(TemplateView):
100
- template_name = "home.html"
101
-
102
- def get_context(self, **kwargs):
103
- context = super().get_context(**kwargs)
104
-
105
- # Make sure the debugger is attached (will need to be if runserver reloads)
106
- from plain.work import debug; debug.attach()
107
-
108
- # Add a breakpoint (or use the gutter in VSCode to add one)
109
- breakpoint()
110
-
111
- return context
112
- ```
113
-
114
- When you load the page, you'll see "Waiting for debugger to attach...".
115
-
116
- Add a new VS Code debug configuration (using localhost and port 5768) by saving this to `.vscode/launch.json` or using the GUI:
117
-
118
- ```json
119
- // .vscode/launch.json
120
- {
121
- // Use IntelliSense to learn about possible attributes.
122
- // Hover to view descriptions of existing attributes.
123
- // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
124
- "version": "0.2.0",
125
- "configurations": [
126
- {
127
- "name": "Plain: Attach to Django",
128
- "type": "python",
129
- "request": "attach",
130
- "connect": {
131
- "host": "localhost",
132
- "port": 5678
133
- },
134
- "pathMappings": [
135
- {
136
- "localRoot": "${workspaceFolder}",
137
- "remoteRoot": "."
138
- }
139
- ],
140
- "justMyCode": true,
141
- "django": true
142
- }
143
- ]
144
- }
145
- ```
146
-
147
- Then in the "Run and Debug" tab, you can click the green arrow next to "Plain: Attach to Django" to start the debugger.
148
-
149
- In your terminal is should tell you it was attached, and when you hit a breakpoint you'll see the debugger information in VS Code.
150
- If Django's runserver reloads, you'll be prompted to reattach by clicking the green arrow again.
@@ -1,148 +0,0 @@
1
- # plain-dev
2
-
3
- A single command to run everything you need for local Plain development.
4
-
5
- ![Plain work command example](https://user-images.githubusercontent.com/649496/176533533-cfd44dc5-afe5-42af-8b5d-33a9fa23f8d9.gif)
6
-
7
- The `plain dev` command runs a combination of local commands + a Docker container for your database.
8
-
9
- The following processes will run simultaneously (some will only run if they are detected as available):
10
-
11
- <!-- - [`manage.py runserver` (and migrations)](#runserver)
12
- - [`plain-models start --logs`](#plain-models)
13
- - [`plain-tailwind compile --watch`](#plain-tailwind)
14
- - [`npm run watch`](#package-json)
15
- - [`stripe listen --forward-to`](#stripe)
16
- - [`ngrok http --subdomain`](#ngrok)
17
-
18
- It also comes with [debugging](#debugging) tools to make local debugging easier with VS Code. -->
19
-
20
- ## Installation
21
-
22
- ```sh
23
- pip install plain-dev
24
- ```
25
-
26
- If you have `plain-models` installed (i.e. you're using a database),
27
- then add `DATABASE_URL` to your `.env` file.
28
-
29
- ```sh
30
- DATABASE_URL=postgres://postgres:postgres@localhost:54321/postgres
31
- ```
32
-
33
- ```toml
34
- # pyproject.toml
35
- [tool.plain.dev.services]
36
- 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"}
37
- ```
38
-
39
- ```sh
40
- plain dev
41
- ```
42
-
43
- ## `plain dev`
44
-
45
- ### Default processes
46
-
47
- - plain preflight
48
- - gunicorn
49
- - migrations
50
- - tailwind
51
-
52
- ### Custom processes
53
-
54
- - package.json "dev" script
55
- - pyproject.toml `tool.plain.dev.run = {command = "..."}`
56
-
57
- ### GitHub Codespaces
58
-
59
- The `BASE_URL` setting is automatically set to the Codespace URL.
60
-
61
- TODO
62
-
63
- ## `plain dev db`
64
-
65
- Only supports Postgres currently.
66
-
67
- - snapshot
68
- - import
69
- - export
70
-
71
-
72
- ## Development processes
73
-
74
- ### Gunicorn
75
-
76
- The key process here is still `manage.py runserver`.
77
- But, before that runs, it will also wait for the database to be available and run `manage.py migrate`.
78
-
79
- ### plain-models
80
-
81
- If [`plain-models`](https://github.com/plainpackages/plain-models) is installed, it will automatically start and show the logs of the running database container.
82
-
83
- ### plain-tailwind
84
-
85
- If [`plain-tailwind`](https://github.com/plainpackages/plain-tailwind) is installed, it will automatically run the Tailwind `compile --watch` process.
86
-
87
- ## Debugging
88
-
89
- [View on YouTube →](https://www.youtube.com/watch?v=pG0KaJSVyBw)
90
-
91
- Since `plain work` runs multiple processes at once, the regular [pdb](https://docs.python.org/3/library/pdb.html) debuggers can be hard to use.
92
- 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.
93
-
94
- First, import and run the `debug.attach()` function:
95
-
96
- ```python
97
- class HomeView(TemplateView):
98
- template_name = "home.html"
99
-
100
- def get_context(self, **kwargs):
101
- context = super().get_context(**kwargs)
102
-
103
- # Make sure the debugger is attached (will need to be if runserver reloads)
104
- from plain.work import debug; debug.attach()
105
-
106
- # Add a breakpoint (or use the gutter in VSCode to add one)
107
- breakpoint()
108
-
109
- return context
110
- ```
111
-
112
- When you load the page, you'll see "Waiting for debugger to attach...".
113
-
114
- Add a new VS Code debug configuration (using localhost and port 5768) by saving this to `.vscode/launch.json` or using the GUI:
115
-
116
- ```json
117
- // .vscode/launch.json
118
- {
119
- // Use IntelliSense to learn about possible attributes.
120
- // Hover to view descriptions of existing attributes.
121
- // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
122
- "version": "0.2.0",
123
- "configurations": [
124
- {
125
- "name": "Plain: Attach to Django",
126
- "type": "python",
127
- "request": "attach",
128
- "connect": {
129
- "host": "localhost",
130
- "port": 5678
131
- },
132
- "pathMappings": [
133
- {
134
- "localRoot": "${workspaceFolder}",
135
- "remoteRoot": "."
136
- }
137
- ],
138
- "justMyCode": true,
139
- "django": true
140
- }
141
- ]
142
- }
143
- ```
144
-
145
- Then in the "Run and Debug" tab, you can click the green arrow next to "Plain: Attach to Django" to start the debugger.
146
-
147
- In your terminal is should tell you it was attached, and when you hit a breakpoint you'll see the debugger information in VS Code.
148
- If Django's runserver reloads, you'll be prompted to reattach by clicking the green arrow again.
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