fix: missing logos in v0.25.0 by adding build-system configuration (#1187)

* Initial plan

* Initial investigation of logo display issue

Co-authored-by: mingrammer <6178510+mingrammer@users.noreply.github.com>

* Fix: Add build-system configuration to include resources in package

Co-authored-by: mingrammer <6178510+mingrammer@users.noreply.github.com>

* Clean up pyproject.toml - remove duplicate Poetry configuration

Co-authored-by: mingrammer <6178510+mingrammer@users.noreply.github.com>

* Update version to 0.25.1 and add rendering test for resources

Co-authored-by: mingrammer <6178510+mingrammer@users.noreply.github.com>

* Update poetry.lock to reflect current dependencies

Co-authored-by: mingrammer <6178510+mingrammer@users.noreply.github.com>

* Fix pre-commit issues: trailing whitespace and formatting

Co-authored-by: mingrammer <6178510+mingrammer@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: mingrammer <6178510+mingrammer@users.noreply.github.com>
master v0.25.1
Copilot 3 weeks ago committed by GitHub
parent 2b7e81bcb2
commit dd0763d939
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

2
.gitignore vendored

@ -29,3 +29,5 @@ website/package-lock.json
# Ignore .swp files
.swp
*.whl
dist/

@ -65,7 +65,7 @@ find . -type f -name "*.svg" -exec bash -c 'inkscape -h 256 --export-filename="
find . -type f -name "*.svg" -exec bash -c 'rm "$0"' {} \;
```
If you get any errors with autogen, it will probably be a '+' in filename
If you get any errors with autogen, it will probably be a '+' in filename
### Add new provider

@ -38,6 +38,8 @@ class DiagnosticsSettings(_Monitor):
class LogAnalyticsWorkspaces(_Monitor):
_icon = "log-analytics-workspaces.png"
class Logs(_Monitor):
_icon = "logs.png"

22
poetry.lock generated

@ -1,4 +1,4 @@
# This file is automatically @generated by Poetry 2.1.1 and should not be changed by hand.
# This file is automatically @generated by Poetry 2.2.1 and should not be changed by hand.
[[package]]
name = "astroid"
@ -68,7 +68,7 @@ version = "3.4.0"
description = "Validate configuration and produce human readable error messages."
optional = false
python-versions = ">=3.8"
groups = ["main", "dev"]
groups = ["main"]
files = [
{file = "cfgv-3.4.0-py2.py3-none-any.whl", hash = "sha256:b7265b1f29fd3316bfcd2b330d63d024f2bfd8bcb8b0272f8e19a504856c48f9"},
{file = "cfgv-3.4.0.tar.gz", hash = "sha256:e52591d4c5f5dead8e0f673fb16db7949d2cfb3f7da4582893288f0ded8fe560"},
@ -124,7 +124,7 @@ version = "0.3.9"
description = "Distribution utilities"
optional = false
python-versions = "*"
groups = ["main", "dev"]
groups = ["main"]
files = [
{file = "distlib-0.3.9-py2.py3-none-any.whl", hash = "sha256:47f8c22fd27c27e25a65601af709b38e4f0a45ea4fc2e710f65755fa8caaaf87"},
{file = "distlib-0.3.9.tar.gz", hash = "sha256:a60f20dea646b8a33f3e7772f74dc0b2d0772d2837ee1342a00645c81edf9403"},
@ -152,7 +152,7 @@ version = "3.16.1"
description = "A platform independent file lock."
optional = false
python-versions = ">=3.8"
groups = ["main", "dev"]
groups = ["main"]
files = [
{file = "filelock-3.16.1-py3-none-any.whl", hash = "sha256:2082e5703d51fbf98ea75855d9d5527e33d8ff23099bec374a134febee6946b0"},
{file = "filelock-3.16.1.tar.gz", hash = "sha256:c249fbfcd5db47e5e2d6d62198e565475ee65e4831e2561c8e313fa7eb961435"},
@ -186,7 +186,7 @@ version = "2.6.2"
description = "File identification library for Python"
optional = false
python-versions = ">=3.9"
groups = ["main", "dev"]
groups = ["main"]
files = [
{file = "identify-2.6.2-py2.py3-none-any.whl", hash = "sha256:c097384259f49e372f4ea00a19719d95ae27dd5ff0fd77ad630aa891306b82f3"},
{file = "identify-2.6.2.tar.gz", hash = "sha256:fab5c716c24d7a789775228823797296a2994b075fb6080ac83a102772a98cbd"},
@ -342,7 +342,7 @@ version = "1.9.1"
description = "Node.js virtual environment builder"
optional = false
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
groups = ["main", "dev"]
groups = ["main"]
files = [
{file = "nodeenv-1.9.1-py2.py3-none-any.whl", hash = "sha256:ba11c9782d29c27c70ffbdda2d7415098754709be8a7056d79a737cd901155c9"},
{file = "nodeenv-1.9.1.tar.gz", hash = "sha256:6ec12890a2dab7946721edbfbcd91f3319c6ccc9aec47be7c7e6b7011ee6645f"},
@ -411,7 +411,7 @@ version = "4.3.0"
description = "A framework for managing and maintaining multi-language pre-commit hooks."
optional = false
python-versions = ">=3.9"
groups = ["main", "dev"]
groups = ["main"]
files = [
{file = "pre_commit-4.3.0-py2.py3-none-any.whl", hash = "sha256:2b0747ad7e6e967169136edffee14c16e148a778a54e4f967921aa1ebf2308d8"},
{file = "pre_commit-4.3.0.tar.gz", hash = "sha256:499fe450cc9d42e9d58e606262795ecb64dd05438943c62b66f6a8673da30b16"},
@ -523,7 +523,7 @@ version = "6.0.2"
description = "YAML parser and emitter for Python"
optional = false
python-versions = ">=3.8"
groups = ["main", "dev"]
groups = ["main"]
files = [
{file = "PyYAML-6.0.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:0a9a2848a5b7feac301353437eb7d5957887edbf81d56e903999a75a3d743086"},
{file = "PyYAML-6.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:29717114e51c84ddfba879543fb232a6ed60086602313ca38cce623c1d62cfbf"},
@ -644,7 +644,7 @@ version = "20.27.1"
description = "Virtual Python Environment builder"
optional = false
python-versions = ">=3.8"
groups = ["main", "dev"]
groups = ["main"]
files = [
{file = "virtualenv-20.27.1-py3-none-any.whl", hash = "sha256:f11f1b8a29525562925f745563bfd48b189450f61fb34c4f9cc79dd5aa32a1f4"},
{file = "virtualenv-20.27.1.tar.gz", hash = "sha256:142c6be10212543b32c6c45d3d3893dff89112cc588b7d0879ae5a1ec03a47ba"},
@ -661,5 +661,5 @@ test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess
[metadata]
lock-version = "2.1"
python-versions = "^3.9"
content-hash = "b0047443e0dfb4ba644c67fcd950b2e17a0d24d3f3f1518c85469d51c5f2b390"
python-versions = "~=3.9"
content-hash = "af39afe5e054e13ca217f6d6ceb20d0a464d94f46fcc728a1f8d7ca91bbd237c"

@ -1,6 +1,10 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "diagrams"
version = "0.25.0"
version = "0.25.1"
description = "Diagram as Code"
authors = [{ name = "mingrammer", email = "mingrammer@gmail.com" }]
requires-python = "~=3.9"
@ -13,6 +17,9 @@ dependencies = [
"pre-commit>=4.0.1,<5",
]
[project.scripts]
diagrams = "diagrams.cli:main"
[project.urls]
Homepage = "https://diagrams.mingrammer.com"
Repository = "https://github.com/mingrammer/diagrams"
@ -26,28 +33,8 @@ dev = [
"black~=24.4",
]
[tool.hatch.build.targets.sdist]
include = ["resources/**/*"]
[tool.poetry.scripts]
diagrams="diagrams.cli:main"
[tool.poetry.dependencies]
python = "^3.9"
graphviz = ">=0.13.2,<0.21.0"
jinja2 = ">=2.10,<4.0"
typed-ast = {version="^1.5.5", markers="python_version<'3.8'"}
[tool.poetry.group.dev.dependencies]
pytest = "^8.4"
pylint = "^3.3"
rope = "^1.13"
isort = "^6.0"
black = "^24.4"
pre-commit = "^4.3.0"
[tool.hatch.build.targets.wheel]
include = ["resources/**/*"]
[tool.hatch.build]
only-include = ["diagrams", "resources"]
[tool.black]
line-length=120

@ -393,3 +393,49 @@ class ResourcesTest(unittest.TestCase):
_,
_ in os.walk(resources_dir))
self.assertLessEqual(max_depth, 2)
def test_resources_exist_and_render(self):
"""
Test that resources directory exists and icons can be loaded for rendering.
This ensures the package build includes all necessary resource files.
"""
from diagrams.aws.compute import EC2
from diagrams.aws.database import RDS
# Verify resources directory exists
resources_dir = pathlib.Path(__file__).parent.parent / "resources"
self.assertTrue(resources_dir.exists(), "resources directory should exist")
# Verify AWS resources exist (sample check)
aws_compute_dir = resources_dir / "aws" / "compute"
self.assertTrue(aws_compute_dir.exists(), "AWS compute resources should exist")
# Verify icon files exist
ec2_icon = aws_compute_dir / "ec2.png"
self.assertTrue(ec2_icon.exists(), "EC2 icon should exist")
# Test that nodes can load their icons
test_diagram_name = "test_resources_render"
try:
with Diagram(test_diagram_name, show=False):
ec2_node = EC2("test-ec2")
rds_node = RDS("test-rds")
# Verify nodes have icon attributes set
self.assertIsNotNone(ec2_node._icon, "EC2 node should have an icon")
self.assertIsNotNone(rds_node._icon, "RDS node should have an icon")
# Verify icon paths are valid
ec2_icon_path = ec2_node._load_icon()
rds_icon_path = rds_node._load_icon()
self.assertTrue(os.path.exists(ec2_icon_path),
f"EC2 icon path should exist: {ec2_icon_path}")
self.assertTrue(os.path.exists(rds_icon_path),
f"RDS icon path should exist: {rds_icon_path}")
finally:
# Clean up generated files
try:
os.remove(test_diagram_name + ".png")
except FileNotFoundError:
pass

Loading…
Cancel
Save