diff --git a/.bumpversion.cfg b/.bumpversion.cfg deleted file mode 100644 index 2feac60..0000000 --- a/.bumpversion.cfg +++ /dev/null @@ -1,12 +0,0 @@ -[bumpversion] -current_version = 0.0.3 -commit = True -tag = True - -[bumpversion:file:./pyproject.toml] - -[bumpversion:file:./README.md] - -[bumpversion:file:gf180/__init__.py] - -[bumpversion:file:gf180/klayout/grain.xml] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 78c7e3a..6526126 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,22 +1,72 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: 9260cbc9c84c06022993bfbcc42fdbf0305c5b8e + rev: "9260cbc9c84c06022993bfbcc42fdbf0305c5b8e" hooks: + - id: check-added-large-files + - id: check-case-conflict + - id: check-merge-conflict + - id: check-symlinks + - id: check-yaml + - id: debug-statements - id: end-of-file-fixer + - id: mixed-line-ending + - id: name-tests-test + args: ["--pytest-test-first"] - id: trailing-whitespace - - id: requirements-txt-fixer - - repo: https://github.com/psf/black - rev: 25d886f52c2bbbb58386ac8050f4e67952507bc7 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: "v0.1.7" hooks: - - id: black + - id: ruff + - id: ruff-format - - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: "6a0ba1854991b693612486cc84a2254de82d071d" + - repo: https://github.com/shellcheck-py/shellcheck-py + rev: 953faa6870f6663ac0121ab4a800f1ce76bca31f hooks: - - id: ruff + - id: shellcheck + + # - repo: https://github.com/pre-commit/mirrors-mypy + # rev: "v1.0.1" + # hooks: + # - id: mypy + # exclude: ^(docs/|example-plugin/|tests/fixtures) + # additional_dependencies: + # - "pydantic" + - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks - rev: v2.10.0 + rev: d2425a62376c2197448cce2f825d5a0c3926b862 hooks: - id: pretty-format-toml args: [--autofix] + + # - repo: https://github.com/aristanetworks/j2lint.git + # rev: 742a25ef5da996b9762f167ebae9bc8223e8382e + # hooks: + # - id: j2lint + # types: [file] + # files: \.(j2|yml|yaml)$ + # args: [--extensions, "j2,yml,yaml", --ignore, jinja-statements-delimiter, jinja-statements-indentation, --] + # exclude: .github/.* + - repo: https://github.com/codespell-project/codespell + rev: 38bc4a97f6e22827e86526148efa38f1044a97f8 + hooks: + - id: codespell + additional_dependencies: + - tomli + + # - repo: https://github.com/kynan/nbstripout + # rev: e4c5b4dcbab4afa0b88b7a9243db42b1a8d95dde + # hooks: + # - id: nbstripout + # files: ".ipynb" + # - repo: https://github.com/pre-commit/pygrep-hooks + # rev: 7b4409161486c6956bb3206ce96db5d56731b1b9 # Use the ref you want to point at + # hooks: + # - id: python-use-type-annotations + # - repo: https://github.com/PyCQA/bandit + # rev: fe1361fdcc274850d4099885a802f2c9f28aca08 + # hooks: + # - id: bandit + # args: [--exit-zero] + # # ignore all tests, not just tests data + # exclude: ^tests/ diff --git a/docs/notebooks/intro.py b/docs/notebooks/intro.py index f7b8cf8..94b20ec 100644 --- a/docs/notebooks/intro.py +++ b/docs/notebooks/intro.py @@ -25,4 +25,4 @@ # %% c = gf180.diode_dw2ps() -c +c.plot() diff --git a/docs/write_cells.py b/docs/write_cells.py index 9962bf8..a1952f7 100644 --- a/docs/write_cells.py +++ b/docs/write_cells.py @@ -44,7 +44,7 @@ [ f"{p}={repr(sig.parameters[p].default)}" for p in sig.parameters - if isinstance(sig.parameters[p].default, (int, float, str, tuple)) + if isinstance(sig.parameters[p].default, int | float | str | tuple) and p not in skip_settings ] ) diff --git a/gf180/cells/klayout/pymacros/README.md b/gf180/cells/klayout/pymacros/README.md index 3041a43..4d6cbee 100644 --- a/gf180/cells/klayout/pymacros/README.md +++ b/gf180/cells/klayout/pymacros/README.md @@ -28,6 +28,6 @@ klayout -e 4. Create a new layout for testing. 5. Press on insert instance. 6. Go to the instance menu and select "GF180MCU" library from the library list. -7. Select the search botton and it will give the list of PCells that is available in the library. +7. Select the search button and it will give the list of PCells that is available in the library. 8. Select any cell and it will show the cell. 9. Go to the PCell tap and change the parameters as needed to change the layout of the PCells. diff --git a/gf180/cells/klayout/pymacros/cells/bjt.py b/gf180/cells/klayout/pymacros/cells/bjt.py index 08c514f..a3152df 100644 --- a/gf180/cells/klayout/pymacros/cells/bjt.py +++ b/gf180/cells/klayout/pymacros/cells/bjt.py @@ -74,7 +74,7 @@ def transformation_from_shape_impl(self): def produce_impl(self): # This is the main part of the implementation: create the layout - self.percision = 1 / self.layout.dbu + self.precision = 1 / self.layout.dbu npn_instance = draw_bjt(layout=self.layout, device_name=self.Type) write_cells = pya.CellInstArray( npn_instance.cell_index(), @@ -141,7 +141,7 @@ def transformation_from_shape_impl(self): def produce_impl(self): # This is the main part of the implementation: create the layout - self.percision = 1 / self.layout.dbu + self.precision = 1 / self.layout.dbu pnp_instance = draw_bjt(layout=self.layout, device_name=self.Type) write_cells = pya.CellInstArray( pnp_instance.cell_index(), diff --git a/gf180/cells/klayout/pymacros/cells/draw_fet.py b/gf180/cells/klayout/pymacros/cells/draw_fet.py index e1170b1..9e8328f 100644 --- a/gf180/cells/klayout/pymacros/cells/draw_fet.py +++ b/gf180/cells/klayout/pymacros/cells/draw_fet.py @@ -63,7 +63,7 @@ def get_patt_label(nl_b, nl, nt, nt_e, g_label, nl_u, nt_o): Args : nl_b : number of bottom connected gates transistors nl : number of transistor - nt : patterns of tansistor [with out redundency] + nt : patterns of tansistor [with out redundancy] nt_e : number of transistor with even order g_label : list of transistors gate label nl_u : number of upper connected gates transistors @@ -99,13 +99,13 @@ def alter_interdig( nl: int = 1, patt_label: bool = False, ) -> gf.Component: - """Returns interdigitation polygons of gate with alterating poly contacts + """Returns interdigitation polygons of gate with alternating poly contacts Args : sd_diff : source/drain diffusion rectangle pc1 : first poly contact array pc2 : second poly contact array - poly_con : componenet of poly contact + poly_con : component of poly contact sd_diff_inter : inter source/drain diffusion rectangle l_gate : gate length inter_sd_l : inter diffusion length @@ -373,7 +373,7 @@ def interdigit( sd_diff : source/drain diffusion rectangle pc1 : first poly contact array pc2 : second poly contact array - poly_con : componenet of poly contact + poly_con : component of poly contact sd_diff_inter : inter source/drain diffusion rectangle l_gate : gate length inter_sd_l : inter diffusion length @@ -385,9 +385,7 @@ def interdigit( if nf == len(patt): pat = list(patt) - nt = ( - [] - ) # list to store the symbols of transistors and thier number nt(number of transistors) + nt = [] # list to store the symbols of transistors and their number nt(number of transistors) [nt.append(x) for x in pat if x not in nt] nl = len(nt) @@ -572,10 +570,10 @@ def interdigit( # @gf.cell def hv_gen(c, c_inst, volt, dg_encx: float = 0.1, dg_ency: float = 0.1): - """Returns high volatge related polygons + """Returns high voltage related polygons Args : - c_inst : dualgate enclosed componenet + c_inst : dualgate enclosed component volt : operating voltage dg_encx : dualgate enclosure in x_direction dg_ency : dualgate enclosure in y_direction @@ -627,7 +625,7 @@ def bulk_gr_gen( """Returns guardring Args : - c_inst : componenet enclosed by guardring + c_inst : component enclosed by guardring comp_spacing : spacing between comp polygons poly2_comp_spacing : spacing between comp and poly2 polygons volt : operating voltage @@ -789,7 +787,7 @@ def bulk_gr_gen( operation="A-B", layer=layer["metal1"], ) - ) # metal1_gaurdring + ) # metal1_guardring hv_gen(c, c_inst=B, volt=volt, dg_encx=dg_enc_cmp, dg_ency=dg_enc_cmp) @@ -1109,13 +1107,13 @@ def add_inter_sd_labels( """Adds label to intermediate source/drain diffusion Args : - c : instance componenet of the device + c : instance component of the device nf : number of fingers sd_label : required source and drain labels list - poly1 : componenet of poly array + poly1 : component of poly array l_gate : length of fet gate inter_sd_l : length of intermediate source/drain diffusion - sd_diff_inter : componenet of intermediate source/drain polygon + sd_diff_inter : component of intermediate source/drain polygon label: boolean of having labels layer : layer of label con_bet_fin : boolean of having contact between fingers @@ -1143,14 +1141,14 @@ def add_gate_labels(c, g_label, pc1, c_pc, pc_spacing, nc1, nc2, pc2, label, lay """Adds gate label when label is enabled Args : - c : instance componenet of the device + c : instance component of the device g_label : required gate labels list - pc1 : componenet of poly array1 - c_pc : componenet of poly array element + pc1 : component of poly array1 + c_pc : component of poly array element pc_spacing : float of space between labels nc1 : number of columns in poly array1 nc2 : number of columns in poly array2 - pc2 : componenet of poly array2 + pc2 : component of poly array2 label : boolean of having labels layer : layer of labels nf : number of fingers @@ -1287,7 +1285,7 @@ def draw_nfet( inter_sd_l : Float of source and drain diffusion length between fingers nf : integer of number of fingers M : integer of number of multipliers - grw : gaurd ring width when enabled + grw : guard ring width when enabled type : string of the device type bulk : String of bulk connection type (None, Bulk Tie, Guard Ring) con_bet_fin : boolean of having contacts for diffusion between fingers @@ -1896,7 +1894,7 @@ def draw_pfet( inter_sd_l : Float of source and drain diffusion length between fingers nf : integer of number of fingers M : integer of number of multipliers - grw : gaurd ring width when enabled + grw : guard ring width when enabled type : string of the device type bulk : String of bulk connection type (None, Bulk Tie, Guard Ring) con_bet_fin : boolean of having contacts for diffusion between fingers diff --git a/gf180/cells/klayout/pymacros/cells/efuse.py b/gf180/cells/klayout/pymacros/cells/efuse.py index 0070d7b..03cf5dc 100644 --- a/gf180/cells/klayout/pymacros/cells/efuse.py +++ b/gf180/cells/klayout/pymacros/cells/efuse.py @@ -78,13 +78,13 @@ def transformation_from_shape_impl(self): def produce_impl(self): # This is the main part of the implementation: create the layout - self.percision = 1 / self.layout.dbu + self.precision = 1 / self.layout.dbu efuse_instance = draw_efuse(layout=self.layout) write_cells = pya.CellInstArray( efuse_instance.cell_index(), pya.Trans(pya.Point(0, 0)), - pya.Vector(self.x_spacing * self.percision, 0), - pya.Vector(0, self.y_spacing * self.percision), + pya.Vector(self.x_spacing * self.precision, 0), + pya.Vector(0, self.y_spacing * self.precision), self.array_x, self.array_y, ) diff --git a/gf180/cells/klayout/pymacros/cells/via_generator.py b/gf180/cells/klayout/pymacros/cells/via_generator.py index 231c41b..60496ab 100644 --- a/gf180/cells/klayout/pymacros/cells/via_generator.py +++ b/gf180/cells/klayout/pymacros/cells/via_generator.py @@ -37,7 +37,7 @@ def via_generator( ) -> gf.Component: """ return only vias withen the range xrange and yrange while enclosing by via_enclosure - and set number of rows and number of coloumns according to ranges and via size and spacing + and set number of rows and number of columns according to ranges and via size and spacing """ diff --git a/gf180/fet.py b/gf180/fet.py index 88ab9f2..28ff641 100644 --- a/gf180/fet.py +++ b/gf180/fet.py @@ -1,5 +1,5 @@ -from math import ceil, floor from functools import partial +from math import ceil, floor import gdsfactory as gf from gdsfactory.typings import Float2, LayerSpec, Optional, Strs @@ -51,7 +51,7 @@ def get_patt_label(nl_b, nl, nt, nt_e, g_label, nl_u, nt_o): Args: nl_b : number of bottom connected gates transistors. nl : number of transistor. - nt : patterns of tansistor [with out redundency]. + nt : patterns of tansistor [with out redundancy]. nt_e : number of transistor with even order. g_label : list of transistors gate label. nl_u : number of upper connected gates transistors. @@ -90,7 +90,7 @@ def alter_interdig( nl: int = 1, patt_label: bool = False, ) -> gf.Component: - """Returns interdigitation polygons of gate with alterating poly contacts + """Returns interdigitation polygons of gate with alternating poly contacts Args : sd_diff : source/drain diffusion rectangle. @@ -99,7 +99,7 @@ def alter_interdig( sd_l : source/drain length. nf : number of fingers. pat: string of the required pattern. - poly_con : componenet of poly contact. + poly_con : component of poly contact. sd_diff_inter : inter source/drain diffusion rectangle. l_gate : gate length. inter_sd_l : inter diffusion length. @@ -387,9 +387,7 @@ def interdigit( if nf == len(patt): pat = list(patt) - nt = ( - [] - ) # list to store the symbols of transistors and thier number nt(number of transistors) + nt = [] # list to store the symbols of transistors and their number nt(number of transistors) [nt.append(x) for x in pat if x not in nt] nl = int(len(nt)) @@ -571,10 +569,10 @@ def interdigit( def hv_gen(c, c_inst, volt, dg_encx: float = 0.1, dg_ency: float = 0.1): - """Returns high volatge related polygons + """Returns high voltage related polygons Args : - c_inst : dualgate enclosed componenet + c_inst : dualgate enclosed component volt : operating voltage dg_encx : dualgate enclosure in x_direction dg_ency : dualgate enclosure in y_direction @@ -623,7 +621,7 @@ def bulk_gr_gen( """Returns guardring Args : - c_inst : componenet enclosed by guardring + c_inst : component enclosed by guardring comp_spacing : spacing between comp polygons poly2_comp_spacing : spacing between comp and poly2 polygons volt : operating voltage @@ -785,7 +783,7 @@ def bulk_gr_gen( operation="A-B", layer=layer["metal1"], ) - ) # metal1_gaurdring + ) # metal1_guardring # c.add_ref(hv_gen(c_inst=B, volt=volt, dg_encx=dg_enc_cmp, dg_ency=dg_enc_cmp)) hv_gen(c, c_inst=B, volt=volt, dg_encx=dg_enc_cmp, dg_ency=dg_enc_cmp) @@ -895,13 +893,13 @@ def add_inter_sd_labels( """Adds label to intermediate source/drain diffusion Args : - c : instance componenet of the device + c : instance component of the device nf : number of fingers sd_label : required source and drain labels list - poly1 : componenet of poly array + poly1 : component of poly array l_gate : length of fet gate inter_sd_l : length of intermediate source/drain diffusion - sd_diff_inter : componenet of intermediate source/drain polygon + sd_diff_inter : component of intermediate source/drain polygon label: boolean of having labels layer : layer of label con_bet_fin : boolean of having contact between fingers @@ -933,14 +931,14 @@ def add_gate_labels(c, g_label, pc1, c_pc, pc_spacing, nc1, nc2, pc2, label, lay """Adds gate label when label is enabled Args : - c : instance componenet of the device + c : instance component of the device g_label : required gate labels list - pc1 : componenet of poly array1 - c_pc : componenet of poly array element + pc1 : component of poly array1 + c_pc : component of poly array element pc_spacing : float of space between labels nc1 : number of columns in poly array1 nc2 : number of columns in poly array2 - pc2 : componenet of poly array2 + pc2 : component of poly array2 label : boolean of having labels layer : layer of labels nf : number of fingers @@ -1011,7 +1009,7 @@ def nfet( inter_sd_l : Float of source and drain diffusion length between fingers nf : integer of number of fingers M : integer of number of multipliers - grw : gaurd ring width when enabled + grw : guard ring width when enabled type : string of the device type bulk : String of bulk connection type (None, Bulk Tie, Guard Ring) con_bet_fin : boolean of having contacts for diffusion between fingers @@ -1524,7 +1522,7 @@ def pfet( inter_sd_l : Float of source and drain diffusion length between fingers nf : integer of number of fingers M : integer of number of multipliers - grw : gaurd ring width when enabled + grw : guard ring width when enabled type : string of the device type bulk : String of bulk connection type (None, Bulk Tie, Guard Ring) con_bet_fin : boolean of having contacts for diffusion between fingers @@ -1986,7 +1984,7 @@ def nfet_06v0_nvt( sub_label: str = "", patt_label: bool = False, ) -> gf.Component: - """ Draw Native NFET 6V transistor by specifying parameters. + """Draw Native NFET 6V transistor by specifying parameters. Arg: l : Float of gate length diff --git a/gf180/via_generator.py b/gf180/via_generator.py index a1eee8b..0793ec3 100644 --- a/gf180/via_generator.py +++ b/gf180/via_generator.py @@ -17,7 +17,7 @@ def via_generator( ) -> gf.Component: """ return only vias withen the range xrange and yrange while enclosing by via_enclosure - and set number of rows and number of coloumns according to ranges and via size and spacing + and set number of rows and number of columns according to ranges and via size and spacing """ c = gf.Component() diff --git a/pyproject.toml b/pyproject.toml index 15e1146..4d4f410 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -114,7 +114,6 @@ src = "gf180/__init__.py" [[tool.tbump.file]] src = "gf180/klayout/grain.xml" - [tool.tbump.version] current = "0.0.3" regex = '''