Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
joamatab committed Aug 7, 2023
1 parent e3ae612 commit cc17df1
Show file tree
Hide file tree
Showing 21 changed files with 112 additions and 269 deletions.
11 changes: 5 additions & 6 deletions .github/write_cells.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
from typing import Tuple
import inspect
from gvtt.config import PATH
from gvtt import cells

from gvtt import cells
from gvtt.config import PATH

filepath = PATH.repo / "docs" / "cells.rst"

skip = {}

skip_plot: Tuple[str, ...] = ("add_fiber_array_siepic",)
skip_settings: Tuple[str, ...] = ("flatten", "safe_cell_names")
skip_plot: tuple[str, ...] = ("add_fiber_array_siepic",)
skip_settings: tuple[str, ...] = ("flatten", "safe_cell_names")


with open(filepath, "w+") as f:
Expand All @@ -33,7 +32,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
]
)
Expand Down
134 changes: 10 additions & 124 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,136 +1,22 @@
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

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "6a0ba1854991b693612486cc84a2254de82d071d"
hooks:
- id: ruff
- id: requirements-txt-fixer

- repo: https://github.com/psf/black
rev: "d9b8a6407e2f46304a8d36b18e4a73d8e0613519"
rev: 25d886f52c2bbbb58386ac8050f4e67952507bc7
hooks:
- id: black

- repo: https://github.com/asottile/pyupgrade
rev: ddb39ad37166dbc938d853cc77606526a0b1622a
hooks:
- id: pyupgrade
args: [--py37-plus, --keep-runtime-typing]

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: 953faa6870f6663ac0121ab4a800f1ce76bca31f
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "6a0ba1854991b693612486cc84a2254de82d071d"
hooks:
- id: shellcheck

- repo: https://github.com/PyCQA/bandit
rev: fe1361fdcc274850d4099885a802f2c9f28aca08
- id: ruff
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.10.0
hooks:
- id: bandit
args: [--exit-zero]
# ignore all tests, not just tests data
exclude: ^tests/

# - 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/terrencepreilly/darglint
# rev: master
# hooks:
# - id: darglint
# - repo: https://github.com/pycqa/pydocstyle
# rev: "a6fe4222012e990042c86cdaaa904a8d059752ee"
# hooks:
# - id: pydocstyle
# additional_dependencies: ["pydocstyle[toml]"]
# - repo: https://github.com/asottile/reorder_python_imports
# rev: 2b2f0c74acdb3de316e23ceb7dd0d7945c354050
# hooks:
# - id: reorder-python-imports
# - repo: https://github.com/PyCQA/pylint
# rev: v2.14.1
# hooks:
# - id: pylint
# args: [--exit-zero]
# - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
# rev: 6565d773ca281682d7062d4c0be74538cc474cc9
# hooks:
# - id: pretty-format-java
# args: [--autofix]
# - id: pretty-format-kotlin
# args: [--autofix]
# - id: pretty-format-yaml
# args: [--autofix, --indent, "2"]
# - repo: https://github.com/adrienverge/yamllint.git
# rev: v1.21.0 # or higher tag
# hooks:
# - id: yamllint
# args: [--format, parsable, --strict]
# - repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
# rev: 0.1.0 # or specific tag
# hooks:
# - id: yamlfmt
# - repo: https://github.com/pre-commit/pygrep-hooks
# rev: "f6fb13e9516d1a9720a30a4049c930235abd642e"
# hooks:
# - id: python-check-blanket-noqa
# - id: python-check-blanket-type-ignore
# - id: python-no-log-warn
# - id: python-no-eval
# - id: python-use-type-annotations
# - id: rst-backticks
# - id: rst-directive-colons
# - id: rst-inline-touching-normal
# - repo: https://github.com/nbQA-dev/nbQA
# rev: 952c895a21aced4601165c43f77188559a5e825c
# hooks:
# - id: nbqa-black
# additional_dependencies: [jupytext, black] # optional, only if you're using Jupytext
# - id: nbqa-pyupgrade
# args: ["--py37-plus"]
# - id: nbqa-flake8
# - id: nbqa-isort
# args: ["--float-to-top"]
# - repo: https://github.com/hakancelik96/unimport
# rev: 0.14.1
# hooks:
# - id: unimport
# args: [--remove, --include-star-import]
# - repo: https://github.com/pycqa/isort
# rev: "3a72e069635a865a92b8a0273aa829f630cbcd6f"
# hooks:
# - id: isort
# files: "demo_project/.*"
# args: ["--profile", "black", "--filter-files"]

# - repo: https://github.com/kynan/nbstripout
# rev: e4c5b4dcbab4afa0b88b7a9243db42b1a8d95dde
# hooks:
# - id: nbstripout
# files: ".ipynb"
# - repo: https://github.com/codespell-project/codespell
# rev: 68ea3cff5eba266e0814794cce6cd19537f58137
# hooks:
# - id: codespell
# args: ["-L TE,TE/TM,te,ba,FPR,fpr_spacing,ro,donot"]
# - repo: https://github.com/pre-commit/pygrep-hooks
# rev: 7b4409161486c6956bb3206ce96db5d56731b1b9 # Use the ref you want to point at
# hooks:
# - id: python-use-type-annotations
- id: pretty-format-toml
args: [--autofix]
1 change: 0 additions & 1 deletion examples/python/tutorial-2.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import gdsfactory as gf


# To make reusable elements, you can encapsulate the designs as cells.
# The cells can be parametrized for further flexibility.

Expand Down
8 changes: 4 additions & 4 deletions gvtt/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from __future__ import annotations

from gdsfactory.pdk import Pdk, constants
from gdsfactory.get_factories import get_cells
import gdsfactory
from gdsfactory.get_factories import get_cells
from gdsfactory.pdk import Pdk, constants

from gvtt import components
from gvtt.config import PATH
from gvtt.layers import LAYER
from gvtt.xsections import cross_sections
from gvtt.config import PATH
from gvtt import components

cells = get_cells([components])

Expand Down
2 changes: 1 addition & 1 deletion gvtt/components/bend_euler.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import numpy as np
import gdsfactory as gf
import numpy as np
from gdsfactory.add_padding import get_padding_points
from gdsfactory.component import Component
from gdsfactory.components.wire import wire_corner
Expand Down
12 changes: 5 additions & 7 deletions gvtt/components/die.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from typing import Optional, Tuple, Union

import gdsfactory as gf
from gdsfactory.components.text import text
from gdsfactory.typings import LayerSpec, ComponentSpec, Float2
from gdsfactory.typings import ComponentSpec, Float2, LayerSpec

import gvtt

Expand All @@ -20,14 +18,14 @@ def box(x0, y0, w, h):

@gf.cell
def die(
size: Tuple[float, float] = (5000.0, 9500.0),
size: tuple[float, float] = (5000.0, 9500.0),
street_width: float = 75.0,
street_length: float = 1000.0,
die_name: Optional[str] = "chip99",
die_name: str | None = "chip99",
text_size: float = 100.0,
text_location: Union[str, Float2] = "SW",
text_location: str | Float2 = "SW",
layer: LayerSpec = None, # "FLOORPLAN",
bbox_layer: Optional[LayerSpec] = None,
bbox_layer: LayerSpec | None = None,
draw_corners: bool = True,
draw_dicing_lane: bool = True,
text_component: ComponentSpec = text,
Expand Down
1 change: 1 addition & 0 deletions gvtt/components/edge_coupler_rib.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import gdsfactory as gf
from gdsfactory.component import Component

from gvtt.xsections import rib


Expand Down
7 changes: 4 additions & 3 deletions gvtt/components/mmi1x2.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from gdsfactory.components import mmi1x2 as _mmi1x2
from functools import partial
from gvtt.xsections import strip
from gvtt.components.transitions import strip_taper

from gdsfactory.components import mmi1x2 as _mmi1x2

from gvtt.components.transitions import strip_taper
from gvtt.xsections import strip

mmi1x2 = partial(
_mmi1x2,
Expand Down
7 changes: 4 additions & 3 deletions gvtt/components/mmi2x2.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from gdsfactory.components import mmi2x2 as _mmi2x2
from functools import partial
from gvtt.xsections import strip
from gvtt.components.transitions import strip_taper

from gdsfactory.components import mmi2x2 as _mmi2x2

from gvtt.components.transitions import strip_taper
from gvtt.xsections import strip

mmi2x2 = partial(
_mmi2x2,
Expand Down
12 changes: 5 additions & 7 deletions gvtt/components/transitions.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from typing import Optional

import gdsfactory as gf
from gdsfactory.component import Component
from gdsfactory.components.taper_cross_section import taper_cross_section
from gdsfactory.cross_section import Section, CrossSection, LayerSpec
from gdsfactory.cross_section import CrossSection, LayerSpec, Section

from gvtt.xsections import rib, strip

Expand All @@ -14,7 +12,7 @@ def xs_rib_strip(
width_trench: float = 10.0,
width_deep: float = 10.75,
dist_deep: float = 3.0,
wg_marking_layer: Optional[LayerSpec] = None,
wg_marking_layer: LayerSpec | None = None,
**kwargs,
) -> CrossSection:
"""Return CrossSection of strip waveguide defined by trenches."""
Expand Down Expand Up @@ -65,7 +63,7 @@ def rib_to_strip(
rib_strip_1 = xs_rib_strip(width=3.0, width_deep=0.5) # rib end
rib_strip_2 = xs_rib_strip(width=3.0, dist_deep=-0.25) # strip end

cn = c << gf.components.taper_cross_section.taper_cross_section(
cn = c << gf.components.taper_cross_section(
cross_section1=rib_strip_1,
cross_section2=rib_strip_2,
linear=True,
Expand Down Expand Up @@ -104,7 +102,7 @@ def strip_taper(
width1=1,
width2=1,
taper_ratio=25.0,
length: Optional[float] = None,
length: float | None = None,
**kwargs,
) -> Component:
"""
Expand Down Expand Up @@ -134,7 +132,7 @@ def rib_taper(
width1=1,
width2=1,
taper_ratio=50.0,
length: Optional[float] = None,
length: float | None = None,
**kwargs,
) -> Component:
"""
Expand Down
1 change: 1 addition & 0 deletions gvtt/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class Config:
if __name__ == "__main__":
import gdsfactory as gf
from gdsfactory.technology.klayout_tech import KLayoutTechnology

from gvtt.config import PATH

# from gdsfactory.technology import lyp_to_dataclass
Expand Down
8 changes: 4 additions & 4 deletions gvtt/xsections.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
import sys

import gdsfactory as gf
from typing import Optional
from gdsfactory.cross_section import (
get_cross_section_factories,
CrossSection,
LayerSpec,
xsection,
Section,
get_cross_section_factories,
xsection,
)

from gvtt.layers import LAYER


Expand Down Expand Up @@ -81,7 +81,7 @@ def strip(
def vttstrip(
width: float = 1.875,
width_trench: float = 10.0,
wg_marking_layer: Optional[LayerSpec] = LAYER.TYPE_STRIP,
wg_marking_layer: LayerSpec | None = LAYER.TYPE_STRIP,
**kwargs,
) -> CrossSection:
"""Return CrossSection of strip waveguide defined by trenches."""
Expand Down
4 changes: 2 additions & 2 deletions install_tech.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Symlink tech to klayout."""
import sys
import os
import shutil
import pathlib
import shutil
import sys


def remove_path_or_dir(dest: pathlib.Path):
Expand Down
Loading

0 comments on commit cc17df1

Please sign in to comment.