Skip to content

Commit

Permalink
Add FrameworkError Message if Yaml/Jinja2 are Missing
Browse files Browse the repository at this point in the history
  • Loading branch information
derks committed Nov 10, 2024
1 parent b617f7f commit 786b592
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
22 changes: 18 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

Bugs:

- ?
- None


Features:

- ?
- None


Refactoring:
Expand Down Expand Up @@ -73,12 +73,13 @@ Refactoring:

Misc:

- ?
- [cli] Move CLI dependencies to `cement[cli]` extras package, and remove included/nexted `contrib` sources. See note on 'Potential Upgrade Incompatibility'
- [Issue #679](https://github.com/datafolklabs/cement/issues/679)


Deprecations:

- ?
- None


Special Recognitions:
Expand All @@ -88,6 +89,19 @@ Many thanks to [@sigma67](https://github.com/sigma67) for their contributions in
Many thanks to [@rednar](https://github.com/rednar) for their contributions toward adding type annotations in [PR #628](https://github.com/datafolklabs/cement/pull/628). This PR was too large to merge directly, but it is serving as a guide to finally begin work toward adding type annotations to Cement. This was a massive effort, and is very helpful to have this work available to guide the effort even if it will not be merged directly.


Potential Upgrade Incompatibility:

This update removes included `contrib` libraries that are dependencies for the `cement` command line tool to function (PyYAML, and Jinja2). The dependencies are now included via the `cement[cli]` extras package.

This is not an upgrade incompatibility in the core Cement code, and it would not affect any applications that are built on Cement. That said, it does have the potential to break any automation or other uses of the `cement` command line tool.

Resolution:

```
pip install cement[cli]
```


## 3.0.10 - Feb 28, 2024

Bugs:
Expand Down
7 changes: 7 additions & 0 deletions cement/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from typing import Optional, List
from cement import App, CaughtSignal # noqa: E402
from .controllers.base import Base # noqa: E402
from cement.core.exc import FrameworkError


class CementApp(App):
Expand Down Expand Up @@ -33,6 +34,12 @@ class Meta:


def main(argv: Optional[List[str]] = None) -> None:
# Issue #679: https://github.com/datafolklabs/cement/issues/679
try:
import yaml, jinja2
except ModuleNotFoundError as e:
raise FrameworkError('Cement CLI Dependencies are missing! Install cement[cli] extras package to resolve -> pip install cement[cli]')

with CementApp() as app:
try:
app.run()
Expand Down

0 comments on commit 786b592

Please sign in to comment.