diff --git a/.gitignore b/.gitignore index a29f746c..accfb8a1 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,7 @@ __pycache__/ -env/ +.env/ dist/ docs/_build htmlcov @@ -25,7 +25,6 @@ arlunio/tutorial/ build *.pyc pip-wheel-metadata -.dev *.mo *.xml *.snap diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 46810ea4..61458a40 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,5 @@ repos: -- repo: https://github.com/pre-commit/pre-commit-hooks +- repo: https://gitlab.com/pycqa/flake8 rev: master hooks: - id: flake8 diff --git a/.vscode/settings.json b/.vscode/settings.json index 788e8201..4fcacb13 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -21,7 +21,7 @@ "python.linting.pylintEnabled": false, "python.linting.flake8Enabled": true, "python.linting.enabled": true, - "python.pythonPath": "${workspaceFolder}/.dev/bin/python", + "python.pythonPath": "${workspaceFolder}/.env/bin/python", "python.terminal.activateEnvInCurrentTerminal": true, "python.terminal.activateEnvironment": true, "python.testing.pytestEnabled": true, diff --git a/arlunio/__init__.py b/arlunio/__init__.py index 5dca1c9f..d74a3ac7 100644 --- a/arlunio/__init__.py +++ b/arlunio/__init__.py @@ -1,4 +1,4 @@ -from ._core import Defn, DefnInput, Mask, definition # noqa: F401 +from ._core import Defn, DefnInput, definition # noqa: F401 from ._expressions import all, any, clamp, invert, lerp, normalise # noqa: F401 from ._images import Image, Resolutions, colorramp, encode, fill, save # noqa: F401 from ._version import __version__ # noqa: F401 diff --git a/arlunio/_core.py b/arlunio/_core.py index 54ac5c55..729ad66e 100644 --- a/arlunio/_core.py +++ b/arlunio/_core.py @@ -8,11 +8,6 @@ logger = logging.getLogger(__name__) -class Mask: - """Currently just a type alias for boolean numpy arrays but gives us the flexibility - to add smarts later.""" - - def _format_type(obj: Optional[Any] = None, type_: Optional[Any] = None) -> str: """Given an object, return an appropriate representation for its type.""" diff --git a/arlunio/doc/__init__.py b/arlunio/doc/__init__.py index 01189334..5b4e3afb 100644 --- a/arlunio/doc/__init__.py +++ b/arlunio/doc/__init__.py @@ -71,8 +71,8 @@ def _process_docstring( if inherits is not None: - for l in reversed(inherits): - lines.insert(0, l) + for line in reversed(inherits): + lines.insert(0, line) def setup(app: Sphinx) -> Dict[str, Any]: diff --git a/arlunio/doc/directives.py b/arlunio/doc/directives.py index e99d7975..5fc93818 100644 --- a/arlunio/doc/directives.py +++ b/arlunio/doc/directives.py @@ -2,7 +2,7 @@ import textwrap import traceback -from typing import List +from typing import List, Tuple import arlunio as ar @@ -84,7 +84,9 @@ def parse_content(state, content: StringList) -> List[nodes.Node]: return section.children -def render_image(src: str, smooth: bool = True) -> List[nodes.Node]: +def render_image( + src: str, smooth: bool = True, location: Tuple[str, int] = None +) -> List[nodes.Node]: """Given the source code for an image return a doctree that when rendered by Sphinx will insert that image into a HTML page. @@ -97,23 +99,20 @@ def render_image(src: str, smooth: bool = True) -> List[nodes.Node]: algorithm that smooths out the edges of the image. """ doctree = [] + environment = {} try: code = compile(src, "", "exec") + exec(code, environment) except Exception: - message = nodes.Text("Unable to render image: Invalid code") - err = nodes.literal_block("", traceback.format_exc()) - doctree.append(nodes.error("", message, err)) - - return doctree + tback = traceback.format_exc() - environment = {} + # Flag the issue to the user to the issue in the log + logger.warning("Unable to render image\n%s", tback, location=location) - try: - exec(code, environment) - except Exception: + # But also make the error obvious in the docs. message = nodes.Text("Unable to render image: Error in code") - err = nodes.literal_block("", traceback.format_exc()) + err = nodes.literal_block("", tback) doctree.append(nodes.error("", message, err)) return doctree @@ -179,7 +178,9 @@ def run(self): src = "\n".join(self.content) smooth = not ("disable-smoothing" in self.options.keys()) - nodelist = render_image(src, smooth) + + location = self.state_machine.get_source_and_line(self.lineno) + nodelist = render_image(src, smooth, location=location) if "include-code" in self.options.keys(): diff --git a/arlunio/lib/__init__.py b/arlunio/lib/__init__.py index 891cc42f..e69de29b 100644 --- a/arlunio/lib/__init__.py +++ b/arlunio/lib/__init__.py @@ -1,12 +0,0 @@ -from .operators import MaskAdd, MaskMul, MaskSub # noqa: F401 -from .parameters import R, T, X, Y # noqa: F401 -from .pattern import Grid, Map, Pixelize # noqa: F401 -from .shapes import ( # noqa: F401 - Circle, - Ellipse, - Empty, - Full, - Rectangle, - Square, - SuperEllipse, -) diff --git a/arlunio/lib/mask/__init__.py b/arlunio/lib/mask/__init__.py new file mode 100644 index 00000000..9d2c3a24 --- /dev/null +++ b/arlunio/lib/mask/__init__.py @@ -0,0 +1,17 @@ +from .mask import Mask +from .pattern import Grid, Map, Pixelize +from .shape import Circle, Ellipse, Empty, Full, Rectangle, Square, SuperEllipse + +__all__ = [ + "Mask", + "Circle", + "Ellipse", + "Empty", + "Full", + "Grid", + "Map", + "Pixelize", + "Rectangle", + "Square", + "SuperEllipse", +] diff --git a/arlunio/lib/operators.py b/arlunio/lib/mask/mask.py similarity index 87% rename from arlunio/lib/operators.py rename to arlunio/lib/mask/mask.py index d71076e9..264d40b2 100644 --- a/arlunio/lib/operators.py +++ b/arlunio/lib/mask/mask.py @@ -1,11 +1,14 @@ import arlunio as ar -from arlunio import Defn, Mask +class Mask: + """Currently just a type alias for boolean numpy arrays but gives us the flexibility + to add smarts later.""" -@ar.definition(operation=Defn.OP_ADD) + +@ar.definition(operation=ar.Defn.OP_ADD) def MaskAdd( - width: int, height: int, *, a: Defn[Mask] = None, b: Defn[Mask] = None + width: int, height: int, *, a: ar.Defn[Mask] = None, b: ar.Defn[Mask] = None ) -> Mask: """Add any two mask producing definitions together. @@ -53,9 +56,9 @@ def MaskAdd( return ar.any(a(width=width, height=height), b(width=width, height=height)) -@ar.definition(operation=Defn.OP_SUB) +@ar.definition(operation=ar.Defn.OP_SUB) def MaskSub( - width: int, height: int, *, a: Defn[Mask] = None, b: Defn[Mask] = None + width: int, height: int, *, a: ar.Defn[Mask] = None, b: ar.Defn[Mask] = None ) -> Mask: """Subtract one mask away from another mask. @@ -109,9 +112,9 @@ def MaskSub( ) -@ar.definition(operation=Defn.OP_MUL) +@ar.definition(operation=ar.Defn.OP_MUL) def MaskMul( - width: int, height: int, *, a: Defn[Mask] = None, b: Defn[Mask] = None + width: int, height: int, *, a: ar.Defn[Mask] = None, b: ar.Defn[Mask] = None ) -> Mask: """Muliply any two mask producing definitions together. diff --git a/arlunio/lib/pattern.py b/arlunio/lib/mask/pattern.py similarity index 94% rename from arlunio/lib/pattern.py rename to arlunio/lib/mask/pattern.py index ea41580c..a669a3ac 100644 --- a/arlunio/lib/pattern.py +++ b/arlunio/lib/mask/pattern.py @@ -3,16 +3,18 @@ import arlunio as ar import numpy as np +from .shape import Mask + logger = logging.getLogger(__name__) @ar.definition -def Grid(width: int, height: int, *, n=4, m=None, defn=None) -> ar.Mask: +def Grid(width: int, height: int, *, n=4, m=None, defn=None) -> Mask: """ .. arlunio-image:: import arlunio as ar - from arlunio.lib import Circle, Grid + from arlunio.lib.mask import Circle, Grid pattern = Grid(defn=Circle()) image = ar.fill(pattern(width=1920, height=1080)) @@ -49,7 +51,8 @@ def Grid(width: int, height: int, *, n=4, m=None, defn=None) -> ar.Mask: import arlunio as ar import numpy as np - from arlunio.lib import Circle, Grid, X, Y + from arlunio.lib.mask import Circle, Grid + from arlunio.lib.math import X, Y @ar.definition def Template(x:X, y: Y): @@ -69,7 +72,8 @@ def Template(x:X, y: Y): import arlunio as ar import numpy as np - from arlunio.lib import Grid, X, Y + from arlunio.lib.mask import Grid + from arlunio.lib.math import X, Y @ar.definition def Template(x: X, y: Y): @@ -101,7 +105,7 @@ def Template(x: X, y: Y): @ar.definition -def Map(width: int, height: int, *, layout=None, legend=None) -> ar.Mask: +def Map(width: int, height: int, *, layout=None, legend=None) -> Mask: """For more complex layouts. .. note:: @@ -125,7 +129,7 @@ def Map(width: int, height: int, *, layout=None, legend=None) -> ar.Mask: import arlunio as ar import numpy as np - from arlunio.lib import Empty, Map, Rectangle + from arlunio.lib.mask import Empty, Map, Rectangle @ar.definition def Wall(width: int, height: int, *, sides=None): @@ -182,12 +186,12 @@ def Wall(width: int, height: int, *, sides=None): @ar.definition def Pixelize( width: int, height: int, *, pixels=None, defn=None, n=None, m=None -) -> ar.Mask: +) -> Mask: """ .. arlunio-image:: import arlunio as ar - from arlunio.lib import Circle, Pixelize + from arlunio.lib.mask import Circle, Pixelize pix = Pixelize(defn=Circle(), n=32, m=32) image = ar.fill(pix(width=1920, height=1080)) @@ -231,7 +235,7 @@ def Pixelize( import arlunio as ar import numpy as np - from arlunio.lib import Pixelize + from arlunio.lib.mask import Pixelize pixels = np.array([ [False, True, True, False], @@ -250,7 +254,8 @@ def Pixelize( import arlunio as ar import numpy as np - from arlunio.lib import Circle, X, Y, Pixelize + from arlunio.lib.mask import Circle, Pixelize + from arlunio.lib.math import X, Y @ar.definition def Ghost(x: X, y: Y): diff --git a/arlunio/lib/shapes.py b/arlunio/lib/mask/shape.py similarity index 93% rename from arlunio/lib/shapes.py rename to arlunio/lib/mask/shape.py index d382851e..36bfc43d 100644 --- a/arlunio/lib/shapes.py +++ b/arlunio/lib/mask/shape.py @@ -1,16 +1,21 @@ +"""Here we define many shapes + +""" import arlunio as ar import numpy as np -from .parameters import X, Y +from arlunio.lib.math import X, Y + +from .mask import Mask @ar.definition -def Circle(x: X, y: Y, *, xc=0, yc=0, r=0.8, pt=None) -> ar.Mask: +def Circle(x: X, y: Y, *, xc=0, yc=0, r=0.8, pt=None) -> Mask: """ .. arlunio-image:: import arlunio as ar - from arlunio.lib import Circle + from arlunio.lib.mask import Circle circle = Circle() image = ar.fill(circle(width=1920, height=1080)) @@ -46,7 +51,7 @@ def Circle(x: X, y: Y, *, xc=0, yc=0, r=0.8, pt=None) -> ar.Mask: :include-code: before import arlunio as ar - from arlunio.lib import Circle + from arlunio.lib.mask import Circle @ar.definition def Target(width: int, height: int): @@ -75,7 +80,7 @@ def Target(width: int, height: int): :include-code: before import arlunio as ar - from arlunio.lib import Circle + from arlunio.lib.mask import Circle @ar.definition def OlympicRings(width: int, height: int, *, spacing=0.5, pt=0.025): @@ -117,12 +122,12 @@ def OlympicRings(width: int, height: int, *, spacing=0.5, pt=0.025): @ar.definition -def Ellipse(x: X, y: Y, *, xc=0, yc=0, a=2, b=1, r=0.8, pt=None) -> ar.Mask: +def Ellipse(x: X, y: Y, *, xc=0, yc=0, a=2, b=1, r=0.8, pt=None) -> Mask: """ .. arlunio-image:: import arlunio as ar - from arlunio.lib import Ellipse + from arlunio.lib.mask import Ellipse ellipse = Ellipse() image = ar.fill(ellipse(width=1920, height=1080)) @@ -171,7 +176,7 @@ def Ellipse(x: X, y: Y, *, xc=0, yc=0, a=2, b=1, r=0.8, pt=None) -> ar.Mask: :include-code: before import arlunio as ar - from arlunio.lib import Ellipse + from arlunio.lib.mask import Ellipse @ar.definition def EllipseDemo(width: int, height: int): @@ -200,7 +205,8 @@ def EllipseDemo(width: int, height: int): :include-code: before import arlunio as ar - from arlunio.lib import Ellipse, X, Y + from arlunio.lib.mask import Ellipse + from arlunio.lib.math import X, Y @ar.definition def Atom(x: X, y: Y): @@ -243,12 +249,12 @@ def Atom(x: X, y: Y): @ar.definition def SuperEllipse( x: X, y: Y, *, xc=0, yc=0, a=1, b=1, n=3, r=0.8, m=None, pt=None -) -> ar.Mask: +) -> Mask: """ .. arlunio-image:: import arlunio as ar - from arlunio.lib import SuperEllipse + from arlunio.lib.mask import SuperEllipse ellipse = SuperEllipse() image = ar.fill(ellipse(width=1920, height=1080)) @@ -301,7 +307,7 @@ def SuperEllipse( :include-code: before import arlunio as ar - from arlunio.lib import SuperEllipse + from arlunio.lib.mask import SuperEllipse @ar.definition def SuperEllipseDemo(width: int, height: int): @@ -332,7 +338,7 @@ def SuperEllipseDemo(width: int, height: int): :include-code: before import arlunio as ar - from arlunio.lib import SuperEllipse + from arlunio.lib.mask import SuperEllipse @ar.definition def Sauron(width: int, height: int): @@ -375,7 +381,7 @@ def Sauron(width: int, height: int): @ar.definition -def Empty(width: int, height: int) -> ar.Mask: +def Empty(width: int, height: int) -> Mask: """An empty shape definition. Example @@ -385,7 +391,7 @@ def Empty(width: int, height: int) -> ar.Mask: :include-code: before import arlunio as ar - from arlunio.lib import Empty + from arlunio.lib.mask import Empty e = Empty() image = ar.fill(e(width=1920, height=1080)) @@ -394,7 +400,7 @@ def Empty(width: int, height: int) -> ar.Mask: @ar.definition -def Full(width: int, height: int) -> ar.Mask: +def Full(width: int, height: int) -> Mask: """An full shape definition. Example @@ -404,7 +410,7 @@ def Full(width: int, height: int) -> ar.Mask: :include-code: before import arlunio as ar - from arlunio.lib import Full + from arlunio.lib.mask import Full f = Full() image = ar.fill(f(width=1920, height=1080)) @@ -413,12 +419,12 @@ def Full(width: int, height: int) -> ar.Mask: @ar.definition -def Square(x: X, y: Y, *, xc=0, yc=0, size=0.8, pt=None) -> ar.Mask: +def Square(x: X, y: Y, *, xc=0, yc=0, size=0.8, pt=None) -> Mask: """ .. arlunio-image:: import arlunio as ar - from arlunio.lib import Square + from arlunio.lib.mask import Square square = Square() image = ar.fill(square(width=1920, height=1080)) @@ -446,7 +452,8 @@ def Square(x: X, y: Y, *, xc=0, yc=0, size=0.8, pt=None) -> ar.Mask: :include-code: before import arlunio as ar - from arlunio.lib import Square, X, Y + from arlunio.lib.mask import Square + from arlunio.lib.math import X, Y @ar.definition def SquareDemo(x: X, y: Y): @@ -484,12 +491,12 @@ def SquareDemo(x: X, y: Y): @ar.definition -def Rectangle(x: X, y: Y, *, xc=0, yc=0, size=0.6, ratio=1.618, pt=None) -> ar.Mask: +def Rectangle(x: X, y: Y, *, xc=0, yc=0, size=0.6, ratio=1.618, pt=None) -> Mask: """ .. arlunio-image:: import arlunio as ar - from arlunio.lib import Rectangle + from arlunio.lib.mask import Rectangle rectangle = Rectangle() image = ar.fill(rectangle(width=1920, height=1080)) @@ -519,7 +526,7 @@ def Rectangle(x: X, y: Y, *, xc=0, yc=0, size=0.6, ratio=1.618, pt=None) -> ar.M :include-code: before import arlunio as ar - from arlunio.lib import Rectangle + from arlunio.lib.mask import Rectangle @ar.definition def RectangleDemo(width: int, height: int): diff --git a/arlunio/lib/parameters.py b/arlunio/lib/math.py similarity index 96% rename from arlunio/lib/parameters.py rename to arlunio/lib/math.py index 282ba40f..028c112e 100644 --- a/arlunio/lib/parameters.py +++ b/arlunio/lib/math.py @@ -8,7 +8,7 @@ def X(width: int, height: int, *, x0=0, scale=1, stretch=False): .. arlunio-image:: import arlunio as ar - from arlunio.lib import X + from arlunio.lib.math import X x = X() image = ar.colorramp(x(width=1920, height=1080)) @@ -32,7 +32,7 @@ def X(width: int, height: int, *, x0=0, scale=1, stretch=False): By default values will be generated between :math:`\\pm 1`:: - >>> from arlunio.lib import X + >>> from arlunio.lib.math import X >>> x = X() >>> x(width=4, height=4) array([[-1. , -0.33333333, 0.33333333, 1. ], @@ -83,7 +83,7 @@ def Y(width: int, height: int, *, y0=0, scale=1, stretch=False): .. arlunio-image:: import arlunio as ar - from arlunio.lib import Y + from arlunio.lib.math import Y y = Y() image = ar.colorramp(y(width=1920, height=1080)) @@ -107,7 +107,7 @@ def Y(width: int, height: int, *, y0=0, scale=1, stretch=False): By default values will be generated between :math:`\\pm 1`:: - >>> from arlunio.lib import Y + >>> from arlunio.lib.math import Y >>> y = Y() >>> y(width=4, height=4) array([[ 1. , 1. , 1. , 1. ], @@ -162,7 +162,7 @@ def R(x: X, y: Y): .. arlunio-image:: import arlunio as ar - from arlunio.lib import R + from arlunio.lib.math import R r = R() image = ar.colorramp(r(width=1920, height=1080)) @@ -180,7 +180,7 @@ def R(x: X, y: Y): -------- :: - >>> from arlunio.lib import R + >>> from arlunio.lib.math import R >>> r = R() >>> r(width=5, height=5) array([[1.41421356, 1.11803399, 1. , 1.11803399, 1.41421356], @@ -215,7 +215,7 @@ def T(x: X, y: Y, *, t0=0): .. arlunio-image:: import arlunio as ar - from arlunio.lib import T + from arlunio.lib.math import T t = T() image = ar.colorramp(t(width=1920, height=1080)) @@ -240,7 +240,7 @@ def T(x: X, y: Y, *, t0=0): By default all point on the :math:`x`-axis will have a value of :code:`t = 0`:: - >>> from arlunio.lib import T + >>> from arlunio.lib.math import T >>> t = T() >>> t(width=5, height=5) array([[ 2.35619449, 2.03444394, 1.57079633, 1.10714872, 0.78539816], diff --git a/changes/227.doc.rst b/changes/227.doc.rst new file mode 100644 index 00000000..98d51825 --- /dev/null +++ b/changes/227.doc.rst @@ -0,0 +1,2 @@ +Updated the :code:`arlunio-image` directive to output a warning during a Sphinx build +if a given image fails to render. \ No newline at end of file diff --git a/changes/227.misc.rst b/changes/227.misc.rst new file mode 100644 index 00000000..18aaf89c --- /dev/null +++ b/changes/227.misc.rst @@ -0,0 +1,2 @@ +Fix reference to :code:`flake8` in :code:`.pre-commit-config.yaml`. Changed virtualenv +name from :code:`.dev` to :code:`.env` \ No newline at end of file diff --git a/changes/227.stdlib.rst b/changes/227.stdlib.rst new file mode 100644 index 00000000..bb024379 --- /dev/null +++ b/changes/227.stdlib.rst @@ -0,0 +1,3 @@ +Reorganised the standard library the `shapes`, `patterns` and `operators` modules have +been merged into a single `arlunio.lib.mask` module. The `parameters` module has +also been renamed to `math`. \ No newline at end of file diff --git a/docs/Makefile b/docs/Makefile index 298ea9e2..e7eb6a4f 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -2,7 +2,7 @@ # # You can set these variables from the command line. -SPHINXOPTS = +SPHINXOPTS = -E -a SPHINXBUILD = sphinx-build SOURCEDIR = . BUILDDIR = _build diff --git a/docs/conf.py b/docs/conf.py index 003662d7..aca3937a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -87,7 +87,6 @@ # -- Extension Configuration ------------------------------------------------- autodoc_member_order = "groupwise" autodoc_default_options = {"members": True} -# autodoc_typehints = "description" TODO: Try this when Sphinx 3.0 ships... linkcheck_ignore = ["https://crontab.guru/#"] diff --git a/docs/stdlib/index.rst b/docs/stdlib/index.rst index 5d7328db..743ff060 100644 --- a/docs/stdlib/index.rst +++ b/docs/stdlib/index.rst @@ -12,7 +12,5 @@ basics everyone will need along with some useful utilities for various tasks. :maxdepth: 2 :caption: Index - operators - parameters - patterns - shapes + masks + math diff --git a/docs/stdlib/masks.rst b/docs/stdlib/masks.rst new file mode 100644 index 00000000..b90a6881 --- /dev/null +++ b/docs/stdlib/masks.rst @@ -0,0 +1,5 @@ +Masks +===== + +.. automodule:: arlunio.lib.mask + :members: diff --git a/docs/stdlib/math.rst b/docs/stdlib/math.rst new file mode 100644 index 00000000..ea534018 --- /dev/null +++ b/docs/stdlib/math.rst @@ -0,0 +1,7 @@ +.. _stdlib_math: + +Math +==== + +.. automodule:: arlunio.lib.math + :members: diff --git a/docs/stdlib/operators.rst b/docs/stdlib/operators.rst deleted file mode 100644 index 06a5bdcb..00000000 --- a/docs/stdlib/operators.rst +++ /dev/null @@ -1,36 +0,0 @@ -Operators -========= - -Built in operators. - -.. note:: - - It's often not necessary to use these definitions directly since they plug - into the operator system. - - -.. currentmodule:: arlunio.lib.operators - -.. _stdlib_operators_maskadd: - -MaskAdd -------- - -.. autoclass:: MaskAdd - - -.. _stdlib_operators_maskmul: - -MaskMul -------- - -.. autoclass:: MaskMul - -.. _stdlib_operators_masksub: - -MaskSub -------- - -.. autoclass:: MaskSub - - diff --git a/docs/stdlib/parameters.rst b/docs/stdlib/parameters.rst deleted file mode 100644 index f520b1be..00000000 --- a/docs/stdlib/parameters.rst +++ /dev/null @@ -1,36 +0,0 @@ -.. _stdlib_parameters: - -Parameters -============ - -Parameters are definitions that are designed to be primarily used as inputs to -other definitions. - -.. _stdlib_parameters_r: - -R -- - -.. autoclass:: arlunio.lib.parameters.R - -.. _stdlib_parameters_t: - -T -- - -.. autoclass:: arlunio.lib.parameters.T - - -.. _stdlib_parameters_x: - -X -- - -.. autoclass:: arlunio.lib.parameters.X - -.. _stdlib_parameters_y: - -Y -- - -.. autoclass:: arlunio.lib.parameters.Y diff --git a/docs/stdlib/patterns.rst b/docs/stdlib/patterns.rst deleted file mode 100644 index c1dd30d6..00000000 --- a/docs/stdlib/patterns.rst +++ /dev/null @@ -1,27 +0,0 @@ -.. _stdlib_patterns: - -Patterns -======== - -Higher-order definitions useful for generating patterns. - -.. _stdlib_patterns_grid: - -Grid ----- - -.. autoclass:: arlunio.lib.pattern.Grid - -.. _stdlib_patterns_map: - -Map ---- - -.. autoclass:: arlunio.lib.pattern.Map - -.. _stdlib_patterns_pixelize: - -Pixelize --------- - -.. autoclass:: arlunio.lib.pattern.Pixelize diff --git a/docs/stdlib/shapes.rst b/docs/stdlib/shapes.rst deleted file mode 100644 index db815049..00000000 --- a/docs/stdlib/shapes.rst +++ /dev/null @@ -1,60 +0,0 @@ -.. _stdlib_shapes: - -Shapes -====== - -Built in shape definitions - -.. currentmodule:: arlunio.lib.shapes - -.. _stdlib_shapes_circle: - -Circle ------- - -.. autoclass:: Circle - - -.. _stdlib_shapes_ellipse: - -Ellipse -------- - -.. autoclass:: Ellipse - - -.. _stdlib_shapes_empty: - -Empty ------ - -.. autoclass:: Empty - -.. _stdlib_shapes_full: - -Full ----- - -.. autoclass:: Full - -.. _stdlib_shapes_square: - -Square ------- - -.. autoclass:: Square - - -.. _stdlib_shapes_superellipse: - -Super Ellipse -------------- - -.. autoclass:: SuperEllipse - -.. _stdlib_shapes_rectangle: - -Rectangle ---------- - -.. autoclass:: Rectangle diff --git a/docs/users/getting-started/your-first-image.rst b/docs/users/getting-started/your-first-image.rst index e992ff99..4d422a8c 100644 --- a/docs/users/getting-started/your-first-image.rst +++ b/docs/users/getting-started/your-first-image.rst @@ -19,7 +19,7 @@ code:: .. arlunio-image:: import arlunio as ar - from arlunio.lib import Circle + from arlunio.lib.mask import Circle circle = Circle() image = ar.fill(circle(width=1920, height=1080), color="red") diff --git a/pyproject.toml b/pyproject.toml index 42a09e15..b289d28f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,6 +46,11 @@ underlines = ["-", "^", "\""] name = "Docs" showcontent = true +[[tool.towncrier.type]] + directory = "stdlib" + name = "Standard Library" + showcontent = true + [[tool.towncrier.type]] directory = "removal" name = "Removed" diff --git a/setup.py b/setup.py index d5126c80..06c40e92 100644 --- a/setup.py +++ b/setup.py @@ -26,6 +26,7 @@ def readme(): "sphinx-autobuild", "sphinx_rtd_theme", "sphobjinv", + "towncrier", "tox", ], "doc": ["sphinx", "nbformat"], diff --git a/tests/doc/test_directives.py b/tests/doc/test_directives.py index a66dbc2d..6afa7e65 100644 --- a/tests/doc/test_directives.py +++ b/tests/doc/test_directives.py @@ -55,7 +55,7 @@ def test_render_image_image_provided(): src = """\ import arlunio as ar - from arlunio.lib.shapes import Circle + from arlunio.lib.mask import Circle circle = Circle() disk = ar.fill(circle(width=4, height=4)) diff --git a/tests/lib/test_parameters.py b/tests/lib/test_math.py similarity index 98% rename from tests/lib/test_parameters.py rename to tests/lib/test_math.py index bd786ba4..def5ebe1 100644 --- a/tests/lib/test_parameters.py +++ b/tests/lib/test_math.py @@ -3,7 +3,7 @@ import numpy.testing as npt import py.test -from arlunio.lib.parameters import X, Y +from arlunio.lib.math import X, Y from hypothesis import assume, given