wpa 0.4.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.
- wpa-0.4.0/LICENSE +21 -0
- wpa-0.4.0/PKG-INFO +153 -0
- wpa-0.4.0/README.md +120 -0
- wpa-0.4.0/pyproject.toml +57 -0
- wpa-0.4.0/setup.cfg +4 -0
- wpa-0.4.0/tests/test_wp_publish.py +1221 -0
- wpa-0.4.0/wpa/__init__.py +3 -0
- wpa-0.4.0/wpa/cli.py +109 -0
- wpa-0.4.0/wpa/config.py +302 -0
- wpa-0.4.0/wpa/publish.py +92 -0
- wpa-0.4.0/wpa.egg-info/PKG-INFO +153 -0
- wpa-0.4.0/wpa.egg-info/SOURCES.txt +14 -0
- wpa-0.4.0/wpa.egg-info/dependency_links.txt +1 -0
- wpa-0.4.0/wpa.egg-info/entry_points.txt +2 -0
- wpa-0.4.0/wpa.egg-info/requires.txt +9 -0
- wpa-0.4.0/wpa.egg-info/top_level.txt +1 -0
wpa-0.4.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Neil Johnson
|
|
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.
|
wpa-0.4.0/PKG-INFO
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: wpa
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: WordPress Automation — publish markdown files as WordPress pages via the REST API
|
|
5
|
+
Author: Neil Stoker
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/cadentdev/wpa
|
|
8
|
+
Project-URL: Repository, https://github.com/cadentdev/wpa
|
|
9
|
+
Project-URL: Issues, https://github.com/cadentdev/wpa/issues
|
|
10
|
+
Keywords: wordpress,cli,markdown,publishing,automation
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Site Management
|
|
21
|
+
Requires-Python: >=3.9
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: requests
|
|
25
|
+
Requires-Dist: python-frontmatter
|
|
26
|
+
Requires-Dist: markdown
|
|
27
|
+
Requires-Dist: python-dotenv
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: pytest; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
31
|
+
Requires-Dist: ruff; extra == "dev"
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
# WPA — WordPress Automation
|
|
35
|
+
|
|
36
|
+
[](https://github.com/cadentdev/wpa/actions/workflows/ci.yml)
|
|
37
|
+
[](https://github.com/cadentdev/wpa)
|
|
38
|
+
[](https://www.python.org)
|
|
39
|
+
[](https://pypi.org/project/wpa/)
|
|
40
|
+
[](LICENSE)
|
|
41
|
+
|
|
42
|
+
Minimal CLI tool to publish markdown files as WordPress pages via the REST API.
|
|
43
|
+
|
|
44
|
+
## Install
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install wpa
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Or install from source:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
git clone https://github.com/cadentdev/wpa.git
|
|
54
|
+
cd wpa
|
|
55
|
+
pip install -e .
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Create a site config
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
wpa site add
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
This prompts for your WordPress URL, username, application password (hidden), and optional admin path. Configs are stored at `~/.config/wpa/<site-name>/.env` with `600` permissions.
|
|
65
|
+
|
|
66
|
+
### WordPress Application Password
|
|
67
|
+
|
|
68
|
+
1. Log into wp-admin → Users → Your Profile
|
|
69
|
+
2. Scroll to "Application Passwords"
|
|
70
|
+
3. Enter name: "WPA CLI", click "Add New Application Password"
|
|
71
|
+
4. Copy the generated password (use it during `--new-site` setup)
|
|
72
|
+
|
|
73
|
+
## Usage
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Publish a page (auto-selects site if only one config exists)
|
|
77
|
+
wpa publish pages/your-page.md
|
|
78
|
+
|
|
79
|
+
# Specify which site to use
|
|
80
|
+
wpa publish --site mysite pages/your-page.md
|
|
81
|
+
|
|
82
|
+
# Create or manage site configs
|
|
83
|
+
wpa site add
|
|
84
|
+
wpa site list
|
|
85
|
+
|
|
86
|
+
# Show version
|
|
87
|
+
wpa --version
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Multi-site behavior
|
|
91
|
+
|
|
92
|
+
| Configs | `--site` flag | Behavior |
|
|
93
|
+
|---------|---------------|----------|
|
|
94
|
+
| 0 | No | Prompts to create a new config |
|
|
95
|
+
| 1 | No | Uses the single config automatically |
|
|
96
|
+
| 2+ | No | Prompts to select from list |
|
|
97
|
+
| Any | Yes | Uses the named config (error if not found) |
|
|
98
|
+
|
|
99
|
+
### Markdown file format
|
|
100
|
+
|
|
101
|
+
```yaml
|
|
102
|
+
---
|
|
103
|
+
title: "Your Page Title"
|
|
104
|
+
slug: "your-page-slug"
|
|
105
|
+
status: draft
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
Page content in markdown here...
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
- `title` (required): Page title
|
|
112
|
+
- `slug` (optional): URL slug
|
|
113
|
+
- `status` (optional): `draft` (default), `publish`, `pending`, or `private`
|
|
114
|
+
|
|
115
|
+
### Site config format
|
|
116
|
+
|
|
117
|
+
Each site config is stored at `~/.config/wpa/<name>/.env`:
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
WP_SITE_URL=https://example.com
|
|
121
|
+
WP_USER=your-username
|
|
122
|
+
WP_APP_PASSWORD=xxxx xxxx xxxx xxxx
|
|
123
|
+
WP_ADMIN_PATH=wp-admin
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
- `WP_ADMIN_PATH` is optional (defaults to `wp-admin`). Override it if your site uses a custom admin URL.
|
|
127
|
+
- The `XDG_CONFIG_HOME` environment variable is respected if set.
|
|
128
|
+
|
|
129
|
+
### Migration from repo-root .env
|
|
130
|
+
|
|
131
|
+
If you have an existing `.env` in the repo root and no XDG configs, the tool will offer to migrate it on first run.
|
|
132
|
+
|
|
133
|
+
## Safety and Security
|
|
134
|
+
|
|
135
|
+
- **Default status is always `draft`** — never publishes unless frontmatter explicitly says otherwise
|
|
136
|
+
- **HTTPS enforced for public addresses** — rejects `http://` for public URLs; allows HTTP for private/LAN addresses (RFC 1918 + localhost) with a warning
|
|
137
|
+
- **Credentials in XDG config** — stored outside the repo at `~/.config/wpa/` with 600 permissions
|
|
138
|
+
- **Password input hidden** — uses `getpass` during interactive setup
|
|
139
|
+
- **Status validation** — rejects typos and invalid values in frontmatter
|
|
140
|
+
- **Site name validation** — only alphanumeric characters and hyphens allowed
|
|
141
|
+
- **Connection error handling** — timeouts and network failures produce clear messages, not tracebacks
|
|
142
|
+
|
|
143
|
+
## Development
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
pip install -e '.[dev]'
|
|
147
|
+
pytest --cov=wpa --cov-report=term-missing
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Links
|
|
151
|
+
|
|
152
|
+
- [Release Notes](RELEASE-NOTES.md)
|
|
153
|
+
- [Contributing](CONTRIBUTING.md)
|
wpa-0.4.0/README.md
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# WPA — WordPress Automation
|
|
2
|
+
|
|
3
|
+
[](https://github.com/cadentdev/wpa/actions/workflows/ci.yml)
|
|
4
|
+
[](https://github.com/cadentdev/wpa)
|
|
5
|
+
[](https://www.python.org)
|
|
6
|
+
[](https://pypi.org/project/wpa/)
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
|
|
9
|
+
Minimal CLI tool to publish markdown files as WordPress pages via the REST API.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install wpa
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Or install from source:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
git clone https://github.com/cadentdev/wpa.git
|
|
21
|
+
cd wpa
|
|
22
|
+
pip install -e .
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Create a site config
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
wpa site add
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
This prompts for your WordPress URL, username, application password (hidden), and optional admin path. Configs are stored at `~/.config/wpa/<site-name>/.env` with `600` permissions.
|
|
32
|
+
|
|
33
|
+
### WordPress Application Password
|
|
34
|
+
|
|
35
|
+
1. Log into wp-admin → Users → Your Profile
|
|
36
|
+
2. Scroll to "Application Passwords"
|
|
37
|
+
3. Enter name: "WPA CLI", click "Add New Application Password"
|
|
38
|
+
4. Copy the generated password (use it during `--new-site` setup)
|
|
39
|
+
|
|
40
|
+
## Usage
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Publish a page (auto-selects site if only one config exists)
|
|
44
|
+
wpa publish pages/your-page.md
|
|
45
|
+
|
|
46
|
+
# Specify which site to use
|
|
47
|
+
wpa publish --site mysite pages/your-page.md
|
|
48
|
+
|
|
49
|
+
# Create or manage site configs
|
|
50
|
+
wpa site add
|
|
51
|
+
wpa site list
|
|
52
|
+
|
|
53
|
+
# Show version
|
|
54
|
+
wpa --version
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Multi-site behavior
|
|
58
|
+
|
|
59
|
+
| Configs | `--site` flag | Behavior |
|
|
60
|
+
|---------|---------------|----------|
|
|
61
|
+
| 0 | No | Prompts to create a new config |
|
|
62
|
+
| 1 | No | Uses the single config automatically |
|
|
63
|
+
| 2+ | No | Prompts to select from list |
|
|
64
|
+
| Any | Yes | Uses the named config (error if not found) |
|
|
65
|
+
|
|
66
|
+
### Markdown file format
|
|
67
|
+
|
|
68
|
+
```yaml
|
|
69
|
+
---
|
|
70
|
+
title: "Your Page Title"
|
|
71
|
+
slug: "your-page-slug"
|
|
72
|
+
status: draft
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
Page content in markdown here...
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
- `title` (required): Page title
|
|
79
|
+
- `slug` (optional): URL slug
|
|
80
|
+
- `status` (optional): `draft` (default), `publish`, `pending`, or `private`
|
|
81
|
+
|
|
82
|
+
### Site config format
|
|
83
|
+
|
|
84
|
+
Each site config is stored at `~/.config/wpa/<name>/.env`:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
WP_SITE_URL=https://example.com
|
|
88
|
+
WP_USER=your-username
|
|
89
|
+
WP_APP_PASSWORD=xxxx xxxx xxxx xxxx
|
|
90
|
+
WP_ADMIN_PATH=wp-admin
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
- `WP_ADMIN_PATH` is optional (defaults to `wp-admin`). Override it if your site uses a custom admin URL.
|
|
94
|
+
- The `XDG_CONFIG_HOME` environment variable is respected if set.
|
|
95
|
+
|
|
96
|
+
### Migration from repo-root .env
|
|
97
|
+
|
|
98
|
+
If you have an existing `.env` in the repo root and no XDG configs, the tool will offer to migrate it on first run.
|
|
99
|
+
|
|
100
|
+
## Safety and Security
|
|
101
|
+
|
|
102
|
+
- **Default status is always `draft`** — never publishes unless frontmatter explicitly says otherwise
|
|
103
|
+
- **HTTPS enforced for public addresses** — rejects `http://` for public URLs; allows HTTP for private/LAN addresses (RFC 1918 + localhost) with a warning
|
|
104
|
+
- **Credentials in XDG config** — stored outside the repo at `~/.config/wpa/` with 600 permissions
|
|
105
|
+
- **Password input hidden** — uses `getpass` during interactive setup
|
|
106
|
+
- **Status validation** — rejects typos and invalid values in frontmatter
|
|
107
|
+
- **Site name validation** — only alphanumeric characters and hyphens allowed
|
|
108
|
+
- **Connection error handling** — timeouts and network failures produce clear messages, not tracebacks
|
|
109
|
+
|
|
110
|
+
## Development
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
pip install -e '.[dev]'
|
|
114
|
+
pytest --cov=wpa --cov-report=term-missing
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Links
|
|
118
|
+
|
|
119
|
+
- [Release Notes](RELEASE-NOTES.md)
|
|
120
|
+
- [Contributing](CONTRIBUTING.md)
|
wpa-0.4.0/pyproject.toml
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "wpa"
|
|
7
|
+
version = "0.4.0"
|
|
8
|
+
description = "WordPress Automation — publish markdown files as WordPress pages via the REST API"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
requires-python = ">=3.9"
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Neil Stoker"},
|
|
14
|
+
]
|
|
15
|
+
keywords = ["wordpress", "cli", "markdown", "publishing", "automation"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Environment :: Console",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.9",
|
|
22
|
+
"Programming Language :: Python :: 3.10",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Programming Language :: Python :: 3.13",
|
|
26
|
+
"Topic :: Internet :: WWW/HTTP :: Site Management",
|
|
27
|
+
]
|
|
28
|
+
dependencies = [
|
|
29
|
+
"requests",
|
|
30
|
+
"python-frontmatter",
|
|
31
|
+
"markdown",
|
|
32
|
+
"python-dotenv",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[project.optional-dependencies]
|
|
36
|
+
dev = [
|
|
37
|
+
"pytest",
|
|
38
|
+
"pytest-cov",
|
|
39
|
+
"ruff",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
[project.scripts]
|
|
43
|
+
wpa = "wpa.cli:main"
|
|
44
|
+
|
|
45
|
+
[project.urls]
|
|
46
|
+
Homepage = "https://github.com/cadentdev/wpa"
|
|
47
|
+
Repository = "https://github.com/cadentdev/wpa"
|
|
48
|
+
Issues = "https://github.com/cadentdev/wpa/issues"
|
|
49
|
+
|
|
50
|
+
[tool.setuptools.packages.find]
|
|
51
|
+
include = ["wpa*"]
|
|
52
|
+
|
|
53
|
+
[tool.ruff]
|
|
54
|
+
target-version = "py39"
|
|
55
|
+
|
|
56
|
+
[tool.pytest.ini_options]
|
|
57
|
+
testpaths = ["tests"]
|
wpa-0.4.0/setup.cfg
ADDED