summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Mayer <entroP@gmail.com>2021-04-21 09:51:06 +0200
committerJustin Mayer <entroP@gmail.com>2021-04-21 10:16:59 +0200
commit40f3d2df91e847ccbc64d015fe837650055b67bd (patch)
tree4620f765d2d9019d8187bdb593d6e66b29039309
parent14afc6c54a7e361bbc465fdc25511831cce29812 (diff)
downloadpelican-rich.tar.gz
Add progress spinner animation during generationrich
This is a first step at enriching console output via the `rich` project.
-rw-r--r--pelican/__init__.py6
-rw-r--r--pyproject.toml1
-rwxr-xr-xsetup.py2
3 files changed, 7 insertions, 2 deletions
diff --git a/pelican/__init__.py b/pelican/__init__.py
index cb91eb59..6302fe21 100644
--- a/pelican/__init__.py
+++ b/pelican/__init__.py
@@ -13,6 +13,8 @@ from collections.abc import Iterable
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
+from rich.console import Console
+
# pelican.log has to be the first pelican module to be loaded
# because logging.setLoggerClass has to be called before logging.getLogger
from pelican.log import init as init_logging
@@ -35,6 +37,7 @@ except Exception:
DEFAULT_CONFIG_NAME = 'pelicanconf.py'
logger = logging.getLogger(__name__)
+console = Console()
class Pelican:
@@ -524,7 +527,8 @@ def main(argv=None):
else:
watcher = FileSystemWatcher(args.settings, Readers, settings)
watcher.check()
- pelican.run()
+ with console.status("Generating..."):
+ pelican.run()
except KeyboardInterrupt:
logger.warning('Keyboard interrupt received. Exiting.')
except Exception as e:
diff --git a/pyproject.toml b/pyproject.toml
index 32dd56e3..99b1d5d4 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -38,6 +38,7 @@ jinja2 = ">=2.7"
pygments = ">=2.6"
python-dateutil = ">=2.8"
pytz = ">=2020.1"
+rich = ">=10.1"
unidecode = ">=1.1"
markdown = {version = ">=3.1", optional = true}
diff --git a/setup.py b/setup.py
index 0f991daf..5ffd0fdf 100755
--- a/setup.py
+++ b/setup.py
@@ -10,7 +10,7 @@ version = "4.6.0"
requires = ['feedgenerator >= 1.9', 'jinja2 >= 2.7', 'pygments',
'docutils>=0.15', 'pytz >= 0a', 'blinker', 'unidecode',
- 'python-dateutil']
+ 'python-dateutil', 'rich']
entry_points = {
'console_scripts': [