Skip to content

Commit 1ddd25f

Browse files
authored
add ihp-gdsfactory--sample-projects (#158)
* add ihp-gdsfactory--sample-projects * update gdsfactory dep to 9.40.1
1 parent 11aba3b commit 1ddd25f

172 files changed

Lines changed: 14861 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{% if sections[""] %}
2+
{% for category, val in definitions.items() if category in sections[""] %}
3+
4+
### {{ definitions[category]['name'] }}
5+
6+
{% for text, values in sections[""][category].items() %}
7+
- {{ text }} {{ values | join(', ') }}
8+
{% endfor %}
9+
10+
{% endfor %}
11+
{% else %}
12+
No significant changes.
13+
14+
15+
{% endif %}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[codespell]
2+
ignore-words-list = activ,passiv,te,fpr,nd,donot,schem
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.gds binary
2+
*.oas binary
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name-template: 'v$RESOLVED_VERSION'
2+
tag-template: 'v$RESOLVED_VERSION'
3+
change-template: '- $TITLE [#$NUMBER](https://github.com/gdsfactory/ihp/pull/$NUMBER)'
4+
template: |
5+
# What's Changed
6+
7+
$CHANGES
8+
9+
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
10+
categories:
11+
- title: 'Breaking'
12+
label: 'breaking'
13+
- title: 'New'
14+
labels:
15+
- 'feature'
16+
- 'enhancement'
17+
- title: 'Bug Fixes'
18+
label: 'bug'
19+
- title: 'Maintenance'
20+
labels:
21+
- 'maintenance'
22+
- 'github_actions'
23+
- title: 'Documentation'
24+
label: 'documentation'
25+
- title: 'Other changes'
26+
- title: 'Dependency Updates'
27+
label: 'dependencies'
28+
collapse-after: 5
29+
version-resolver:
30+
major:
31+
labels:
32+
- 'breaking'
33+
- 'major'
34+
minor:
35+
labels:
36+
- 'feature'
37+
- 'minor'
38+
- 'enhancement'
39+
patch:
40+
labels:
41+
- 'bug'
42+
- 'maintenance'
43+
- 'github_actions'
44+
- 'documentation'
45+
- 'dependencies'
46+
- 'security'
47+
default: patch
48+
exclude-labels:
49+
- 'skip-changelog'
50+
autolabeler:
51+
- label: 'documentation'
52+
files:
53+
- '*.md'
54+
branch:
55+
- '/docs-.+/'
56+
- label: 'bug'
57+
branch:
58+
- '/fix-.+/'
59+
title:
60+
- '/fix/i'
61+
- label: 'enhancement'
62+
branch:
63+
- '/feature-.+/'
64+
- '/add-.+/'
65+
title:
66+
- '/^add\s/i'
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: build docs
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
jobs:
9+
build-docs:
10+
runs-on: ubuntu-latest
11+
name: Sphinx docs to gh-pages
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Set up Python
15+
uses: actions/setup-python@v6
16+
with:
17+
python-version: '3.11'
18+
- name: Install uv
19+
uses: astral-sh/setup-uv@v6
20+
- name: Install dependencies
21+
run: |
22+
make install
23+
- name: make docs
24+
run: |
25+
make docs
26+
- name: Upload artifact
27+
uses: actions/upload-pages-artifact@v4
28+
with:
29+
path: "./docs/_build/html/"
30+
deploy-docs:
31+
needs: build-docs
32+
if: ${{ github.ref == 'refs/heads/main' }}
33+
permissions:
34+
pages: write
35+
id-token: write
36+
environment:
37+
name: github-pages
38+
url: ${{ steps.deployment.outputs.page_url }}
39+
runs-on: ubuntu-latest
40+
steps:
41+
- name: Deploy to GitHub Pages
42+
id: deployment
43+
uses: actions/deploy-pages@v4
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Release Drafter
2+
on:
3+
push:
4+
branches:
5+
- main
6+
permissions:
7+
contents: read
8+
jobs:
9+
update_release_draft:
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
runs-on: ubuntu-latest
14+
steps:
15+
# Drafts your next Release notes as Pull Requests are merged into "master"
16+
- uses: release-drafter/release-drafter@v6
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Release package
2+
on:
3+
push:
4+
tags: "v*"
5+
jobs:
6+
release_pypi:
7+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
8+
runs-on: ubuntu-latest
9+
container: ghcr.io/gdsfactory/gdsfactory:main
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Install dependencies
13+
run: |
14+
python -m pip install --upgrade pip
15+
pip install setuptools wheel twine
16+
- name: Build and publish
17+
env:
18+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
19+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
20+
run: |
21+
make build
22+
twine upload dist/*
23+
release_environment:
24+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
25+
runs-on: ubuntu-latest
26+
container: ghcr.io/gdsfactory/gdsfactory:main
27+
permissions:
28+
contents: write
29+
steps:
30+
- uses: actions/checkout@v4
31+
- name: Install dependencies
32+
run: |
33+
pip install .
34+
pip freeze > requirements.txt
35+
- name: Publish Latest Draft
36+
run: |
37+
gh release edit ${{ github.ref_name }} --draft=false
38+
env:
39+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Test code
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
pre-commit:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-python@v6
15+
- uses: pre-commit/action@v3.0.1
16+
test_code:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Set up Python
21+
uses: actions/setup-python@v6
22+
with:
23+
python-version: '3.12'
24+
- name: Install uv
25+
uses: astral-sh/setup-uv@v6
26+
- name: Install dependencies
27+
run: |
28+
make install
29+
- name: Test with pytest
30+
run: make test
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
import inspect
2+
3+
from ihp import PDK
4+
from ihp.config import PATH
5+
6+
filepath = PATH.repo / "docs" / "cells.rst"
7+
8+
skip = {
9+
"LIBRARY",
10+
"circuit_names",
11+
"component_factory",
12+
"component_names",
13+
"container_names",
14+
"component_names_test_ports",
15+
"component_names_skip_test",
16+
"component_names_skip_test_ports",
17+
"dataclasses",
18+
"library",
19+
"waveguide_template",
20+
}
21+
22+
skip_plot: tuple[str, ...] = ("",)
23+
skip_settings: tuple[str, ...] = ("flatten", "safe_cell_names")
24+
25+
cells = PDK.cells
26+
27+
28+
with open(filepath, "w+") as f:
29+
f.write(
30+
"""
31+
32+
Here are the components available in the PDK
33+
34+
35+
Cells
36+
=============================
37+
"""
38+
)
39+
40+
for name in sorted(cells.keys()):
41+
if name in skip or name.startswith("_"):
42+
continue
43+
print(name)
44+
sig = inspect.signature(cells[name])
45+
kwargs = ", ".join(
46+
[
47+
f"{p}={repr(sig.parameters[p].default)}"
48+
for p in sig.parameters
49+
if isinstance(sig.parameters[p].default, int | float | str | tuple)
50+
and p not in skip_settings
51+
]
52+
)
53+
if name in skip_plot:
54+
f.write(
55+
f"""
56+
57+
{name}
58+
----------------------------------------------------
59+
60+
.. autofunction:: ihp.cells.{name}
61+
62+
"""
63+
)
64+
else:
65+
f.write(
66+
f"""
67+
68+
{name}
69+
----------------------------------------------------
70+
71+
.. autofunction:: ihp.cells.{name}
72+
73+
.. plot::
74+
:include-source:
75+
76+
from ihp import PDK, cells
77+
78+
PDK.activate()
79+
80+
c = cells.{name}({kwargs}).copy()
81+
c.draw_ports()
82+
c.plot()
83+
84+
"""
85+
)

0 commit comments

Comments
 (0)