annotate piecrust/__init__.py @ 411:e7b865f8f335

bake: Enable multiprocess baking. Baking is now done by running a worker per CPU, and sending jobs to them. This changes several things across the codebase: * Ability to not cache things related to pages other than the 'main' page (i.e. the page at the bottom of the execution stack). * Decouple the baking process from the bake records, so only the main process keeps track (and modifies) the bake record. * Remove the need for 'batch page getters' and loading a page directly from the page factories. There are various smaller changes too included here, including support for scope performance timers that are saved with the bake record and can be printed out to the console. Yes I got carried away. For testing, the in-memory 'mock' file-system doesn't work anymore, since we're spawning processes, so this is replaced by a 'tmpfs' file-system which is saved in temporary files on disk and deleted after tests have run.
author Ludovic Chabant <ludovic@chabant.com>
date Fri, 12 Jun 2015 17:09:19 -0700
parents 869a206facd5
children 0e9a94b7fdfa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
f485ba500df3 Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
1
f485ba500df3 Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
2 CACHE_DIR = '_cache'
36
485682a6de50 New site layout support.
Ludovic Chabant <ludovic@chabant.com>
parents: 3
diff changeset
3 ASSETS_DIR = 'assets'
485682a6de50 New site layout support.
Ludovic Chabant <ludovic@chabant.com>
parents: 3
diff changeset
4 TEMPLATES_DIR = 'templates'
485682a6de50 New site layout support.
Ludovic Chabant <ludovic@chabant.com>
parents: 3
diff changeset
5 THEME_DIR = 'theme'
3
f485ba500df3 Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
6
36
485682a6de50 New site layout support.
Ludovic Chabant <ludovic@chabant.com>
parents: 3
diff changeset
7 CONFIG_PATH = 'config.yml'
485682a6de50 New site layout support.
Ludovic Chabant <ludovic@chabant.com>
parents: 3
diff changeset
8 THEME_CONFIG_PATH = 'theme_config.yml'
273
d70a4adb61dd themes: Add the `chef themes` command
Ludovic Chabant <ludovic@chabant.com>
parents: 100
diff changeset
9 THEME_INFO_PATH = 'theme_info.yml'
3
f485ba500df3 Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
10
f485ba500df3 Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
11 DEFAULT_FORMAT = 'markdown'
f485ba500df3 Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
12 DEFAULT_TEMPLATE_ENGINE = 'jinja2'
f485ba500df3 Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
13 DEFAULT_POSTS_FS = 'flat'
f485ba500df3 Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
14 DEFAULT_DATE_FORMAT = '%b %d, %Y'
f485ba500df3 Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
15 DEFAULT_THEME_SOURCE = 'http://bitbucket.org/ludovicchabant/'
f485ba500df3 Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
16
f485ba500df3 Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
17 PIECRUST_URL = 'http://bolt80.com/piecrust/'
f485ba500df3 Gigantic change to basically make PieCrust 2 vaguely functional.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
18
69
cb1ed436642c Always use version generated by `setup.py`. Better version generation.
Ludovic Chabant <ludovic@chabant.com>
parents: 36
diff changeset
19 try:
cb1ed436642c Always use version generated by `setup.py`. Better version generation.
Ludovic Chabant <ludovic@chabant.com>
parents: 36
diff changeset
20 from piecrust.__version__ import APP_VERSION
cb1ed436642c Always use version generated by `setup.py`. Better version generation.
Ludovic Chabant <ludovic@chabant.com>
parents: 36
diff changeset
21 except ImportError:
cb1ed436642c Always use version generated by `setup.py`. Better version generation.
Ludovic Chabant <ludovic@chabant.com>
parents: 36
diff changeset
22 APP_VERSION = 'unknown'
cb1ed436642c Always use version generated by `setup.py`. Better version generation.
Ludovic Chabant <ludovic@chabant.com>
parents: 36
diff changeset
23
100
69d5eecfa449 Better `prepare` command, with templates and help topics.
Ludovic Chabant <ludovic@chabant.com>
parents: 69
diff changeset
24 import os.path
69d5eecfa449 Better `prepare` command, with templates and help topics.
Ludovic Chabant <ludovic@chabant.com>
parents: 69
diff changeset
25 RESOURCES_DIR = os.path.join(os.path.dirname(__file__), 'resources')
69d5eecfa449 Better `prepare` command, with templates and help topics.
Ludovic Chabant <ludovic@chabant.com>
parents: 69
diff changeset
26