Skip to content

Commit 5b54b28

Browse files
committed
Squashed 'vimhelp/' changes from ba25e9b..8b4ae03
8b4ae03 Bump dependencies 900f2f4 Tweaks 73f3e82 Minor refactor 4b65628 Avoid a var shadowing an imported module name 7d49516 Use 'ruff format' instead of 'black' as formatter bb16c5d Update tom-select from 2.3.1 to 2.4.1 b7f237c webapp.py: move things around a bit 6592e93 Add .editorconfig efdf11b Bump dependencies 5f6fa4c Upgrade to Python 3.12 21e3571 Bump dependencies b78c52e Only write assets to datastore if needed 0e3bebc pyproject.toml: updates for new ruff version 9be2b04 tasks: add new "sh" task 8fc6638 Get secrets from Google Cloud 17c5d21 vimhelp.js: Gracefully support offline mode 699698c tasks.py: support deploying cron.yaml aadc049 Remove now-duplicative static asset directory 15d7022 Fix failure to retrieve assets from db afbb77e Cache busting for static assets ea4174b Revert noscript.css back to old version bd5bbed Yet another tweak 0efa488 More tweaks bc83219 Tweaks 90468a4 Refine tag/site search placeholders 23af00e "Go to keyword" & "Site search": inlay hints 2cdd8f5 "Go to keyword" & "Site search" fields: tweaks e2c69ce vim: add editorconfig.txt (bundled with Vim 9.1) 85a141b Add keyboard shortcuts for focusing <input>s 467d0f1 Remove unneeded .flake8 file 86f7f4d Bump dependencies 80a134f vimh2h tweaks git-subtree-dir: vimhelp git-subtree-split: 8b4ae032ad764bf56d2638070e66242b57d3ec93
1 parent 1e22204 commit 5b54b28

37 files changed

+1042
-655
lines changed

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
root = true
2+
3+
[*.py]
4+
max_line_length = 88

.flake8

Lines changed: 0 additions & 5 deletions
This file was deleted.

.gcloudignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
/.gitignore
33
/.gcloudignore
44
/.venv
5-
/.flake8
65
/.ruff_cache
76
/scripts
87
/README.md
@@ -11,3 +10,4 @@
1110
/tasks.py
1211
/gunicorn.conf.dev.py
1312
__pycache__/
13+
html/

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
TODO
2-
/vimhelp/secret.py
32
/.venv/
43
__pycache__/

app.yaml

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
runtime: python311
1+
runtime: python312
22

33
automatic_scaling:
44
max_instances: 2
@@ -10,31 +10,10 @@ automatic_scaling:
1010

1111
entrypoint: gunicorn -b :$PORT -k gevent -w 1 'vimhelp.webapp:create_app()'
1212

13-
default_expiration: "1h"
14-
1513
inbound_services:
1614
- warmup
1715

1816
handlers:
19-
- url: /(?:.*\.html)?
20-
script: auto
21-
secure: always
22-
- url: /api/.+
23-
script: auto
24-
secure: always
25-
- url: /(?:robots|sitemap)\.txt
26-
script: auto
27-
secure: always
28-
- url: /favicon\.ico
29-
script: auto
30-
secure: always
31-
- url: /(?:enqueue_)?update
17+
- url: /.*
3218
script: auto
3319
secure: always
34-
- url: /_ah/warmup
35-
script: auto
36-
secure: always
37-
- url: /(.+)
38-
static_files: static/\1
39-
upload: static/(.*)
40-
secure: always

cron.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ cron:
55
- description: fetch and process neovim docs
66
url: /enqueue_update?project=neovim
77
schedule: every 32 minutes
8+
- description: clean up old static asset versions
9+
url: /enqueue_clean_assets
10+
schedule: every 33 minutes

gunicorn.conf.dev.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
loglevel = "debug"
55
reload = True
6-
reload_extra_files = ["static", "templates"]
76
timeout = 15
87
worker_class = "gevent"
98
wsgi_app = "vimhelp.webapp:create_app()"

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ build-backend = "setuptools.build_meta"
1313
dependencies = { file = "requirements.txt" }
1414

1515
[tool.ruff]
16+
extend-exclude = [".pyre"]
17+
18+
[tool.ruff.lint]
1619
select = ["E", "F", "W", "I002", "N", "UP", "S", "B", "A", "C4", "DTZ", "SIM", "PTH", "PLE", "PLW", "RUF"]
1720
ignore = ["DTZ003", "PLW0603", "SIM102", "SIM108", "UP007"]
1821

19-
[tool.ruff.per-file-ignores]
22+
[tool.ruff.lint.per-file-ignores]
2023
"vimhelp/vimh2h.py" = ["E501", "PLW2901"]

requirements.txt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
Flask ~= 2.3
2-
gevent ~= 23.7
3-
geventhttpclient ~= 2.0
4-
google-cloud-ndb ~= 2.2
5-
google-cloud-tasks ~= 2.14
6-
gunicorn ~= 21.2
1+
Flask ~= 3.1
2+
gevent ~= 24.11
3+
geventhttpclient ~= 2.3
4+
google-cloud-ndb ~= 2.3
5+
google-cloud-secret-manager ~= 2.22
6+
google-cloud-tasks ~= 2.18
7+
gunicorn ~= 23.0

scripts/h2h.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,11 @@ def main():
6969
app = flask.Flask(
7070
__name__,
7171
root_path=pathlib.Path(__file__).resolve().parent,
72-
static_url_path="",
73-
static_folder="../static",
74-
template_folder="../templates",
72+
template_folder="../vimhelp/templates",
7573
)
7674
app.jinja_options["trim_blocks"] = True
7775
app.jinja_options["lstrip_blocks"] = True
76+
app.jinja_env.filters["static_path"] = lambda p: p
7877

7978
with app.app_context():
8079
if args.profile:
@@ -129,19 +128,17 @@ def run(args):
129128
f.write(html)
130129

131130
if args.out_dir is not None:
132-
print("Symlinking static files...")
133-
static_dir_rel = os.path.relpath(root_path / "static", args.out_dir)
134-
for target in (root_path / "static").iterdir():
131+
print("Symlinking/creating static files...")
132+
static_dir = root_path / "vimhelp" / "static"
133+
static_dir_rel = os.path.relpath(static_dir, args.out_dir)
134+
for target in static_dir.iterdir():
135135
target_name = target.name
136-
if target_name == f"favicon-{args.project}.ico":
137-
src_name = "favicon.ico"
138-
elif target_name.startswith("favicon-"):
139-
continue
140-
else:
141-
src_name = target_name
142-
src = pathlib.Path(args.out_dir / src_name)
136+
src = args.out_dir / target_name
143137
src.unlink(missing_ok=True)
144138
src.symlink_to(f"{static_dir_rel}/{target_name}")
139+
for name in "vimhelp.css", "vimhelp.js":
140+
content = flask.render_template(name, mode=mode)
141+
(args.out_dir / name).write_text(content)
145142

146143
print("Done.")
147144

0 commit comments

Comments
 (0)