Stylo

Latest version: v0.9.3

Safety actively analyzes 629959 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 2 of 3

0.6.1

-------------------

Added
^^^^^

- New :code:`preview` keyword argument to images, set this to :code:`False` if
you don't want a matplotlib figure returned.
- New :code:`encode` keyword argument to images, setting this to :code:`True`
will return a base64 encoded string representation of the image in PNG format.

Fixed
^^^^^

- Preview images are no longer displayed twice in jupyter notebooks
- Preview images no longer display the x and y axis numbers.

0.6.0

-------------------

Added
^^^^^

Users
"""""

- New :code:`Triangle` shape
- Shapes can now be inverted using the :code:`~` operator.

Contributors
""""""""""""

- Added new shape :code:`InvertedShape` which handles the inversion of a shape
behind the scenes.
- Tests for all the composite shapes and operators.
- More documentation on how to get involved

Changed
^^^^^^^

Users
"""""

- Shapes now have defined :code:`__repr__` methods, including shapes that have
been combined, where a representation of a tree will be produced showing how
the various shapes have been combined together.
- Preview images in Jupyter notebooks are now larger by default

This release of :code:`stylo` was brought to you thanks to contributions from
the following awesome people!

- `mvinoba <https://github.com/mvinoba>`_

0.5.0

-------------------

Added
^^^^^

Users
"""""

- New Image object :code:`LayeredImage` object that can now draw more
than one object
- Added an introductory tutorial for first time users to the documentation
- Functions from the :code:`stylo.domain.transform` package can now be applied
to shapes, meaning that most images can now be made without handling domains
directly.

Contributors
""""""""""""

- Added a :code:`Drawable` class, this allows a domain, shape and colormap to
be treated as a single entity.
- Added a :code:`render_drawable` function that takes a drawable and some
existing image data and applies it to the data.
- Added a :code:`get_real_domain` function that given a width, height and scale
returns a :code:`RectangularDomain` with appropriate aspect ratio,
:math:`(0, 0)` at the centre of the image and the scale corresponding to the
interval :math:`[ymin, ymax]`
- We now make use of the :code:`[scripts]` section of :code:`Pipfile` so
running common commands is now easier to remember

+ :code:`pipenv run test`: to run the test suite
+ :code:`pipenv run lint`: to lint the codebase
+ :code:`pipenv run docs`: to run a full build of the documentation
+ :code:`pipenv run docs_fast`: to run a less complete but faster build of
the documentation.

Changed
^^^^^^^

Users
"""""

- Altered :code:`SimpleImage` to no longer take a domain, reducing the
cognitive load on first time users. It now instead takes an optional
:code:`scale` variable to control the size of the domain underneath. This
also means that the domain now automatically matches the aspect ratio of the
image so no more distortion in non-square images.

Contributors
""""""""""""

- The tests now take advantage of multi-core machines and should now run much
faster
- Building the docs now takes advantage of multi-core machines and should now
run much faster.


Fixed
^^^^^

Contributors
""""""""""""

- Fixed crashes in :code:`exampledoc.py` and :code:`apidoc.py` for first time
users
- Fixed issue with :code:`sed` on a Mac for people running the
:code:`devenv-setup.sh` script


This release of :code:`stylo` was brought to you thanks to contributions from
the following awesome people!

- `mvinoba <https://github.com/mvinoba>`_
- `LordTandy <https://github.com/LordTandy>`_
- `StephanieAngharad <https://github.com/StephanieAngharad>`_

0.4.2

-------------------

Added
^^^^^

- :code:`Image` objects can now take a :code:`size` keyword argument to adjust
the size of the matplotlib preview plots

0.4.1

-------------------

Fixed
^^^^^

- Fixed an issue with :code:`setup.py` that meant most of the code wasn't
published to PyPi!

0.4.0

-------------------

Out of the ashes of the previous version rises the biggest release to date!
Stylo has been rewritten from the ground up and should now be easier to use,
more modular and easier to extend!

None (or very little) of the original code remains and not everything has been
reimplemented yet so some of the features listed below may not be available in
this version. There is a lot more work to be done particularly in the tests and
docs departments however core functionality is now in place and it's been long
enough since the previous release.

I'm hoping that from now on releases will be smaller and more frequent as what
is now here is refined and tested to create a stable base from which Stylo can
be extended.


Added
^^^^^

Users
"""""

One of the main ideas behind the latest incarnation of stylo is the idea of
interfaces borrowed from Java. Where you have an object such as :code:`Shape`
and all shapes have certain behaviors in common represented by methods on an
interface. Then there are a number of implementations that provide the details
specific to each shape.

In stylo this is modelled by having a number of abstract classes that define
the interfaces that represent different parts of the stylo image creation
process. Then regular classes inherit from these to provide the details.

With that in mind this release provides the following "interfaces".

- New :code:`RealDomain` and :code:`RealDomainTransform` interfaces, these
model the mapping of a continuous mathematical domain
:math:`D \subset \mathbb{R}^2` onto a discrete grid of pixels.

- New :code:`Shape` interface this models the mapping of the grid of values
generated by a domain into a boolean numpy array representing which pixels
are a part of the shape.

- New :code:`ColorSpace` system this currently doesn't do much but should allow
support for the use of different color representations. Current only 8-bit
RGB values are supported.

- New :code:`ColorMap` interface, this represents the mapping of the boolean
numpy array generated by the :code:`Shape` interface into a numpy array
containing the color values that will be eventually interpreted as an image.

- New :code:`Image` interface. Implementations of this interface will implement
common image creation workflows as well as providing a unified way to preview
and save images to a file.

With the main interfaces introduced here is a (very) brief introduction to each
of the implementations provided in this release

**RealDomain**

- :code:`RectangularDomain`: Models a rectangular subset of the :math`xy`-plane
:math:`[a, b] \times [c, d] \subset \mathbb{R}^2`
- :code:`SquareDomain`: Similar to above but in the cases where :math:`c = a`
and :math:`d = b`
- :code:`UnitSquare`: Similar to above but the case where :math:`a = 0` and
:math:`b = 1`

**RealDomainTransform**

- :code:`HorizontalShear`: Given a domain this applies a horizontal shear to it
- :code:`Rotation`: Given a domain this rotates it by a given angle
- :code:`Translation`: Given a domain this applies a translation to it
- :code:`VerticalShear`: Given a domain this applies a vertical shear to it

**Shape**

- :code:`Square`
- :code:`Rectangle`
- :code:`Circle`
- :code:`Ellipse`

**ColorSpace**

- :code:`RGB8`: 8-bit RGB valued colors

**ColorMap**

- :code:`FillColor`: Given a background and a foreground color. Color all
:code:`False` pixels with the background color and color all the :code:`True`
pixels the foreground color.

**Image**

- :code:`SimpleImage`: Currently the only image implementation, this implements
one of the simplest workflows that can result in an interesting image. Take
a :code:`Domain`, pass it to a :code:`Shape` and then apply a :code:`ColorMap`
to the result.

Extenders/Contributors
""""""""""""""""""""""

From the beginning this new attempt at :code:`stylo` has been designed with
extensibility in mind so included in the library are also a number of utilities
aimed to help you develop your own tools that integrate well with the rest of
stylo.

**Domains** and **DomainTransforms**

While :code:`stylo` only currently ships with :code:`RealDomain` and
:code:`RealDomainTransform` interfaces it is developed in a way to allow the
addition of new "families" of domain. If you want to create your own stylo
provides the following functions:

- :code:`define_domain`: This will write your base domain class (like the
:code:`RealDomain`) just give it a name and a list of parameters.
- :code:`define_domain_transform`: The will write the :code:`DomainTransform`
base class for you.

In addition to defining new families :code:`stylo` provides a few helper
classes to help you write your own domains and transforms for the existing
:code:`RealDomain` family

- :code:`PolarConversion`: If your domain is only "interesting" in cartesian
coordinates this helper class will automatically write the conversion to
polar coordinates for you.
- :code:`CartesianConversion`: If your domain is only "interesting" in polar
coordinates this helper class will automatically write the conversion to
cartesian coordinates for you.

**stylo.testing**

:code:`stylo` also comes with a testing package that provides a number of
utilities to help you ensure that any extensions you write will integrate well
with the rest of :code:`stylo`

- :code:`BaseRealDomainTest`: This is a class that you can base your test case
on for any domains in the :code:`RealDomain` family to ensure that they
function as expected.
- :code:`define_domain_test`: Similar to the :code:`define_domain` and
:code:`define_domain_transform` functions this defines a base test class to
ensure that domains in your new family work as expected.
- :code:`BaseShapeTest` Basing your test case on this for any new shapes will
ensure that your shapes will function as expected by the rest of :code:`stylo`
- :code:`define_benchmarked_example`: This is for those of you wishing to
contribute an example to the documentation, using this function with your
example code will ensure that your example is automatically included in the
documentation when it is next built.

**stylo.testing.strategies**

This module defines a number of hypothesis strategies for common data types in
:code:`stylo`. Using these (and hypothesis) in your test cases where possible
will ensure that your objects will work with the same kind of data as
:code:`stylo` itself.


Removed
^^^^^^^

Everything mentioned below.

Page 2 of 3

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.