Skip to content

Commit

Permalink
fix pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
joamatab committed Oct 14, 2023
1 parent 1e899eb commit e4a8c89
Show file tree
Hide file tree
Showing 15 changed files with 94 additions and 110 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
20 changes: 10 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -57,7 +57,7 @@ repos:
- id: codespell
additional_dependencies:
- tomli

# - repo: https://github.com/kynan/nbstripout
# rev: e4c5b4dcbab4afa0b88b7a9243db42b1a8d95dde
# hooks:
Expand Down
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# [CHANGELOG](https://keepachangelog.com/en/1.0.0/)

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -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.
SOFTWARE.
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
install:
install:
pip install -e .[dev]
pre-commit install

Expand Down Expand Up @@ -35,4 +35,3 @@ docs:
jb build docs

.PHONY: drc doc docs

1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ ubc mask1
## Installation

`make install`

1 change: 0 additions & 1 deletion docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ Config
---------------------

.. automodule:: ubc1.config

148 changes: 69 additions & 79 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]"}
]
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 = "[email protected]"},
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
Expand All @@ -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"
Expand All @@ -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/<user or organization>/<project>/"

[[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
Expand All @@ -124,20 +131,3 @@ regex = '''
\.
(?P<patch>\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"

2 changes: 1 addition & 1 deletion ubc1/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""ubc1 - ubc mask1"""

__version__ = '0.0.1'
__version__ = "0.0.1"
1 change: 0 additions & 1 deletion ubc1/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,3 @@ class Path:

if __name__ == "__main__":
print(PATH)

3 changes: 2 additions & 1 deletion ubc1/test_masks.py
Original file line number Diff line number Diff line change
@@ -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():
Expand Down
10 changes: 5 additions & 5 deletions ubc1/ubc_helge.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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()

Expand Down Expand Up @@ -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)


Expand All @@ -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)


Expand Down
1 change: 0 additions & 1 deletion ubc1/ubc_joaquin_matres1.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from pathlib import Path

import gdsfactory as gf

import ubcpdk
import ubcpdk.components as pdk
from ubcpdk import tech
Expand Down
6 changes: 3 additions & 3 deletions ubc1/ubc_simon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
3 changes: 1 addition & 2 deletions ubc1/write_mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e4a8c89

Please sign in to comment.