diff --git a/.github/workflows/test_code.yml b/.github/workflows/test_code.yml index 024cde3..7e4e03e 100644 --- a/.github/workflows/test_code.yml +++ b/.github/workflows/test_code.yml @@ -21,7 +21,7 @@ jobs: run: | python -m pip install --upgrade pip pip install pre-commit - pre-commit run -a + pre-commit run -a test_code: runs-on: ${{ matrix.os }} strategy: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 960014f..4f25ea8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,15 +28,15 @@ repos: rev: 953faa6870f6663ac0121ab4a800f1ce76bca31f hooks: - 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/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: d2425a62376c2197448cce2f825d5a0c3926b862 hooks: @@ -57,7 +57,7 @@ repos: - id: codespell additional_dependencies: - tomli - + # - repo: https://github.com/kynan/nbstripout # rev: e4c5b4dcbab4afa0b88b7a9243db42b1a8d95dde # hooks: diff --git a/CHANGELOG.md b/CHANGELOG.md index a601ef5..ba6026f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,2 +1 @@ # [CHANGELOG](https://keepachangelog.com/en/1.0.0/) - diff --git a/LICENSE b/LICENSE index 2a044f0..30daad6 100644 --- a/LICENSE +++ b/LICENSE @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +SOFTWARE. diff --git a/Makefile b/Makefile index 0048da2..eb16882 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -install: +install: pip install -e .[dev] pre-commit install @@ -35,4 +35,3 @@ docs: jb build docs .PHONY: drc doc docs - diff --git a/README.md b/README.md index 601f3ae..57e7c4a 100644 --- a/README.md +++ b/README.md @@ -7,4 +7,3 @@ ubc mask1 ## Installation `make install` - diff --git a/docs/api.rst b/docs/api.rst index dade21f..dc3d16c 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -5,4 +5,3 @@ Config --------------------- .. automodule:: ubc1.config - diff --git a/pyproject.toml b/pyproject.toml index 846a910..3e13b6a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,52 +1,43 @@ # https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html + [build-system] -requires = ["flit_core >=3.2,<4"] build-backend = "flit_core.buildapi" +requires = ["flit_core >=3.2,<4"] [project] -name="ubc1" -description="ubc mask1" +authors = [ + {name = "gdsfactory", email = "contact@gdsfactory.com"} +] classifiers = [ - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Operating System :: OS Independent", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Operating System :: OS Independent" ] -version="0.0.1" -authors = [ - {name = "gdsfactory", email = "contact@gdsfactory.com"}, +dependencies = [ + "ubcpdk==2.2.2" ] +description = "ubc mask1" keywords = ["python"] license = {file = "LICENSE"} -dependencies = [ - "ubcpdk==2.2.2", -] +name = "ubc1" readme = "README.md" requires-python = ">=3.10" +version = "0.0.1" [project.optional-dependencies] dev = [ - "pre-commit", - "pytest", - "pytest-cov", - "pytest_regressions", - ] + "pre-commit", + "pytest", + "pytest-cov", + "pytest_regressions" +] docs = [ - "jupytext", - "matplotlib", - "jupyter-book==0.15.1", - ] - - -[tool.setuptools.packages] -find = {} - -# [project.scripts] -# ubc1 = "ubc1.cli:cli" + "jupytext", + "matplotlib", + "jupyter-book==0.15.1" +] [tool.black] -line-length = 88 -target-version = ['py310'] -include = '\.pyi?$' exclude = ''' # Specify the files/dirs that should be ignored by the black formatter /( \.eggs @@ -62,13 +53,12 @@ exclude = ''' # Specify the files/dirs that should be ignored by the black form | dist )/ ''' +include = '\.pyi?$' +line-length = 88 +target-version = ['py310'] -[tool.pytest.ini_options] -testpaths = ["ubc1/", "tests"] -# addopts = --tb=no -addopts = '--tb=short' -python_files = ["ubc1/*.py", "notebooks/*.ipynb", "tests/*.py"] -norecursedirs = ["extra/*.py"] +[tool.codespell] +ignore-words-list = "te, te/tm, te, ba, fpr, fpr_spacing, ro, nd, donot, schem" [tool.mypy] python_version = "3.10" @@ -79,41 +69,58 @@ enabled = true live_mode = true strict = true -[tool.setuptools.package-data] -mypkg = ["*.csv", "*.yaml"] - -[tool.codespell] -ignore-words-list = "te, te/tm, te, ba, fpr, fpr_spacing, ro, nd, donot, schem" - -[tool.ruff.pydocstyle] -convention = "google" +[tool.pytest.ini_options] +# addopts = --tb=no +addopts = '--tb=short' +norecursedirs = ["extra/*.py"] +python_files = ["ubc1/*.py", "notebooks/*.ipynb", "tests/*.py"] +testpaths = ["ubc1/", "tests"] [tool.ruff] fix = true -select = [ - "E", # pycodestyle errors - "W", # pycodestyle warnings - "F", # pyflakes - "I", # isort - "C", # flake8-comprehensions - "B", # flake8-bugbear - "UP" -] ignore = [ - "E501", # line too long, handled by black - "B008", # do not perform function calls in argument defaults - "C901", # too complex - "B905", # `zip()` without an explicit `strict=` parameter - "C408", # C408 Unnecessary `dict` call (rewrite as a literal) + "E501", # line too long, handled by black + "B008", # do not perform function calls in argument defaults + "C901", # too complex + "B905", # `zip()` without an explicit `strict=` parameter + "C408" # C408 Unnecessary `dict` call (rewrite as a literal) ] +select = [ + "E", # pycodestyle errors + "W", # pycodestyle warnings + "F", # pyflakes + "I", # isort + "C", # flake8-comprehensions + "B", # flake8-bugbear + "UP" +] + +[tool.ruff.pydocstyle] +convention = "google" + +[tool.setuptools.package-data] +mypkg = ["*.csv", "*.yaml"] + +[tool.setuptools.packages] +find = {} [tool.tbump] -# Uncomment this if your project is hosted on GitHub: -# github_url = "https://github.com///" + +[[tool.tbump.file]] +src = "README.md" + +[[tool.tbump.file]] +src = "pyproject.toml" + +[[tool.tbump.file]] +src = "ubc1/__init__.py" + +[tool.tbump.git] +message_template = "Bump to {new_version}" +tag_template = "v{new_version}" [tool.tbump.version] current = "0.0.1" - # Example of a semver regexp. # Make sure this matches current_version before # using tbump @@ -124,20 +131,3 @@ regex = ''' \. (?P\d+) ''' - -[tool.tbump.git] -message_template = "Bump to {new_version}" -tag_template = "v{new_version}" - -# For each file to patch, add a [[file]] config -# section containing the path of the file, relative to the -# tbump.toml location. -[[tool.tbump.file]] -src = "README.md" - -[[tool.tbump.file]] -src = "pyproject.toml" - -[[tool.tbump.file]] -src = "ubc1/__init__.py" - diff --git a/ubc1/__init__.py b/ubc1/__init__.py index 20342d1..582883d 100644 --- a/ubc1/__init__.py +++ b/ubc1/__init__.py @@ -1,3 +1,3 @@ """ubc1 - ubc mask1""" -__version__ = '0.0.1' +__version__ = "0.0.1" diff --git a/ubc1/config.py b/ubc1/config.py index f712ebc..8a5e0fa 100644 --- a/ubc1/config.py +++ b/ubc1/config.py @@ -25,4 +25,3 @@ class Path: if __name__ == "__main__": print(PATH) - diff --git a/ubc1/test_masks.py b/ubc1/test_masks.py index 78092c2..6213eed 100644 --- a/ubc1/test_masks.py +++ b/ubc1/test_masks.py @@ -1,10 +1,11 @@ """Write all mask for the course.""" import shutil +from ubcpdk.config import PATH + import ubc1.ubc_helge as m12 import ubc1.ubc_joaquin_matres1 as m11 import ubc1.ubc_simon as m13 -from ubcpdk.config import PATH def test_masks_2023_v1(): diff --git a/ubc1/ubc_helge.py b/ubc1/ubc_helge.py index 60c5fb6..81e664a 100644 --- a/ubc1/ubc_helge.py +++ b/ubc1/ubc_helge.py @@ -1,12 +1,12 @@ from pathlib import Path import gdsfactory as gf - import ubcpdk import ubcpdk.components as pdk -from ubc1.write_mask import pack, size, write_mask_gds_with_metadata from ubcpdk.tech import LAYER +from ubc1.write_mask import pack, size, write_mask_gds_with_metadata + add_gc = ubcpdk.components.add_fiber_array nm = 1e-3 @@ -15,7 +15,7 @@ def test_mask1() -> Path: """DBR filters.""" @gf.cell - def dbr_filter(n)->gf.Component: + def dbr_filter(n) -> gf.Component: c = gf.Component() splitter = pdk.ebeam_bdc_te1550() @@ -51,7 +51,7 @@ def dbr_filter(n)->gf.Component: c = pack(rings_gc) m = c[0] m.name = "EBeam_JoaquinMatres_Helge_1" - _ =m << gf.components.rectangle(size=size, layer=LAYER.FLOORPLAN) + _ = m << gf.components.rectangle(size=size, layer=LAYER.FLOORPLAN) return write_mask_gds_with_metadata(m) @@ -77,7 +77,7 @@ def test_mask2() -> Path: c = pack(e) m = c[0] m.name = "EBeam_JoaquinMatres_Helge_2" - _ =m << gf.components.rectangle(size=size, layer=LAYER.FLOORPLAN) + _ = m << gf.components.rectangle(size=size, layer=LAYER.FLOORPLAN) return write_mask_gds_with_metadata(m) diff --git a/ubc1/ubc_joaquin_matres1.py b/ubc1/ubc_joaquin_matres1.py index 256b71c..6f490e1 100644 --- a/ubc1/ubc_joaquin_matres1.py +++ b/ubc1/ubc_joaquin_matres1.py @@ -4,7 +4,6 @@ from pathlib import Path import gdsfactory as gf - import ubcpdk import ubcpdk.components as pdk from ubcpdk import tech diff --git a/ubc1/ubc_simon.py b/ubc1/ubc_simon.py index 9e8ef7e..2474f51 100644 --- a/ubc1/ubc_simon.py +++ b/ubc1/ubc_simon.py @@ -4,16 +4,16 @@ from pathlib import Path import gdsfactory as gf +import ubcpdk +import ubcpdk.components as pdk from gdsfactory.components.bend_euler import bend_euler from gdsfactory.components.coupler_ring import coupler_ring as _coupler_ring from gdsfactory.components.straight import straight from gdsfactory.components.via_stack import via_stack_heater_m3 from gdsfactory.typings import ComponentSpec, CrossSectionSpec, Float2 +from ubcpdk.tech import LAYER -import ubcpdk -import ubcpdk.components as pdk from ubc1.write_mask import write_mask_gds_with_metadata -from ubcpdk.tech import LAYER via_stack_heater_m3_mini = partial(via_stack_heater_m3, size=(4, 4)) diff --git a/ubc1/write_mask.py b/ubc1/write_mask.py index ae76093..a5398f8 100644 --- a/ubc1/write_mask.py +++ b/ubc1/write_mask.py @@ -3,9 +3,8 @@ from pathlib import Path import gdsfactory as gf -from omegaconf import OmegaConf - import ubcpdk +from omegaconf import OmegaConf from ubcpdk.tech import LAYER from ubc1.config import PATH