Repository navigation
Add built-in render-engine init without cookiecutter - #1353
Merged
Merged
Conversation
Start moving `render-engine init` from render-engine-cli into the engine (render-engine-cli#45). - Add `render_engine/init/__main__.py` with the `init` options ported from the CLI to argparse (no new dependencies) - Runnable via `python -m render_engine.init` and the new `render-engine-init` console script The site generation itself is still to be done; it will render built-in Jinja2 templates instead of using cookiecutter. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Port the starter site from cookiecutter-render-engine-site (MIT, same
organization) into `render_engine/init/site_template/` so it can be
rendered without cookiecutter (render-engine-cli#45).
- Copy the static assets, base/page/archive templates and example
content unchanged
- Add `app.py.jinja`, rendered with the init answers:
- only import `Collection`, `Blog` and `MarkdownPageParser` when used
- use `Parser` instead of the ignored `pageParser`, so blog posts are
actually parsed as Markdown
- import `Blog` as `BaseBlog` instead of shadowing it
- quote values with `tojson` so titles containing quotes stay valid
- inline the former `site_vars.html` include
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The generated pyproject.toml is now a real project definition and fixes the CLI config from the cookiecutter template (render-engine-cli#45). - Add a `[project]` section with name, version, description, requires-python and dependencies - Depend on `render-engine-markdown` only when a blog is included and on `render-engine-cli` only when the user opts in to the CLI - Use `[tool.render-engine.cli]`, which is where the CLI reads its config, instead of `[render-engine.cli]`; it is always written so the CLI works if it is installed later - Derive `module` from the chosen app filename instead of hard-coding "app" Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add `templates/index.html.jinja`, the home page of a newly generated
site, as requested in render-engine-cli#45.
- Congratulate the user and explain which files to edit next,
naming the app file they chose during init
- Link to the example page and blog only when they were included
- Inline the former `check_for_collections.html` include
- Wrap only the build-time Jinja (`extends`, `SITE_TITLE`, `block`)
in `{% raw %}` so it survives the init render
- Link to the Render Engine documentation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add `README.md.jinja`, the README of a newly generated site (render-engine-cli#45). - Explain how to install the dependencies with uv or pip - Show building and previewing both with the Render Engine CLI and with plain Python, so users can see what the CLI adds and how to install it later - Use the app filename and output path chosen during init - Add `--include-date` to the `new-entry` example, which blog posts need for sorting - Bind the plain-Python preview server to 127.0.0.1 - Describe the generated `pyproject.toml` and project layout - Fix typos from the cookiecutter README and drop the section about the example GitHub workflows, which are not part of the template Co-Authored-By: Claude Opus 5.5 <[email protected]>
Redesign the generated site to match the look of render-engine.org (render-engine-cli#45). - `_base.html`: black header with the site title, navigation and logo on every page, and a matching black footer with the site URL - `index.html.jinja`: content only, with a congratulations heading, numbered next steps, cards for the example content (shown only when included) and a link to the documentation - `style.css`: header and footer bars, divider lines, code styling and render-engine.org-style cards; responsive logo and card grid Co-Authored-By: Claude Opus 5.5 <[email protected]>
Push the footer down, so it stays at the bottom of the window on pages with little content (e.g. the blog archive). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Hold the answers used to render the built-in site template in one place and validate them on creation (render-engine-cli#45), so every entry point (prompts, --no-input, --extra-context, direct use) is checked the same way. - Strip the site title and require it to be non-empty - Require the site URL to use http(s) and have a host - Derive the project slug from the title unless given, and slugify given slugs too; reject titles/slugs that produce an empty name - Require the app filename to be a valid, non-dunder Python module name in the project root that doesn't shadow an existing module - Require the output path to be a relative folder inside the project, and not `content`, `templates` or `static`, which `--clean` would delete - Add tests for all validation rules, including site titles in non-Latin scripts Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add `create_site`, the start of the rendering step of `render-engine init` (render-engine-cli#45): - Create the project folder, named after the project slug, inside the given destination (creating missing parent folders), and refuse to continue if it already exists so existing work is never overwritten - Copy every file from the template folder except `.jinja` files, keeping the folder structure; skip hidden files and anything inside hidden folders (e.g. `.DS_Store`, `.git/`) - Accept a `template_dir`, defaulting to the built-in site template, so a custom template can be used later - Make `project_slug` a plain `str` defaulting to "" so its type is always a string after validation - Rename the `-o/--output-dir` destination to `destination` in code and clarify its help text, to avoid confusion with the site's output path - Add tests for creating the folder, copying the built-in template (all files, essential files, no `.jinja` files) and copying a custom template without hidden files Co-Authored-By: Claude Opus 5.5 <[email protected]>
`create_site` now renders `.jinja` files with the init answers instead of skipping them, and writes them without the `.jinja` suffix. Other files are still copied as they are. - Use a single Jinja environment. - Pass the answers to the templates. - Name the top-level `app.py.jinja` after the chosen app filename. - Read and write templates. Co-Authored-By: Claude Opus 5.5 <[email protected]>
When the user answers "no" to the blog or the collection, `create_site` no longer copies `content/blog/` or `content/pages/`. Previously the example files were always copied, even though the generated `app.py` didn't use them. The templates (`page.html`, `archive.html`) are still copied, so a blog or collection can be added later. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Generate a site for every blog/collection combination and build it by running its app file, the way a user would. Check that the home page has the site title, the CSS is copied, and the blog post and example page are built only when they were asked for. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`InitOptions` and `create_site` accepted several kinds of bad input silently, which led to broken or surprising sites, or to lost files. They now raise an error that explains what's wrong: - Answers of the wrong type raise a `TypeError`. Most importantly, a string like "no" for a yes/no question was accepted and counted as yes. This matters for answers passed on the command line, which arrive as text. - The output path can't be a site folder in any letter case (on macOS and Windows, "Content" is the same folder as "content") or a hidden folder like `.git` or `.venv`. Cleaning the output would delete them. - A template folder that doesn't exist raises `FileNotFoundError` before anything is created, instead of creating an empty project. The template folder can also be given as a string. - Site URLs with spaces or an invalid port are rejected, and spaces around the URL are removed. - Site titles with control characters (line breaks, tabs) are rejected, since they break the generated files. Emoji and other Unicode text are still allowed. `create_site` is also more robust: - The template files are listed before the project folder is created. Previously, creating a site inside its own template folder (e.g. `--template .`) copied the project into itself until the path got too long. - A half-built project folder is now also removed when the user presses Ctrl-C, not only after an error. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Fix several problems with `create_site` and `InitOptions`, mostly around custom templates: - Copy dot-files like `.gitignore`, `.github/` and `.python-version` from templates, as cookiecutter did. Only names that never belong in a new project are skipped: version control folders, OS junk files, caches, virtual environments and `.env`. - Reject templates with two files that create the same file, such as `README.md` and `README.md.jinja`, or a plain file with the chosen app filename next to `app.py.jinja`. Previously one silently overwrote the other, depending on file order. - When creating a site fails, also remove the parent folders that were created for it, while keeping a destination that already existed. - Reject the Unicode line and paragraph separators (U+2028, U+2029) in site titles, like other line breaks. - Check answer types based on the dataclass fields, so a new answer is checked automatically. A test makes sure every answer has a text or True/False default. - Add a timeout to the build test, so a generated app that hangs fails the test instead of blocking the test run. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`python -m render_engine.init` (or `render-engine-init`) now creates a new site: - Ask the old init's questions plus "Use the Render Engine CLI?", and ask again after an invalid answer or an existing folder. - Support `--no-input`, `--extra-context` (JSON answers) and `--template` (a local folder), checking them before any question. - Show errors as one line on stderr instead of a traceback. - Drop `--config-file`, which configured cookiecutter. `create_site` now names the broken file when a template can't be rendered. Rename `test_render.py` to `test_create_site.py`, add module docstrings to the init tests, and add tests for the command. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Custom templates are no longer supported, so init always uses the built-in template. The help says so, and -t/--template is rejected. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Example blocks in app.py now bring their own blank lines, so there are always exactly two between top-level blocks. The header and footer no longer move between pages with and without a scrollbar. Co-Authored-By: Claude Opus 5.5 <[email protected]>
MarkdownPageParser is now part of render-engine (render_engine.parsers), so generated blog sites no longer need render-engine-markdown. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Check the app filename against a fixed list of module names instead of find_spec(), which depended on the folder init was run from - Escape the site title and URL in the generated HTML - Reject output paths that are project files (app file, pyproject.toml, README.md) or contain spaces - Leave out archive.html when the blog is left out - Follow the CLI answer in the README's pip instructions - Don't let a cleanup error hide the original error - Link the docs at the top of the README - Add the Render Engine logo as favicon Co-Authored-By: Claude Opus 5.5 <[email protected]>
An ASCII-art comment, only visible in the page source. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Covers invalid JSON, JSON that isn't an object, and invalid values, and checks that nothing is created. Co-Authored-By: Claude Opus 5.5 <[email protected]>
brass75
requested changes
Nov 19, 2026
brass75
left a comment
Member
There was a problem hiding this comment.
I know this is a lot of comments but it's a big PR. A couple of general things here:
- Tests need doc strings too. Just to say what they test. Those do not need parameter descriptions.
- Regular functions and methods do need parameter and return value descriptions.
- Should be asking for the name of the
Sitevariable - perhaps we don't currently but we should.
Use reference links and notes in the README, one import statement in the app file, and a set intersection for the title check. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Show how to set the project folder name in the slug error - Add .py to the app filename if it's missing - Accept any app filename the CLI can import - Allow the output folder anywhere, as long as it has a folder name Co-Authored-By: Claude Opus 5.5 <[email protected]>
New question (default 'app'), also settable with -e. It's used in the app file, in [tool.render-engine.cli] and in the README. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- The collection lives under /pages, and the nav links to its archive page - Fix the empty heading on archive pages - Make render-engine-cli a dev dependency of new sites Co-Authored-By: Claude Opus 5.5 <[email protected]>
ask_options() stores each answer itself, and asking for the project folder is its own function. Co-Authored-By: Claude Opus 5.5 <[email protected]>"
Tests say what they check; functions and methods describe their parameters, return values and errors. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Spaces in the output path are allowed again: the questions ask 'Are you sure?', and --no-input shows a warning. The README quotes the path. The project file check uses the whole path, and the content/templates/static rule is dropped. The README explains that uv sync creates .venv. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Output paths like .site are allowed now: we give sensible defaults and let the user decide. The long error message test compares the quoted path, so it passes on Windows, where repr() doubles the backslashes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
brass75
reviewed
Nov 24, 2026
brass75
reviewed
Nov 24, 2026
Render Engine writes pages with the system's encoding, which on Windows often can't write emoji, so the page came out empty and the build tests failed. The encoding fix has its own issue. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Windows raised FileNotFoundError and FileExistsError instead of NotADirectoryError when the destination was a file, so the test failed there. create_site now checks it first and raises the same error everywhere. Co-Authored-By: Claude Opus 5.5 <[email protected]>
brass75
approved these changes
Nov 24, 2026
6 of 11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of render-engine/render-engine-cli#45.
Moves
render-engine initinto render-engine, as a runnablerender_engine.initmodule with a built-in Jinja site template. Cookiecutter is no longer used.
render-engine-cli's
initwill just call it (separate PR, after this is released).It works without render-engine-cli:
What's in it
render_engine/init/site_template/: the built-in site template (app file,pyproject.toml, README, home page, styles, favicon), styled after render-engine.org.InitOptions: the answers, validated with clear errors (title, URL, project slug,app filename, output path, types).
create_site(): renders.jinjafiles and copies the rest. Leaves out theexample collection or blog if the user doesn't want them. If anything fails,
nothing is left behind.
main(argv, prog): asks the questions (argparse + rich, no click), or uses thedefaults with
--no-input. Supports-e/--extra-contextand-o/--output-dir.render-engine-cli can call it with
prog="render-engine init".[tool.render-engine.cli]section,unused imports,
modulenow follows the app filename,pageParser→Parser.to the new site's
pyproject.toml.Breaking changes (compared to the current
render-engine init)--templateis removed: custom templates are no longer supported (discussed with@brass75 on Discord).
--helpsays so.--config-fileis removed (it was a cookiecutter config).-ekeys are renamed:SITE_TITLE→site_title,SITE_URL→site_url, andskip_collection/skip_blog→include_collection/include_blog(reversed).include_cliis new.How to try it
The generated site imports
MarkdownPageParserfromrender_engine.parsers, whichisn't released yet. Until it is, point the new site at your local checkout:
Contributing guidelines
Type of Issue
Changes have been Documented (If Applicable)
The docs will be updated in a separate PR (#1313 ). Every option is
described in
--help, and the generated README explains the next steps.Changes have been Tested
tests/test_init/:test_options.py: which answers are accepted or rejectedtest_create_site.py: which files are created from which answerstest_command.py: the command (questions, flags, errors, exit codes)test_build.py: generated sites really build, in a separate processI also tested it by hand: creating, building and serving sites with different answers.
Next Steps
initcallsrender_engine.init.__main__.main, and thecookiecutter dependency is removed (after this is released).
Getting Started with Render Enginedocumentation #1313 >{{collection_title}}heading inarchive.html.render-engine.org, which is hard to see at 16×16 and in dark browser themes.
AI Attestation
I wrote and tested the code manually. I used Claude Code to explain concepts, review the code and find
bugs, try out changes before I applied them, and draft commit messages and this
description.
🤖 Generated with Claude Code