aboutsummaryrefslogtreecommitdiff
path: root/devel/py-memory-graph
diff options
context:
space:
mode:
Diffstat (limited to 'devel/py-memory-graph')
-rw-r--r--devel/py-memory-graph/Makefile25
-rw-r--r--devel/py-memory-graph/distinfo3
-rw-r--r--devel/py-memory-graph/files/patch-memory__graph____init__.py23
-rw-r--r--devel/py-memory-graph/files/patch-memory__graph__test__sequence.py40
-rw-r--r--devel/py-memory-graph/files/patch-pyproject.toml24
-rw-r--r--devel/py-memory-graph/pkg-descr14
6 files changed, 129 insertions, 0 deletions
diff --git a/devel/py-memory-graph/Makefile b/devel/py-memory-graph/Makefile
new file mode 100644
index 000000000000..d221e71ec857
--- /dev/null
+++ b/devel/py-memory-graph/Makefile
@@ -0,0 +1,25 @@
+PORTNAME= memory-graph
+DISTVERSION= 0.3.58
+CATEGORIES= devel python
+MASTER_SITES= PYPI
+PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
+DISTNAME= memory_graph-${DISTVERSION}
+
+MAINTAINER= yuri@FreeBSD.org
+COMMENT= Teaching tool for debugging references and mutable data types
+WWW= https://github.com/bterwijn/memory_graph
+
+LICENSE= BSD2CLAUSE
+
+BUILD_DEPENDS= ${PY_SETUPTOOLS} \
+ ${PYTHON_PKGNAMEPREFIX}wheel>0:devel/py-wheel@${PY_FLAVOR}
+RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}graphviz>0:graphics/py-graphviz@${PY_FLAVOR}
+
+USES= python
+USE_PYTHON= pep517 autoplist pytest
+
+TEST_ENV= ${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
+
+# tests as of 0.3.58: 6 passed in ~2.47s
+
+.include <bsd.port.mk>
diff --git a/devel/py-memory-graph/distinfo b/devel/py-memory-graph/distinfo
new file mode 100644
index 000000000000..40a653f988d2
--- /dev/null
+++ b/devel/py-memory-graph/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1759603621
+SHA256 (memory_graph-0.3.58.tar.gz) = 48c5acdba4be8a59c5e3bdcc5919214e22fca5de4e706f977c80e0daebf4988f
+SIZE (memory_graph-0.3.58.tar.gz) = 16828462
diff --git a/devel/py-memory-graph/files/patch-memory__graph____init__.py b/devel/py-memory-graph/files/patch-memory__graph____init__.py
new file mode 100644
index 000000000000..0f263030a9db
--- /dev/null
+++ b/devel/py-memory-graph/files/patch-memory__graph____init__.py
@@ -0,0 +1,23 @@
+# Fix graphviz Python library API compatibility
+#
+# The memory-graph library uses outdated graphviz API from older versions.
+# FreeBSD ports install py-graphviz 0.10.1 which changed the render() method:
+#
+# Old API (< 0.8): graph.render(outfile=..., quiet=..., quiet_view=...)
+# New API (>= 0.8): graph.render(filename=...)
+#
+# The 'quiet' and 'quiet_view' parameters were deprecated and removed.
+# This patch updates the API call to work with modern py-graphviz versions
+# while maintaining all core functionality.
+#
+--- memory_graph/__init__.py.orig 2025-10-04 12:21:39.453707000 -0700
++++ memory_graph/__init__.py 2025-10-04 12:21:44.778850000 -0700
+@@ -86,7 +86,7 @@
+ if outfile.endswith('.gv') or outfile.endswith('.dot'):
+ graph.save(filename=outfile)
+ else:
+- graph.render(outfile=outfile, view=view, cleanup=False, quiet=False, quiet_view=False)
++ graph.render(filename=outfile, view=view, cleanup=False)
+
+
+ def show(data, outfile=None, view=False, numbered = False):
diff --git a/devel/py-memory-graph/files/patch-memory__graph__test__sequence.py b/devel/py-memory-graph/files/patch-memory__graph__test__sequence.py
new file mode 100644
index 000000000000..5f044f19144d
--- /dev/null
+++ b/devel/py-memory-graph/files/patch-memory__graph__test__sequence.py
@@ -0,0 +1,40 @@
+# Fix pytest test collection conflict with helper function
+#
+# The function 'test_slicing(sequence, slicer)' starts with 'test_' so pytest
+# automatically collects it as a test function. However, it's actually a helper
+# function that takes parameters, which pytest interprets as fixtures.
+# Since these fixtures don't exist, pytest fails with "fixture not found".
+#
+# This helper function is meant to be called from test_sequence() with specific
+# arguments, not discovered and run independently by pytest.
+#
+# Solution: Rename to '_test_slicing()' (underscore prefix) so pytest ignores it
+# during auto-discovery, then update all calls to use the new name.
+#
+--- memory_graph/test_sequence.py.orig 2025-10-04 13:43:50.616552000 -0700
++++ memory_graph/test_sequence.py 2025-10-04 13:44:02.505010000 -0700
+@@ -10,7 +10,7 @@
+ return index[0]
+ return index
+
+-def test_slicing(sequence, slicer):
++def _test_slicing(sequence, slicer):
+ print(sequence)
+ print(slicer)
+ for i in sequence.indices_all():
+@@ -25,13 +25,13 @@
+ def test_sequence():
+ sequence = Sequence1D([i for i in range(8)])
+ slicer = Slicer(2,3)
+- test_slicing(sequence, slicer)
++ _test_slicing(sequence, slicer)
+
+ width = 5
+ height = 6
+ sequence = Sequence2D([[x+y*width for x in range(width)] for y in range(height)])
+ slicer = (Slicer(1,2), Slicer(2,1))
+- test_slicing(sequence, slicer)
++ _test_slicing(sequence, slicer)
+
+ if __name__ == '__main__':
+ test_sequence()
diff --git a/devel/py-memory-graph/files/patch-pyproject.toml b/devel/py-memory-graph/files/patch-pyproject.toml
new file mode 100644
index 000000000000..4cfcc6656821
--- /dev/null
+++ b/devel/py-memory-graph/files/patch-pyproject.toml
@@ -0,0 +1,24 @@
+# Fix pyproject.toml license field format for PEP 621 compliance
+#
+# The original pyproject.toml uses deprecated license field format:
+# license = "BSD-2-Clause"
+# license-files = ["LICENSE.txt"]
+#
+# Modern setuptools (used in pep517 builds) requires PEP 621 compliant format:
+# license = {text = "BSD-2-Clause"}
+#
+# This change enables successful pep517 builds by using the standard license
+# object format and removing the conflicting license-files field.
+#
+--- pyproject.toml.orig 2025-10-04 11:48:10.241408000 -0700
++++ pyproject.toml 2025-10-04 11:48:10.243444000 -0700
+@@ -9,8 +9,7 @@
+ authors = [
+ {name = "Bas Terwijn", email = "bterwijn@gmail.com"}
+ ]
+-license = "BSD-2-Clause"
+-license-files = ["LICENSE.txt"]
++license = {text = "BSD-2-Clause"}
+ readme = "README.md"
+ requires-python = ">=3.7"
+ classifiers = [
diff --git a/devel/py-memory-graph/pkg-descr b/devel/py-memory-graph/pkg-descr
new file mode 100644
index 000000000000..f2cfbd99ef31
--- /dev/null
+++ b/devel/py-memory-graph/pkg-descr
@@ -0,0 +1,14 @@
+memory-graph is a Python library that creates visual memory graphs for teaching
+and debugging purposes. It helps visualize object references, mutable data
+types, and the differences between shallow and deep copying in Python.
+
+Key features:
+* Generate visual representations of Python object references
+* Illustrate memory layouts and object relationships
+* Educational tool for understanding Python memory model
+* Debugging aid for complex data structures
+* Support for various data types including lists, dictionaries, and custom
+ objects
+
+The library uses Graphviz to create clear, graphical representations that make
+it easier to understand how Python manages memory and references.