Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Gdspy is a Python module for creation and manipulation of GDSII stream files. Key features for the creation of complex CAD layouts are included:
Gdspy also includes a simple layout viewer.
Typical applications of Gdspy are in the fields of electronic chip design, planar lightwave circuit design, and mechanical engineering.
In trying to improve the performance of Gdspy for large layouts, we ended up concluding that the best way to reach our goal was to rewrite the critical parts of the library as a C extension. It turns out that beside obvious functions, method calling has a big impact in performance due to the overhead it introduces. The best solution was to re-design the whole project as a C++ library with a thin Python wrapper: thus was born Gdstk, the GDSII Tool Kit.
Therefore, version 1.6 will be the last major release of Gdspy, with development focused only on bug fixes. Users are encouraged to move from Gdspy to Gdstk: although their API is not 100% compatible, the new module should be familiar enough to allow a quick transition.
LayoutViewer
GUI)Option 1: using pip:
python -m pip install --user gdspy
Option 2: download the source from github and build/install with:
python setup.py install
The preferred option is to install pre-compiled binaries from here.
Installation via pip
and building from source as above are also possible, but an appropriate build environment is required for compilation of the C extension modules.
The complete documentation is available here.
The source files can be found in the docs
directory.
Help support Gdspy development by donating via PayPal or sponsoring me on GitHub
Cell.get_texttypes
.get_labels
.Cell.write_svg
when missing references.Cell.remove_polygons
(thanks Troy for the contribution).Cell.get_polygons
Cell.get_polygons
with specified layer and datatype.boolean
for complex geometries that freeze the operation.boolean
for bugs with self-intersecting holes and holes horizontal edges.Path.smooth
not finding _hobby
function.Label
contains special characters.Cell.copy
.get_polygons
for Cell
, CellReference
and CellArray
.LayoutViewer
._bounding_boxes
. Only cells cache their bounding boxes.Cell.copy
where the whole dependency tree would be copied on a deep copy creation.GdsLibrary.extract
(thanks collineps for finding the problem).Cell.write_svg
function to export an SVG image of the cell.GdsLibrary.new_cell
function to quickly create and add cells to a library.GdsLibrary.add
can update references when a cell is overwritten.GdsLibrary.remove
to allow cells to be properly removed from libraries.GdsLibrary.rename_cell
to rename cells in libraries.GdsLibrary.replace_references
to easily replace referenced cells in libraries.GdsLibrary.add
can add dependencies recursively.GdsLibrary
objects yields all its cells.Cell
objects yield all its polygons, paths, labels and references.*.to_gds
functions in order to improve write efficiency (this should not be a problem for most users, since gdspy.write_gds
and Cell.write_gds
remain the same).GdsLibrary.cell_dict
to GdsLibrary.cells
.gdspy.current_library
, gdspy.write_gds
, gdspy.fast_boolen
, GdsLibrary.extract
.FlexPath
and RobustPath
.FlexPath
and RobustPath
references.FlexPath
.FlexPath
and RobustPath
classes: more efficient path generation when using the original GDSII path specification.Curve
class: SVG-like polygon creation.PolygonSet.mirror
(thanks to Daan Waardenburg for the contribution).Path.bezier
to create paths based on Bézier curves.Path.smooth
to create paths based on smooth interpolating curves.get_gds_units
to get units used in a GDSII file without loading.get_binary_cells
to load only the binary GDSII representation of cell from a file.tolerance
to Round
, Path.arc
, Path.turn
, and Path.parametric
to automatically control the number of points in the final polygons.binary_cells
to GDSII writing functions to support get_binary_cells
.rename_template
to GdsLibrary.read_gds
for flexible cell renaming (thanks to @yoshi74ls181 for the contribution).slice
to avoid creating empty PolygonSet
.timestamp
to GDSII writing functions.Round
to support creating ellipses.poly_warnings
.anchor
in Label
now raises an error, instead of emitting a warning.PolygonSet.fillet
on a per-vertex basis.PolygonSet
becomes the base class for all polygons, in particular Polygon
and Rectangle
.Cell.remove_polygons
and Cell.remove_labels
functions to allow filtering a cell contents based, for example, on each element's layer.PolygonSet.scale
utility method.PolygonSet.get_bounding_box
utility method.timestamp
to Cell.to_gds
, GdsLibrary.write_gds
and GdsWriter
.unit
and precision
arguments to GdsLibrary
initialization and removed from its write_gds
method.unit
in GdsLibrary.read_gds
.slice
to avoid errors when slicing in multiple positions at once.PolygonSet.fracture
to reduce number of function calls.CellReference
and CellArray
.GdsLibrary
can be created directly from a GDSII fileGdsLibrary.read_gds
GdsLibrary.add
gdsii_hash
function.precision
parameter to _chop
, Polygon.fracture
, Polygon.fillet
, PolygonSet.fracture
, PolygonSet.fillet
, and slice
.get_labels
to Cell
, CellReference
, and CellArray
)._chop
that affected Polygon.fracture
, PolygonSet.fracture
, and slice
.GdsLibrary
to allow user to work with multiple library simultaneously.GdsImport
in favor of GdsLibrary
.gds_print
to write_gds
and GdsPrint
to GdsWriter
.inside
function sometimes reversing the order of the output.fast_boolean
.deep_copy
being inverted in Cell.copy
.Polygon.fillet
(thanks to Adam McCaughan for the contribution).inside
fucntion to perform point-in-polygon tests (thanks to @okianus for the contribution).offset
.translate
method to geometric entities (thanks John Bell for the commit).fast_boolean
function based on the Clipper library with much better performance than the old boolean
.offset
signature to also use the Clipper library (this change breaks compatibility with previous versions).offset
function.GdsPrint
class for incremental GDSII creation (thanks to Jack Sankey for the contribution).Round
, Path.arc
, and Path.turn
changed to resolution of 0.01 drawing units.Path.parametric
accepts callable final_distance
and final_width
for non-linear tapering.ends
to PolyPath
.GdsImport
.Path
curve has width larger than twice its radius (self-intersecting polygon).LayoutViewer
.LayoutViewer
shows cell labels for referenced cells.get_polygons
returns (referenced) cell name if depth
< 1 and by_spec
is True.get_bounding_box
when empty cells are referenced.GdsImport
and many speed improvements in bounding box calculations (thanks to Gene Hilton for the patch).LayoutViewer
improvements (not backwards compatible).by_layer
to by_spec
(not backwards compatible).get_datatypes
to Cell
.single_datatype
to Cell.flatten
.gds_image
and dropped the optional PIL dependency.axis_offset
to Path.segment
allowing creation of asymmetric tapers.x_reflection
to Label
.CellArray.get_bounding_box
(thanks to George McLean for the fix)Cell.get_bounding_box
returns None
for empty cells.Label
class.boolean
.PolygonSet
.Polygon
and PolygonSet
.boolean
function via caching.get_bounding_box
and get_layers
to Cell
.top_level
to GdsImport
.LayoutViewer
LayoutViewer
now reflect the colors of the outlines and canvas backgroung.LayoutViewer
Cell.cell_list
changed to Cell.cell_dict
.boolean
.LayoutViewer
is now respected in the GUI.boolean
. It is fixed at 1e-13 for merging close points, otherwise machine precision is used.gds_image
now accepts cell names as input.depth
to get_polygons
exclude_layers
from LayoutViewer
changed to hidden_layers
and behavior changed accordingly.LayoutVIewer
hides/unhides all other layers.LayoutViewer
.LayoutViewer
.gds_print
also accepts file name as input.LayoutViewer
.LayoutViewer
.LayoutViewer
.Cell.cell_list
is now a dictionary indexed by name, instead of a list.Cell.cell_list
.CellReference
and CellArray
accept name of cells as input.__version__
.boolean
, which affected the way polygons with more vertices then the maximum were fractured.gds_image
accepts an extra color argument for the image background.LayoutViewer
have the same background color as the viewer.boolean
and slice
now also accept CellReference
and CellArray
as input.fracture
to Polygon
and PolygonSet
to automatically slice polygons into parts with a predefined maximal number of vertices.fillet
to Polygon
and PolygonSet
to round corners of polygons.ValueError
is raised if cell names are duplicated.LayoutViewer
.gds_image
accepts cells, instead of lists.gds_image
.LayoutViewer
stores bounding box information for all visited layers to save rendering time.gds_view
function, superseded by the LayoutViewer, along with all dependencies to matplotlib.boolean
which affected polygons with series of collinear vertices.slice
polygons along straight lines parallel to an axis.Home
or a
keys.PolygonSet
is the new base class for Round
, which might bring some incompatibility issues with older scripts.Round
elements, PolyPath
, L1Path
, and Path arc
, turn
and parametric
sections are now automatically fractured into pieces defined by a maximal number of points.max_points
in boolean changed to 199.Polygon
and PolygonSet
.parametric
paths to change their distance to each other.PolyPath
class to easily create paths with sharp corners.None
as item in the colors parameter of LayoutViewer
to make layers invisible.LayoutViewer
(change outline color with the shift key pressed)LayoutViewer
canvasLayoutViewer
to standard arrow.LayoutViewer
(mouse wheel and ruler tool).gds_image
displays an error message instead of crashing when PIL
is not found.LayoutViewer
, which uses Tkinter (included in all Python distributions) to display the GDSII layout with better controls then the gds_view
function. This eliminates the matplotlib
requirement for the viewer functionality.turn
method of Path
.boolean
function that would give an error when not using Polygon
or PolygonSet
as input objects.get_polygons
to Cell
, CellReference
and CellArray
.Cell
.flatten
method to Cell
to remove references (or array references) to other cells.boolean
output polygons based on the number of vertices to respect the 199 GDSII limit.L1Path
class for Manhattan geometry (L1 norm) paths.fill
from gds_view
and added a more flexible one: style
.boolean
operator affecting polygons with holes.PolygonSet
.PolygonSet
has more than 199 pointsturn
method to Path
, which is easier to use than arc
.Path
to keep the information used by the segment
and turn
methods.Text
does not have a default value any longer.format
in the function gds_view
was changed to fill
(to avoid confusion with the built-in function format
).gds_view
to avoid the automatic call to matplotlib.pyplot.show()
.gds_view
, if a layer number is greater than the number of formats defined, the formats are cycled.\n
and \t
characters.Text
re-written with a different font with no overlaps and correct size.to_gds
of class Rectangle
.gds_view
function to display the GDSII structure using the matplotlib module.cell_list
to class Cell to hold a list of all Cell created.cells=Cell.cell_list
in the function gds_print
.FAQs
Python module for creating/importing/merging GDSII files.
We found that gdspy demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.