blurry-cli 0.14.0__tar.gz → 0.16.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 (40) hide show
  1. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/PKG-INFO +4 -4
  2. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/__init__.py +10 -4
  3. blurry_cli-0.16.0/blurry/commands/version.py +9 -0
  4. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/file_processors/__init__.py +3 -1
  5. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/images.py +6 -6
  6. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/markdown/__init__.py +4 -2
  7. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/schema_validation/__init__.py +2 -1
  8. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/settings.py +18 -1
  9. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/templates.py +2 -1
  10. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/utils.py +2 -1
  11. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/pyproject.toml +10 -7
  12. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/LICENSE +0 -0
  13. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/README.md +0 -0
  14. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/__main__.py +0 -0
  15. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/async_typer.py +0 -0
  16. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/cli.py +0 -0
  17. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/commands/__init__.py +0 -0
  18. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/commands/clean.py +0 -0
  19. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/commands/init.py +0 -0
  20. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/constants.py +0 -0
  21. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/gather_file_data_by_directory.py +0 -0
  22. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/markdown/front_matter.py +0 -0
  23. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/markdown/renderer_functions/__init__.py +0 -0
  24. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/markdown/renderer_functions/render_video.py +0 -0
  25. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/open_graph.py +0 -0
  26. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/plugins/__init__.py +0 -0
  27. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/plugins/html_plugins/__init__.py +0 -0
  28. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/plugins/html_plugins/minify_html_plugin.py +0 -0
  29. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/plugins/jinja_plugins/__init__.py +0 -0
  30. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/plugins/jinja_plugins/blurry_image_extension.py +0 -0
  31. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/plugins/jinja_plugins/filters.py +0 -0
  32. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/plugins/markdown_plugins/__init__.py +0 -0
  33. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/plugins/markdown_plugins/container_plugin.py +0 -0
  34. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/plugins/markdown_plugins/punctuation_plugin.py +0 -0
  35. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/plugins/markdown_plugins/python_code_plugin.py +0 -0
  36. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/py.typed +0 -0
  37. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/runserver_handlers.py +0 -0
  38. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/schema_validation/models.py +0 -0
  39. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/sitemap.py +0 -0
  40. {blurry_cli-0.14.0 → blurry_cli-0.16.0}/blurry/types.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: blurry-cli
3
- Version: 0.14.0
3
+ Version: 0.16.0
4
4
  Summary: A Mistune-based static site generator for Python
5
5
  License: MIT
6
6
  Keywords: static-site-generator,seo,pagespeed
@@ -26,13 +26,13 @@ Requires-Dist: dpath (>=2.2.0,<3.0.0)
26
26
  Requires-Dist: ffmpeg-python (>=0.2.0,<0.3.0)
27
27
  Requires-Dist: htmlmin2 (>=0.1.13,<0.2.0)
28
28
  Requires-Dist: jinja2-simple-tags (>=0.6.1,<0.7.0)
29
- Requires-Dist: jinjax (>=0.48,<0.49)
29
+ Requires-Dist: jinjax (>=0.48,<0.58)
30
30
  Requires-Dist: livereload (>=2.7.1,<3.0.0)
31
31
  Requires-Dist: mistune (>=3.1.0,<4.0.0)
32
32
  Requires-Dist: pydantic (>=2.10.5,<3.0.0)
33
- Requires-Dist: rich (>=13.9.4,<14.0.0)
33
+ Requires-Dist: rich (>=13.9.4,<15.0.0)
34
34
  Requires-Dist: selectolax (>=0.3.27,<0.4.0)
35
- Requires-Dist: typer (>=0.15.1,<0.16.0)
35
+ Requires-Dist: typer (>=0.15.1,<0.17.0)
36
36
  Project-URL: Repository, https://github.com/blurry-dev/blurry
37
37
  Description-Content-Type: text/markdown
38
38
 
@@ -20,6 +20,7 @@ from blurry.cli import print_blurry_name
20
20
  from blurry.cli import print_plugin_table
21
21
  from blurry.commands.clean import clean_build_directory
22
22
  from blurry.commands.init import initialize_new_project
23
+ from blurry.commands.version import print_blurry_version
23
24
  from blurry.constants import ENV_VAR_PREFIX
24
25
  from blurry.file_processors import process_non_markdown_file
25
26
  from blurry.file_processors import write_html_file
@@ -29,7 +30,7 @@ from blurry.runserver_handlers import handle_changed_markdown_files
29
30
  from blurry.runserver_handlers import rebuild_markdown_files
30
31
  from blurry.settings import get_build_directory
31
32
  from blurry.settings import get_content_directory
32
- from blurry.settings import SETTINGS
33
+ from blurry.settings import get_settings
33
34
  from blurry.settings import update_settings
34
35
  from blurry.sitemap import write_sitemap_file
35
36
  from blurry.templates import get_jinja_env
@@ -38,7 +39,7 @@ from blurry.templates import get_jinja_env
38
39
  warning_console = Console(stderr=True, style="bold yellow")
39
40
 
40
41
 
41
- app = AsyncTyper()
42
+ app = AsyncTyper(no_args_is_help=True)
42
43
 
43
44
 
44
45
  @app.command(name="clean")
@@ -51,16 +52,21 @@ def init_command(name: str | None = None, domain: str | None = None):
51
52
  initialize_new_project(name, domain)
52
53
 
53
54
 
55
+ @app.command(name="version")
56
+ def version_command():
57
+ print_blurry_version()
58
+
59
+
54
60
  @app.async_command()
55
61
  async def build(release=True, clean: bool = False):
56
62
  """Generates HTML content from Markdown files."""
57
63
  start = datetime.now()
58
64
 
59
65
  if release:
66
+ update_settings()
60
67
  print_blurry_name()
61
68
  print_plugin_table()
62
69
 
63
- update_settings()
64
70
  build_directory = get_build_directory()
65
71
 
66
72
  if clean:
@@ -159,7 +165,7 @@ def runserver():
159
165
  print_blurry_name()
160
166
  print_plugin_table()
161
167
 
162
- update_settings()
168
+ SETTINGS = get_settings()
163
169
  os.environ.setdefault(f"{ENV_VAR_PREFIX}BUILD_MODE", "dev")
164
170
 
165
171
  SETTINGS["RUNSERVER"] = True
@@ -0,0 +1,9 @@
1
+ import importlib.metadata
2
+ from rich import print
3
+
4
+
5
+ def print_blurry_version():
6
+ """Prints the current Blurry version."""
7
+ version = importlib.metadata.version("blurry-cli")
8
+
9
+ print(f"v{version}")
@@ -17,7 +17,7 @@ from blurry.plugins import discovered_html_plugins
17
17
  from blurry.schema_validation import validate_front_matter_as_schema
18
18
  from blurry.settings import get_build_directory
19
19
  from blurry.settings import get_content_directory
20
- from blurry.settings import SETTINGS
20
+ from blurry.settings import get_settings
21
21
  from blurry.types import MarkdownFileData
22
22
  from blurry.types import TemplateContext
23
23
  from blurry.utils import content_path_to_url
@@ -56,6 +56,7 @@ def process_non_markdown_file(
56
56
 
57
57
 
58
58
  def process_jinja_file(filepath: Path, jinja_env: Environment, file_data_by_directory):
59
+ SETTINGS = get_settings()
59
60
  build_directory = get_build_directory()
60
61
  content_directory = get_content_directory()
61
62
  template = jinja_env.get_template(str(filepath.relative_to(content_directory)))
@@ -87,6 +88,7 @@ def write_html_file(
87
88
  release: bool,
88
89
  jinja_env: Environment,
89
90
  ):
91
+ SETTINGS = get_settings()
90
92
  extra_context: TemplateContext = {}
91
93
  # Gather data from other files in this directory if this is an index file
92
94
  file_data_list = file_data_by_directory[filepath.parent]
@@ -6,12 +6,11 @@ from wand.image import Image
6
6
 
7
7
  from blurry.settings import get_build_directory
8
8
  from blurry.settings import get_content_directory
9
- from blurry.settings import SETTINGS
10
- from blurry.settings import update_settings
9
+ from blurry.settings import get_settings
11
10
 
12
11
 
13
12
  def get_target_image_widths():
14
- update_settings()
13
+ SETTINGS = get_settings()
15
14
  IMAGE_WIDTHS = SETTINGS["IMAGE_WIDTHS"]
16
15
  MAXIMUM_IMAGE_WIDTH = int(SETTINGS["MAXIMUM_IMAGE_WIDTH"])
17
16
  THUMBNAIL_WIDTH = int(SETTINGS["THUMBNAIL_WIDTH"])
@@ -32,6 +31,7 @@ def add_image_width_to_path(image_path: Path, width: int) -> Path:
32
31
 
33
32
 
34
33
  def convert_image_to_avif(image_path: Path, target_path: Path | None = None):
34
+ SETTINGS = get_settings()
35
35
  AVIF_COMPRESSION_QUALITY = SETTINGS["AVIF_COMPRESSION_QUALITY"]
36
36
  image_suffix = image_path.suffix
37
37
  avif_filepath = str(target_path or image_path).replace(image_suffix, ".avif")
@@ -78,9 +78,9 @@ async def generate_images_for_srcset(image_path: Path):
78
78
  resized_original_image_type_future = executor.submit(
79
79
  clone_and_resize_image, image_path, target_width, new_filepath_in_build
80
80
  )
81
- resize_future_to_filepath[
82
- resized_original_image_type_future
83
- ] = new_filepath_in_build
81
+ resize_future_to_filepath[resized_original_image_type_future] = (
82
+ new_filepath_in_build
83
+ )
84
84
 
85
85
  # Create AVIF versions of resized images as they're ready
86
86
  for future in concurrent.futures.as_completed(resize_future_to_filepath):
@@ -25,7 +25,7 @@ from blurry.images import get_widths_for_image_width
25
25
  from blurry.plugins import discovered_markdown_plugins
26
26
  from blurry.plugins.jinja_plugins.filters import slugify
27
27
  from blurry.settings import get_content_directory
28
- from blurry.settings import SETTINGS
28
+ from blurry.settings import get_settings
29
29
  from blurry.types import is_str
30
30
  from blurry.utils import content_path_to_url
31
31
  from blurry.utils import convert_relative_path_in_markdown_file_to_pathname
@@ -36,6 +36,8 @@ from blurry.utils import resolve_relative_path_in_markdown
36
36
  # https://schema.org/ImageObject
37
37
  ImageObject: TypeAlias = dict
38
38
 
39
+ SETTINGS = get_settings()
40
+
39
41
 
40
42
  class BlurryRenderer(mistune.HTMLRenderer):
41
43
  """Renderer that converts relative content URLs to build URLs."""
@@ -105,7 +107,7 @@ class BlurryRenderer(mistune.HTMLRenderer):
105
107
  return (
106
108
  f"<figure>"
107
109
  f"<picture>{source_tag}<img {attributes_str}></picture>"
108
- f'<figcaption>{attributes["alt"]}</figcaption>'
110
+ f"<figcaption>{attributes['alt']}</figcaption>"
109
111
  f"</figure>"
110
112
  )
111
113
 
@@ -5,7 +5,7 @@ from pydantic import ValidationError
5
5
  from rich.console import Console
6
6
 
7
7
  from blurry.schema_validation import models
8
- from blurry.settings import SETTINGS
8
+ from blurry.settings import get_settings
9
9
 
10
10
 
11
11
  def validate_front_matter_as_schema(
@@ -15,6 +15,7 @@ def validate_front_matter_as_schema(
15
15
  Validates schema data using partial Schema.org types based on Google's support for them:
16
16
  https://developers.google.com/search/docs/appearance/structured-data/search-gallery
17
17
  """
18
+ SETTINGS = get_settings()
18
19
  schematype = schema_variables["@type"]
19
20
 
20
21
  if mapped_schematype_ := SETTINGS["TEMPLATE_SCHEMA_TYPES"].get(schematype):
@@ -48,7 +48,7 @@ SETTINGS: Settings = {
48
48
  }
49
49
 
50
50
 
51
- def update_settings():
51
+ def update_settings() -> Settings:
52
52
  try:
53
53
  blurry_config = tomllib.load(open(SETTINGS_FILENAME, "rb"))
54
54
  user_settings = blurry_config["blurry"]
@@ -64,6 +64,23 @@ def update_settings():
64
64
  settings_key = key[setting_name_start_index:]
65
65
  SETTINGS[settings_key] = value
66
66
 
67
+ return SETTINGS
68
+
69
+
70
+ class SettingsCache(TypedDict):
71
+ settings: Settings | None
72
+
73
+
74
+ settings_cache: SettingsCache = {"settings": None}
75
+
76
+
77
+ def get_settings() -> Settings:
78
+ if cached_settings := settings_cache.get("settings"):
79
+ return cached_settings
80
+ settings = update_settings()
81
+ settings_cache["settings"] = settings
82
+ return settings
83
+
67
84
 
68
85
  def get_build_directory():
69
86
  is_dev_build = environ.get(f"{ENV_VAR_PREFIX}BUILD_MODE") == "dev"
@@ -7,13 +7,14 @@ from blurry.plugins import discovered_jinja_extensions
7
7
  from blurry.plugins import discovered_jinja_filter_plugins
8
8
  from blurry.settings import get_content_directory
9
9
  from blurry.settings import get_templates_directory
10
- from blurry.settings import SETTINGS
10
+ from blurry.settings import get_settings
11
11
 
12
12
 
13
13
  def get_jinja_env() -> Environment:
14
14
  """
15
15
  Returns a Jinja environment complete with JinjaX and any installed Jinja extensions and filters.
16
16
  """
17
+ SETTINGS = get_settings()
17
18
  templates_directory = get_templates_directory()
18
19
  content_directory = get_content_directory()
19
20
  jinja_env = Environment(
@@ -2,10 +2,11 @@ from pathlib import Path
2
2
 
3
3
  from blurry.settings import get_build_directory
4
4
  from blurry.settings import get_content_directory
5
- from blurry.settings import SETTINGS
5
+ from blurry.settings import get_settings
6
6
 
7
7
 
8
8
  def get_domain_with_scheme():
9
+ SETTINGS = get_settings()
9
10
  if SETTINGS.get("RUNSERVER"):
10
11
  host = SETTINGS["DEV_HOST"]
11
12
  port = SETTINGS["DEV_PORT"]
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "blurry-cli"
3
- version = "0.14.0"
3
+ version = "0.16.0"
4
4
  description = "A Mistune-based static site generator for Python"
5
5
  authors = ["John Franey <franey@duck.com>"]
6
6
  license = "MIT"
@@ -30,25 +30,28 @@ ffmpeg-python = "^0.2.0"
30
30
  livereload = "^2.7.1"
31
31
  mistune = "^3.1.0"
32
32
  python = "^3.11"
33
- rich = "^13.9.4"
33
+ rich = ">=13.9.4,<15.0.0"
34
34
  selectolax = "^0.3.27"
35
- typer = "^0.15.1"
35
+ typer = ">=0.15.1,<0.17.0"
36
36
  htmlmin2 = "^0.1.13"
37
37
  dpath = "^2.2.0"
38
38
  jinja2-simple-tags = "^0.6.1"
39
- jinjax = "^0.48"
39
+ jinjax = ">=0.48,<0.58"
40
40
  pydantic = "^2.10.5"
41
41
 
42
42
  [tool.poetry.scripts]
43
43
  blurry = 'blurry:main'
44
44
 
45
+ [tool.poetry.group.dev]
46
+ optional = true
47
+
45
48
  [tool.poetry.group.dev.dependencies]
46
- black = "^24.10.0"
47
- nox = "^2024.10.9"
49
+ black = ">=24.10,<26.0"
50
+ nox = ">=2024.10.9,<2026.0.0"
48
51
  pyright = "^1.1.391"
49
52
  pytest = "^8.3.4"
50
53
  pytest-cov = "^6.0.0"
51
- ruff = ">=0.8.6,<0.10.0"
54
+ ruff = ">=0.8.6,<0.12.0"
52
55
  pytest-watcher = "^0.4.3"
53
56
 
54
57
  [build-system]
File without changes
File without changes
File without changes
File without changes
File without changes