Skip to content

Commit

Permalink
Merge pull request #291 from gdsfactory/gdsfactory7
Browse files Browse the repository at this point in the history
Gdsfactory7
  • Loading branch information
joamatab authored Aug 5, 2023
2 parents 9b63247 + e0da73a commit c0dc6ee
Show file tree
Hide file tree
Showing 131 changed files with 1,233 additions and 4,038 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@ jobs:
name: Sphinx docs to gh-pages
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
cache-dependency-path: pyproject.toml
- uses: actions/cache@v3
with:
path: |
~/.gdsfactory/
key: 0.0.1
restore-keys: 0.0.1
- name: Add conda to system path
run: |
echo $CONDA/bin >> $GITHUB_PATH
- name: Installing the library
env:
TIDY3D_USER: ${{ secrets.TIDY3D_EMAIL }}
Expand All @@ -31,11 +34,10 @@ jobs:
GDSFACTORY_LAYOUT_PLOTTER: klayout
shell: bash -l {0}
run: |
sudo apt install libglu1-mesa
make dev plugins
make dev
make docs
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v2
with:
path: "./docs/_build/html/"

Expand Down
33 changes: 12 additions & 21 deletions .github/workflows/test_code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ jobs:
strategy:
max-parallel: 12
matrix:
python-version: ["3.10"]
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.11"]
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v3
Expand All @@ -32,8 +32,7 @@ jobs:
cache-dependency-path: pyproject.toml
- name: Install dependencies
run: |
pip install .
pip install pytest pytest_regressions
make dev
- name: Test with pytest
run: pytest tests/
test_code_coverage:
Expand All @@ -50,11 +49,9 @@ jobs:
cache-dependency-path: pyproject.toml
- name: Install dependencies
run: |
pip install -e .
make dev
- name: Test with pytest
run: |
python -m pip install --upgrade pip
pip install pytest klayout lytest scikit-image pytest-cov pytest_regressions
pytest --cov=ubcpdk tests/
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
Expand All @@ -67,27 +64,21 @@ jobs:
strategy:
max-parallel: 12
matrix:
python-version: [3.9]
python-version: [3.11]
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
channels: conda-forge,defaults
channel-priority: true
activate-environment: anaconda-client-env
- name: Add conda to system path
run: |
echo $CONDA/bin >> $GITHUB_PATH
python-version: "3.11"
cache: "pip"
cache-dependency-path: pyproject.toml
- name: Install dependencies
run: |
sudo apt install pandoc
make plugins
pip install -e .[docs] --upgrade
pip install numpy --upgrade
conda list > requirements.txt
make dev
pip freeze > requirements.txt
- uses: actions/upload-artifact@v3
with:
name: requirements
Expand Down
4 changes: 2 additions & 2 deletions .github/write_components_autodoc.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import inspect

import ubcpdk
from ubcpdk.config import PATH


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

skip = {
Expand Down Expand Up @@ -51,7 +51,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
13 changes: 6 additions & 7 deletions .github/write_components_plot.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from typing import Tuple
import inspect
from ubcpdk.config import PATH
from ubcpdk import cells

from ubcpdk import cells
from ubcpdk.config import PATH

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

Expand All @@ -20,8 +19,8 @@
"waveguide_template",
}

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 @@ -45,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
]
)
Expand Down Expand Up @@ -75,7 +74,7 @@
import ubcpdk
c = ubcpdk.components.{name}({kwargs})
c.plot_matplotlib()
c.plot_klayout()
"""
)
80 changes: 0 additions & 80 deletions .github/write_components_plot_klayout.py

This file was deleted.

13 changes: 5 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,9 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 9260cbc9c84c06022993bfbcc42fdbf0305c5b8e
hooks:
- id: check-yaml
exclude: ^(conda\.recipe/meta\.yaml|conda_build/templates/.*\.yaml|docs/click/meta\.yaml|conda/meta\.yaml|construct.yaml)
- id: end-of-file-fixer
- id: trailing-whitespace
- id: requirements-txt-fixer
- repo: https://github.com/pycqa/isort
rev: 7b69d092ae4885dcc45648538ae780a6326bcd1e
hooks:
- id: isort
files: ubcdpk/.*
args: [--profile, black, --filter-files]

- repo: https://github.com/psf/black
rev: 25d886f52c2bbbb58386ac8050f4e67952507bc7
Expand All @@ -23,3 +15,8 @@ repos:
rev: "6a0ba1854991b693612486cc84a2254de82d071d"
hooks:
- id: ruff
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.10.0
hooks:
- id: pretty-format-toml
args: [--autofix]
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [2.0.0](https://github.com/gdsfactory/ubc/pull/291)

- update to gdsfactory 7.0.2

## [1.21.0](https://github.com/gdsfactory/ubc/pull/203)

- use jupyterbook for docs
Expand Down
74 changes: 5 additions & 69 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,37 +1,17 @@
install:
pip install -e .
pip install -e .[dev,docs]
pip install pre-commit
pre-commit install
python install_tech.py

dev:
pip install -e .[dev,docs]
dev: install

update:
pre-commit autoupdate --bleeding-edge
update-pre:
pre-commit autoupdate

watch:
gf watch ubcpdk

link:
lygadgets_link lygadgets
lygadgets_link gdsfactory
lygadgets_link toolz
lygadgets_link gdspy
lygadgets_link numpy
lygadgets_link matplotlib
lygadgets_link cycler
lygadgets_link pyparsing
lygadgets_link dateutil
lygadgets_link kiwisolver
lygadgets_link ubcpdk/klayout/tech
lygadgets_link ubcpdk
lygadgets_link scipy # [because of splines in the nanowires]
lygadgets_link omegaconf
lygadgets_link loguru
lygadgets_link pydantic
lygadgets_link shapely

test:
pytest -s

Expand All @@ -47,62 +27,18 @@ meep:
conda config --set solver libmamba
conda install -c conda-forge pymeep=*=mpi_mpich_* nlopt -y

plugins: meep
pip install gdsfactory[docs,dev,full,gmsh,tidy3d,devsim,meow,sax]
pip install -e .[full] --upgrade

diff:
pf merge-cells gds_diff

cov:
pytest --cov=ubcpdk

mypy:
mypy . --ignore-missing-imports

lint:
flake8 .

pylint:
pylint ubcpdk

lintd:
flake8 --select RST

pydocstyle:
pydocstyle ubcpdk

doc8:
doc8 docs/

git-rm-merged:
git branch -D `git branch --merged | grep -v \* | xargs`

release:
git push
git push origin --tags

build:
rm -rf dist
pip install build
python -m build

notebooks:
nbstripout --drop-empty-cells docs/notebooks/*.ipynb

mask:
python ubcpdk/samples/test_masks.py

jupytext:
jupytext docs/**/*.ipynb --to py

notebooks:
jupytext docs/**/*.py --to ipynb

notebooks-rm:
rm docs/notebooks/*.ipynb

docs:
jb build docs

.PHONY: drc doc docs
.PHONY: drc doc docs install
Loading

0 comments on commit c0dc6ee

Please sign in to comment.