Install & Initialize¶
# install afterpython as a dev dependency
uv add --dev afterpython
# initialize afterpython/
ap initAfter running ap init, the afterpython/ directory is created and you can start writing content right away.
The structure of afterpython/ is as follows:
afterpython/doc/afterpython/blog/afterpython/tutorial/afterpython/example/afterpython/guide/
Project Website¶
A project website is basically a website that serves as the homepage for your project.
It aggregates and presents all your content in one place, including documentation, blog posts, tutorials, examples, and how-to guides.
To set the logo and favicon for the project website, put your logo.svg and favicon.svg in the afterpython/static/ directory.
See Project Website for more details.
Develop¶
Starting Development Servers¶
AfterPython provides two ways to work with content:
Project Website Only - Run
ap devto start the development server for your project website.Individual Content Development - Run
ap devwith flags to work on specific content types:ap dev --doc- Documentationap dev --blog- Blog postsap dev --tutorial- Tutorialsap dev --example- Examplesap dev --guide- Guidesap dev --all- Everything at once (all content types + project website)
When using flags, a MyST development server starts for that specific content folder (e.g., afterpython/doc/), allowing you to write and preview content in .md or .ipynb files with live reload.
Content Organization¶
All content folders in afterpython/ (e.g., afterpython/doc/, afterpython/blog/) are initialized by myst init (see MyST Markdown), and each has a default index.md file and a myst.yml file for configuration.
Build & Preview¶
To build for production, run ap build.
run ap preview to preview the production build of the project website.
Deploy¶
A deploy.yml file is created in the .github/workflows/ directory during initialization, which is a GitHub Actions workflow for deploying the project website to GitHub Pages.
By default, it will be triggered for deployment when you push any content changes to the main branch. If you don’t want this, you can:
write content in a different branch, or
disable the workflow by commenting out the
on: pushsection in thedeploy.ymlfile
MyST is the document engine that powers afterpython. You may want to read the Quick Guide to MyST to understand what you can do with it before writing content.