blurry-cli 0.9.1__tar.gz → 0.11.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. {blurry_cli-0.9.1 → blurry_cli-0.11.0}/PKG-INFO +6 -4
  2. {blurry_cli-0.9.1 → blurry_cli-0.11.0}/README.md +1 -0
  3. {blurry_cli-0.9.1 → blurry_cli-0.11.0}/blurry/__init__.py +25 -3
  4. {blurry_cli-0.9.1 → blurry_cli-0.11.0}/blurry/templates.py +13 -2
  5. {blurry_cli-0.9.1 → blurry_cli-0.11.0}/pyproject.toml +5 -4
  6. {blurry_cli-0.9.1 → blurry_cli-0.11.0}/LICENSE +0 -0
  7. {blurry_cli-0.9.1 → blurry_cli-0.11.0}/blurry/__main__.py +0 -0
  8. {blurry_cli-0.9.1 → blurry_cli-0.11.0}/blurry/async_typer.py +0 -0
  9. {blurry_cli-0.9.1 → blurry_cli-0.11.0}/blurry/cli.py +0 -0
  10. {blurry_cli-0.9.1 → blurry_cli-0.11.0}/blurry/constants.py +0 -0
  11. {blurry_cli-0.9.1 → blurry_cli-0.11.0}/blurry/images.py +0 -0
  12. {blurry_cli-0.9.1 → blurry_cli-0.11.0}/blurry/markdown/__init__.py +0 -0
  13. {blurry_cli-0.9.1 → blurry_cli-0.11.0}/blurry/markdown/front_matter.py +0 -0
  14. {blurry_cli-0.9.1 → blurry_cli-0.11.0}/blurry/markdown/renderer_functions/__init__.py +0 -0
  15. {blurry_cli-0.9.1 → blurry_cli-0.11.0}/blurry/markdown/renderer_functions/render_video.py +0 -0
  16. {blurry_cli-0.9.1 → blurry_cli-0.11.0}/blurry/open_graph.py +0 -0
  17. {blurry_cli-0.9.1 → blurry_cli-0.11.0}/blurry/plugins/__init__.py +0 -0
  18. {blurry_cli-0.9.1 → blurry_cli-0.11.0}/blurry/plugins/html_plugins/__init__.py +0 -0
  19. {blurry_cli-0.9.1 → blurry_cli-0.11.0}/blurry/plugins/html_plugins/minify_html_plugin.py +0 -0
  20. {blurry_cli-0.9.1 → blurry_cli-0.11.0}/blurry/plugins/jinja_plugins/__init__.py +0 -0
  21. {blurry_cli-0.9.1 → blurry_cli-0.11.0}/blurry/plugins/jinja_plugins/blurry_image_extension.py +0 -0
  22. {blurry_cli-0.9.1 → blurry_cli-0.11.0}/blurry/plugins/markdown_plugins/__init__.py +0 -0
  23. {blurry_cli-0.9.1 → blurry_cli-0.11.0}/blurry/plugins/markdown_plugins/container_plugin.py +0 -0
  24. {blurry_cli-0.9.1 → blurry_cli-0.11.0}/blurry/plugins/markdown_plugins/punctuation_plugin.py +0 -0
  25. {blurry_cli-0.9.1 → blurry_cli-0.11.0}/blurry/plugins/markdown_plugins/python_code_plugin.py +0 -0
  26. {blurry_cli-0.9.1 → blurry_cli-0.11.0}/blurry/py.typed +0 -0
  27. {blurry_cli-0.9.1 → blurry_cli-0.11.0}/blurry/schema_validation.py +0 -0
  28. {blurry_cli-0.9.1 → blurry_cli-0.11.0}/blurry/settings.py +0 -0
  29. {blurry_cli-0.9.1 → blurry_cli-0.11.0}/blurry/sitemap.py +0 -0
  30. {blurry_cli-0.9.1 → blurry_cli-0.11.0}/blurry/types.py +0 -0
  31. {blurry_cli-0.9.1 → blurry_cli-0.11.0}/blurry/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: blurry-cli
3
- Version: 0.9.1
3
+ Version: 0.11.0
4
4
  Summary: A Mistune-based static site generator for Python
5
5
  Home-page: https://github.com/blurry-dev/blurry
6
6
  License: MIT
@@ -28,11 +28,12 @@ Requires-Dist: dpath (>=2.1.6,<3.0.0)
28
28
  Requires-Dist: ffmpeg-python (>=0.2.0,<0.3.0)
29
29
  Requires-Dist: htmlmin2 (>=0.1.13,<0.2.0)
30
30
  Requires-Dist: jinja2-simple-tags (>=0.6.1,<0.7.0)
31
- Requires-Dist: livereload (>=2.6.3,<3.0.0)
32
- Requires-Dist: mistune (>=3.0.0rc5,<4.0.0)
31
+ Requires-Dist: jinjax (>=0.48,<0.49)
32
+ Requires-Dist: livereload (>=2.7.0,<3.0.0)
33
+ Requires-Dist: mistune (>=3.0.2,<4.0.0)
33
34
  Requires-Dist: pydantic2-schemaorg (>=0.2.0,<0.3.0)
34
35
  Requires-Dist: rich (>=13.3.3,<14.0.0)
35
- Requires-Dist: selectolax (>=0.3.6,<0.4.0)
36
+ Requires-Dist: selectolax (>=0.3.27,<0.4.0)
36
37
  Requires-Dist: toml (>=0.10.2,<0.11.0)
37
38
  Requires-Dist: typer (>=0.6.1,<0.7.0)
38
39
  Project-URL: Repository, https://github.com/blurry-dev/blurry
@@ -71,6 +72,7 @@ Blurry blends together high-quality libraries:
71
72
 
72
73
  - [Mistune](https://mistune.readthedocs.io/) to convert Markdown to HTML
73
74
  - [Jinja](https://jinja.palletsprojects.com/) for HTML templating
75
+ - [JinjaX](https://jinjax.scaletti.dev/) for Jinja components
74
76
  - [LiveReload](https://livereload.readthedocs.io/) for an HTTP server with automatic browser reloading
75
77
  - [Typer](https://typer.tiangolo.com/) for its CLI interface
76
78
  - [ImageMagick](https://imagemagick.org/index.php) to resize and convert images
@@ -31,6 +31,7 @@ Blurry blends together high-quality libraries:
31
31
 
32
32
  - [Mistune](https://mistune.readthedocs.io/) to convert Markdown to HTML
33
33
  - [Jinja](https://jinja.palletsprojects.com/) for HTML templating
34
+ - [JinjaX](https://jinjax.scaletti.dev/) for Jinja components
34
35
  - [LiveReload](https://livereload.readthedocs.io/) for an HTTP server with automatic browser reloading
35
36
  - [Typer](https://typer.tiangolo.com/) for its CLI interface
36
37
  - [ImageMagick](https://imagemagick.org/index.php) to resize and convert images
@@ -1,9 +1,12 @@
1
1
  import asyncio
2
2
  import dataclasses
3
+ import importlib
3
4
  import json
4
5
  import mimetypes
5
6
  import os
7
+ import pkgutil
6
8
  import shutil
9
+ import sys
7
10
  from collections.abc import Coroutine
8
11
  from copy import deepcopy
9
12
  from datetime import datetime
@@ -47,9 +50,6 @@ def json_converter_with_dates(item: Any) -> None | str:
47
50
 
48
51
  warning_console = Console(stderr=True, style="bold yellow")
49
52
 
50
- print_blurry_name()
51
- print_plugin_table()
52
-
53
53
 
54
54
  app = AsyncTyper()
55
55
 
@@ -157,6 +157,10 @@ async def write_html_file(
157
157
  @app.async_command()
158
158
  async def build(release=True):
159
159
  """Generates HTML content from Markdown files."""
160
+
161
+ print_blurry_name()
162
+ print_plugin_table()
163
+
160
164
  update_settings()
161
165
  jinja_env = get_jinja_env()
162
166
  os.environ.setdefault(f"{ENV_VAR_PREFIX}BUILD_MODE", "prod" if release else "dev")
@@ -230,6 +234,20 @@ async def build_development():
230
234
  await build(release=False)
231
235
 
232
236
 
237
+ async def reload_local_plugins_and_build():
238
+ """Reloads a project's local modules and performs a dev build"""
239
+ cwd = str(Path.cwd())
240
+
241
+ for _, package_name, _ in pkgutil.iter_modules([cwd]):
242
+ try:
243
+ module = sys.modules[package_name]
244
+ except KeyError:
245
+ continue
246
+ importlib.reload(module)
247
+
248
+ await build_development()
249
+
250
+
233
251
  @app.command()
234
252
  def runserver():
235
253
  """Starts HTTP server with live reloading."""
@@ -250,6 +268,10 @@ def runserver():
250
268
  f"{SETTINGS['TEMPLATES_DIRECTORY_NAME']}/**/*",
251
269
  lambda: event_loop.create_task(build_development()),
252
270
  )
271
+ livereload_server.watch(
272
+ "./**/*.py",
273
+ lambda: event_loop.create_task(reload_local_plugins_and_build()),
274
+ )
253
275
  livereload_server.watch(
254
276
  "blurry.toml", lambda: event_loop.create_task(build_development())
255
277
  )
@@ -1,15 +1,21 @@
1
+ import jinjax
1
2
  from jinja2 import Environment
2
3
  from jinja2 import FileSystemLoader
3
4
  from jinja2 import select_autoescape
5
+
4
6
  from blurry.plugins import discovered_jinja_extensions
5
7
  from blurry.plugins import discovered_jinja_filter_plugins
6
8
  from blurry.settings import get_templates_directory
7
9
  from blurry.settings import SETTINGS
8
10
 
9
11
 
10
- def get_jinja_env():
12
+ def get_jinja_env() -> Environment:
13
+ """
14
+ Returns a Jinja environment complete with JinjaX and any installed Jinja extensions and filters.
15
+ """
16
+ templates_directory = get_templates_directory()
11
17
  jinja_env = Environment(
12
- loader=FileSystemLoader(get_templates_directory()),
18
+ loader=FileSystemLoader(templates_directory),
13
19
  autoescape=select_autoescape(
14
20
  list(
15
21
  {
@@ -31,4 +37,9 @@ def get_jinja_env():
31
37
  f"Could not load Jinja filter plugin: {filter_plugin.name}. "
32
38
  "Possibly because {filter_plugin.value} is not a valid object reference."
33
39
  )
40
+
41
+ jinja_env.add_extension(jinjax.JinjaX)
42
+ catalog = jinjax.Catalog(jinja_env=jinja_env)
43
+ catalog.add_folder(templates_directory / "components")
44
+
34
45
  return jinja_env
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "blurry-cli"
3
- version = "0.9.1"
3
+ version = "0.11.0"
4
4
  description = "A Mistune-based static site generator for Python"
5
5
  authors = ["John Franey <franey@duck.com>"]
6
6
  license = "MIT"
@@ -28,17 +28,18 @@ Jinja2 = "^3.0.0"
28
28
  PyLD = "^2.0.3"
29
29
  Wand = "^0.6.6"
30
30
  ffmpeg-python = "^0.2.0"
31
- livereload = "^2.6.3"
32
- mistune = "^3.0.0rc5"
31
+ livereload = "^2.7.0"
32
+ mistune = "^3.0.2"
33
33
  python = "^3.10"
34
34
  rich = "^13.3.3"
35
- selectolax = "^0.3.6"
35
+ selectolax = "^0.3.27"
36
36
  toml = "^0.10.2"
37
37
  typer = "^0.6.1"
38
38
  htmlmin2 = "^0.1.13"
39
39
  pydantic2-schemaorg = "^0.2.0"
40
40
  dpath = "^2.1.6"
41
41
  jinja2-simple-tags = "^0.6.1"
42
+ jinjax = "^0.48"
42
43
 
43
44
  [tool.poetry.scripts]
44
45
  blurry = 'blurry:main'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes