Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ Instructions: Add a subsection under `[Unreleased]` for additions, fixes, change

### Changed

- Template devcontainer will now use versioned docker image
- Template devcontainer will now use versioned docker image.
- The `pretext upgrade` command will include prefigure and pelican if they are already installed.

### Fixed

Expand Down
88 changes: 16 additions & 72 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 20 additions & 4 deletions pretext/cli.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import importlib
import logging
import logging.handlers
import sys
Expand All @@ -17,7 +18,6 @@
from typing import Any, Callable, List, Literal, Optional
from functools import update_wrapper


from . import (
utils,
resources,
Expand Down Expand Up @@ -195,10 +195,26 @@ def upgrade() -> None:
"""
Upgrade PreTeXt-CLI to the latest version using pip.
"""
log.info("Upgrading PreTeXt-CLI...")
subprocess.run([sys.executable, "-m", "pip", "install", "--upgrade", "pretext"])
extras = []
if importlib.util.find_spec("prefig") is not None:
log.debug(
"The 'prefig' package is installed; will attempt to upgrade it as well."
)
extras.append("prefigure")
if importlib.util.find_spec("pelican") is not None:
log.debug(
"The 'pelican' package is installed; will attempt to upgrade it as well."
)
extras.append("homepage")
if len(extras) > 0:
log.info(f"Upgrading PreTeXt (with extras: {', '.join(extras)})")
pretext_cmd = "pretext[" + ",".join(extras) + "]"
else:
log.info("Upgrading PreTeXt.")
pretext_cmd = "pretext"
subprocess.run([sys.executable, "-m", "pip", "install", "--upgrade", pretext_cmd])
log.info(
"Upgrade complete. Individual projects can be updated to align with the latest version of the CLI with `pretext update` from their project folder."
"Upgrade complete. Individual projects can be updated to align with the latest version of the CLI by running `pretext update` from their project folder."
)


Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ click-log = "^0.4"
ghp-import = "^2"
single-version = "^1"
playwright = "^1"
pydantic-xml = ">=2"
pydantic-xml = "2.14.3"
qrcode = "^7"
psutil = "^7"
plastex = "^3"
jinja2 = "^3"
coloraide = "^4"
pelican = { extras = ["markdown"], version = "^4.10", optional = true }
prefig = { extras = ["text"], version = "^0.3.2", optional = true }
prefig = { extras = ["text"], version = "^0.3.6", optional = true }


# Development dependencies
Expand Down