diff --git a/CHANGELOG.md b/CHANGELOG.md index 4452f64c..bd02ab27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ Instructions: Add a subsection under `[Unreleased]` for additions, fixes, change ### Changed +- NEW BEHAVIOR: the `pretext build -g` command will not use cached versions of assets when regenerating. You can still generate assets and use the cache with `pretext generate`. - Improve default settings in codespace settings. ## [2.24.0] - 2025-07-21 diff --git a/docs/asset-generation.md b/docs/asset-generation.md index d4df2e99..f47d50f6 100644 --- a/docs/asset-generation.md +++ b/docs/asset-generation.md @@ -26,22 +26,24 @@ However, for select assets (currently `asymptote`, `latex-image`, `prefigure`, a 2. If the software to generate assets is improved (which happens with `prefigure` assets, for example), the user will not get new versions of these assets (assuming no changes are made to source). +3. Sometimes a generated asset will pull in external data, such as a `latex-image` that includes an external `.png`, or a `prefigure` diagram that uses an external data file. The hash only knows about the code in the original asset, so changing the external import will not change the hash. + ## User Interface Assets are generated (sometimes using the cache, sometimes skipping it) depending on what CLI command a user enters. - `pretext build`. Assets will be generated only if the source has changed inside that asset type, and cached output will be copied if present. -- `pretext build -g` (`pretext build --generate`). For each asset type in source, we will request it be generated by core regardless of whether the source has changed. Will copy cached versions of assets where possible. -- `pretext build -q` (`pretext build --no-generate`). No assets will be generated (or copied from cache), even if source has changed (or hasn't been successfully generated before). -- `pretext generate`. Assets of all, or specified, types will be generated, even if source has changed. Cached versions of individual assets will be copied if possible (CHANGE?). Identical to `pretext build -g` except it allows to limit by asset type and doesn't call build. +- `pretext build -g` (`pretext build --generate`). For each asset type in source, we will request it be generated by core regardless of whether the source has changed. Will also regenerate any assets in the cache. Equivalent to running `pretext generate -f` followed by `pretext build`. +- `pretext build -q` (`pretext build --no-generate`). No assets will be generated (or copied from cache), even if source has changed (or hasn't been successfully generated before). Intended for building quickly and to avoid errors coming from missing executables (if you want to still see the non-asset parts of the document). +- `pretext generate`. Assets of all, or specified, types will be generated, even if source has changed. Cached versions of individual assets will be copied if possible. Allows to limit by asset type and doesn't call build. - `pretext generate -q` (`pretext generate --only-changed`). Limit generation of assets to only those that have changed since last call to generate. Same as `pretext build` except you don't do a build, just generate assets, and can limit to asset type. -- `pretext generate -f` (`pretext generate --force`). Generates all assets, even if source has not changed, and does NOT copy assets from cache even if available. +- `pretext generate -f` (`pretext generate --force`). Generates all assets, even if source has not changed, and does NOT copy assets from cache even if available (they will be updated). Same behavior as `pretext build -g`, except you don't do a build, just generate assets, and can limit to asset type. There is also a `pretext generate --clean` that deletes the .cache directory. ### Consequences -To avoid pitfall number 1, run `pretext build -g`. +To avoid pitfall number 1, run `pretext generate`. -To avoid pitfall number 2, run `pretext generate -f`. +To avoid pitfall numbers 2 or 3, run `pretext build -g` or `pretext generate -f`. diff --git a/pretext/__init__.py b/pretext/__init__.py index e9d7e766..dcf218f0 100644 --- a/pretext/__init__.py +++ b/pretext/__init__.py @@ -19,7 +19,7 @@ VERSION = get_version("pretext", Path(__file__).parent.parent) -CORE_COMMIT = "32262dda4922a4535bcfb10fe1c66b50c51337ac" +CORE_COMMIT = "45be2cfe85fd54a3e5c03743226919eb1a6b2085" def activate() -> None: diff --git a/pretext/cli.py b/pretext/cli.py index 1d7114a7..652f3f0f 100644 --- a/pretext/cli.py +++ b/pretext/cli.py @@ -606,7 +606,9 @@ def build( try: for t in targets: log.info(f"Generating assets for {t.name}") - t.generate_assets(only_changed=False, xmlid=xmlid, clean=clean) + t.generate_assets( + only_changed=False, xmlid=xmlid, clean=clean, skip_cache=True + ) no_generate = True except Exception as e: log.error(f"Failed to generate assets: {e} \n")