Skip to main content

Python drawing library. Illustration as Code.

Project description

About

Drawlib is a pure Python drawing library crafted to facilitate Illustration as Code rather than focusing solely on creating polished illustrations. Witness Python code in action generating a circular image:

Example

In this example, we import drawlib APIs and call the circle() function. We provide XY coordinates, radius, and optional style with ShapeStyle class.

Defining styles directly within the drawing object is straightforward, similar to writing styles within HTML tags. However, just as HTML recommends using a separate CSS file, Drawlib recommends creating a separate styling code file and referencing it in multiple illustration codes. Following this guide simplifies the above code.

Documentation

We have official documentation. Please check it out if you're interested in Drawlib.

Drawlib Official Documentation

API Design

Drawlib offers a range of basic drawing features, including:

  • Icon
  • Image
  • Line
  • Shape
  • Text
  • Others

All with a consistent syntax.

Here is a brief overview of the library's API design.

Example

As you can see, the core drawing components rely on the same canvas and coordinate systems. Styling for each component is slightly different but mostly similar. If you require advanced use cases, many helper classes and functions can resolve the situation.

Good IDE Help and Python Ecosystem

It's important to note that drawlib is a pure Python library. This means you can leverage the entire Python ecosystem, including:

  • Accessing library help and code completion via IDEs.
  • Using programming constructs such as creating functions for grouping drawing tasks and using loops.

Here is a screenshot of my VS Code providing help for the ShapeStyle class when I point to it. All other functions and classes are also well-documented, offering comprehensive help and intelligent code completion.

Example

Good for Documentations and Books

In today's world, many technical documents are managed using version control systems such as Git. However, managing illustrations poses a challenge as they are typically binary files rather than text-based. Drawlib offers a solution by generating illustrations from pure Python code. This means that if you create your illustrations using Python and drawlib, you can manage them using version control systems too.

Drawlib is optimized for drawing a large number of illustrations with a consistent style. You can easily achieve this by creating a style code and importing it into your illustration codes. Here is a typical use case of drawlib.

Use Case

Integrating Drawlib into your workflow is straightforward and doesn’t significantly differ from managing markdown documents. If you create your documentation using markdown or a similar format, you can easily adopt drawlib.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

drawlib-0.2.3.tar.gz (129.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

drawlib-0.2.3-py3-none-any.whl (173.2 kB view details)

Uploaded Python 3

File details

Details for the file drawlib-0.2.3.tar.gz.

File metadata

  • Download URL: drawlib-0.2.3.tar.gz
  • Upload date:
  • Size: 129.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.9.19 Darwin/23.6.0

File hashes

Hashes for drawlib-0.2.3.tar.gz
Algorithm Hash digest
SHA256 75639c4cf6ad987244a8c0246b124f96131491e97ea851484e475d81646eaf5f
MD5 a9956b7f1eae0946f4c00c4559db5535
BLAKE2b-256 bf1927da259cfbd6009ee980bb492c42c239f0408f28901d1dc0c6388758a572

See more details on using hashes here.

File details

Details for the file drawlib-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: drawlib-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 173.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.9.19 Darwin/23.6.0

File hashes

Hashes for drawlib-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 55e6b2bc4ac88ca34558aae5ac67da83782ef5ec7a8f20925d39a3debcc92dc3
MD5 62a7f462cc08582d1ce7512353861493
BLAKE2b-256 fbb65047e5fcf222867357a56c2e284809bdfab6bd7a382090c39090c39ea9db

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page