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.4.dev3.tar.gz (125.2 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.4.dev3-py3-none-any.whl (170.6 kB view details)

Uploaded Python 3

File details

Details for the file drawlib-0.2.4.dev3.tar.gz.

File metadata

  • Download URL: drawlib-0.2.4.dev3.tar.gz
  • Upload date:
  • Size: 125.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for drawlib-0.2.4.dev3.tar.gz
Algorithm Hash digest
SHA256 66473ff8165cf7a976f1b962923f0ac3b60be09951d764ab70b6d09f4ab5c7f7
MD5 ed7a6f73d11e823ed6ad15cc1f26e323
BLAKE2b-256 408852d65ee0b8315ea44c3755eaf7bfef6e4597054d9714b757c9976d8210c0

See more details on using hashes here.

File details

Details for the file drawlib-0.2.4.dev3-py3-none-any.whl.

File metadata

  • Download URL: drawlib-0.2.4.dev3-py3-none-any.whl
  • Upload date:
  • Size: 170.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for drawlib-0.2.4.dev3-py3-none-any.whl
Algorithm Hash digest
SHA256 83940b1541fde18f0d179325cfe5773de07509456b8630b83db237ab6aa4b749
MD5 e18d95c47b7b408d96221ad83d456c6e
BLAKE2b-256 a7592e1acb42925e1cb93a923eee403b16038bac8a92d990777d6d14f4843c65

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