Skip to main content

Python module for creation and manipulation of GDSII files.

Project description

GDSTK

Boost Software License - Version 1.0 Tests Runner Publish Docs Package Builder Downloads

Gdstk (GDSII Tool Kit) is a C++ library for creation and manipulation of GDSII and OASIS files. It is also available as a Python module meant to be a successor to Gdspy.

Key features for the creation of complex CAD layouts are included:

  • Boolean operations on polygons (AND, OR, NOT, XOR) based on clipping algorithm
  • Polygon offset (inward and outward rescaling of polygons)
  • Efficient point-in-polygon solutions for large array sets

Typical applications of Gdstk are in the fields of electronic chip design, planar lightwave circuit design, and mechanical engineering.

Documentation

The complete documentation is available here.

The source files can be found in the docs directory.

Installation

C++ library only

The C++ library is meant to be used by including it in your own source code.

If you prefer to install a static library, the included CMakeLists.txt should be a good starting option (use -DCMAKE_INSTALL_PREFIX=path to control the installation path):

cmake -S . -B build
cmake --build build --target install

The library depends on zlib and qhull

Python wrapper

The Python module can be installed via pip, Conda or compiled directly from source. It depends on:

From PyPI

Simply run the following to install the package for the current user:

pip install --user gdstk

Or download and install the available wheels manually.

From source

Installation from source requires the build module (plus CMake and Ninja, for faster compilation):

pip install --user build

With that, simply build the wheel package using:

python -m build -w

This will create a dist directory containing the compiled .whl package that can be installed with pip.

Support

Help support Gdstk development by donating via PayPal or sponsoring me on GitHub.

Benchmarks

The benchmarks directory contains a few tests to compare the performance gain of the Python interface versus Gdspy. They are only for reference; the real improvement is heavily dependent on the type of layout and features used. If maximal performance is important, the library should be used directly from C++, without the Python interface.

Timing results were obtained with Python 3.11 on an Intel Core i7-9750H @ 2.60 GHz They represent the best average time to run each function out of 16 sets of 8 runs each.

Benchmark Gdspy 1.6.13 Gdstk 0.9.41 Gain
10k_rectangles 80.2 ms 4.87 ms 16.5
1k_circles 312 ms 239 ms 1.3
boolean-offset 187 μs 44.7 μs 4.19
bounding_box 36.7 ms 170 μs 216
curves 1.52 ms 30.9 μs 49.3
flatten 465 μs 8.17 μs 56.9
flexpath 2.88 ms 16.1 μs 178
flexpath-param 2.8 ms 585 μs 4.78
fracture 929 μs 616 μs 1.51
inside 161 μs 33 μs 4.88
read_gds 2.68 ms 94 μs 28.5
read_rawcells 363 μs 52.4 μs 6.94
robustpath 171 μs 8.68 μs 19.7

Memory usage per object for 100000 objects:

Object Gdspy 1.6.13 Gdstk 0.9.41 Reduction
Rectangle 601 B 232 B 61%
Circle (r = 10) 1.68 kB 1.27 kB 24%
FlexPath segment 1.48 kB 439 B 71%
FlexPath arc 2.26 kB 1.49 kB 34%
RobustPath segment 2.89 kB 920 B 69%
RobustPath arc 2.66 kB 920 B 66%
Label 407 B 215 B 47%
Reference 160 B 179 B -12%
Reference (array) 189 B 181 B 4%
Cell 430 B 229 B 47%

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

gdstk-0.9.51.tar.gz (311.2 kB view hashes)

Uploaded Source

Built Distributions

gdstk-0.9.51-cp312-cp312-win_amd64.whl (496.7 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

gdstk-0.9.51-cp312-cp312-musllinux_1_1_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ x86-64

gdstk-0.9.51-cp312-cp312-musllinux_1_1_i686.whl (1.2 MB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ i686

gdstk-0.9.51-cp312-cp312-manylinux_2_28_x86_64.whl (532.1 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.28+ x86-64

gdstk-0.9.51-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (533.5 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

gdstk-0.9.51-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl (597.6 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ i686

gdstk-0.9.51-cp312-cp312-macosx_10_9_x86_64.whl (468.6 kB view hashes)

Uploaded CPython 3.12 macOS 10.9+ x86-64

gdstk-0.9.51-cp312-cp312-macosx_10_9_universal2.whl (909.1 kB view hashes)

Uploaded CPython 3.12 macOS 10.9+ universal2 (ARM64, x86-64)

gdstk-0.9.51-cp311-cp311-win_amd64.whl (495.9 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

gdstk-0.9.51-cp311-cp311-musllinux_1_1_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

gdstk-0.9.51-cp311-cp311-musllinux_1_1_i686.whl (1.2 MB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ i686

gdstk-0.9.51-cp311-cp311-manylinux_2_28_x86_64.whl (531.1 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.28+ x86-64

gdstk-0.9.51-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (531.7 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

gdstk-0.9.51-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl (596.7 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686

gdstk-0.9.51-cp311-cp311-macosx_10_9_x86_64.whl (469.4 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

gdstk-0.9.51-cp311-cp311-macosx_10_9_universal2.whl (911.5 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64)

gdstk-0.9.51-cp310-cp310-win_amd64.whl (495.9 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

gdstk-0.9.51-cp310-cp310-musllinux_1_1_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

gdstk-0.9.51-cp310-cp310-musllinux_1_1_i686.whl (1.2 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ i686

gdstk-0.9.51-cp310-cp310-manylinux_2_28_x86_64.whl (531.0 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.28+ x86-64

gdstk-0.9.51-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (531.7 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

gdstk-0.9.51-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl (596.7 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686

gdstk-0.9.51-cp310-cp310-macosx_10_9_x86_64.whl (469.3 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

gdstk-0.9.51-cp310-cp310-macosx_10_9_universal2.whl (911.5 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64)

gdstk-0.9.51-cp39-cp39-win_amd64.whl (495.9 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

gdstk-0.9.51-cp39-cp39-musllinux_1_1_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

gdstk-0.9.51-cp39-cp39-musllinux_1_1_i686.whl (1.2 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ i686

gdstk-0.9.51-cp39-cp39-manylinux_2_28_x86_64.whl (530.9 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.28+ x86-64

gdstk-0.9.51-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (531.7 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

gdstk-0.9.51-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl (596.6 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686

gdstk-0.9.51-cp39-cp39-macosx_10_9_x86_64.whl (469.4 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

gdstk-0.9.51-cp39-cp39-macosx_10_9_universal2.whl (911.6 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64)

gdstk-0.9.51-cp38-cp38-win_amd64.whl (495.9 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

gdstk-0.9.51-cp38-cp38-musllinux_1_1_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

gdstk-0.9.51-cp38-cp38-musllinux_1_1_i686.whl (1.2 MB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ i686

gdstk-0.9.51-cp38-cp38-manylinux_2_28_x86_64.whl (530.9 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.28+ x86-64

gdstk-0.9.51-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (531.7 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

gdstk-0.9.51-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl (596.6 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ i686

gdstk-0.9.51-cp38-cp38-macosx_10_9_x86_64.whl (469.4 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

gdstk-0.9.51-cp38-cp38-macosx_10_9_universal2.whl (911.7 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ universal2 (ARM64, x86-64)

Supported by

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