Skip to content

Commit 65a9bfa

Browse files
committed
refactor: pydantic-v2 and mypy
1 parent d2bc9d4 commit 65a9bfa

315 files changed

Lines changed: 11641 additions & 9054 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.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Batch JSON files
22
batch*.json
33
*.vtu
4+
simulation.json
45

56
# Byte-compiled / optimized / DLL files
67
*$py.class

docs/api/plugins/index.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Plugins
22
=======
33

4+
.. warning::
5+
6+
|:warning:| The 'adjoint' plugin (legacy JAX-based adjoint plugin)
7+
was deprecated in Tidy3D 'v2.7.0' and is disabled as of 'v2.9.0'.
8+
49
.. toctree::
510
:maxdepth: 1
611

poetry.lock

Lines changed: 46 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 10 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ numpy = "<2.4.0"
3333
matplotlib = "*"
3434
shapely = "^2.0"
3535
pandas = "*"
36-
pydantic = "^2.0"
36+
pydantic = ">=2.9,<3"
37+
pydantic-settings = "^2.10.0"
3738
PyYAML = "*"
3839
dask = "*"
3940
toml = "*"
@@ -309,7 +310,13 @@ banned-module-level-imports = ["scipy", "matplotlib"]
309310

310311
[tool.pytest.ini_options]
311312
# TODO: remove --assert=plain when https://github.com/scipy/scipy/issues/22236 is resolved
312-
addopts = "--cov=tidy3d --doctest-modules -n auto --dist worksteal --assert=plain -m 'not numerical'"
313+
# TODO(yaugenst-flex): Revisit adjoint plugin for pydantic v2
314+
addopts = """
315+
--doctest-modules -n auto --dist worksteal --assert=plain -m 'not numerical' \
316+
--ignore=tests/test_plugins/test_adjoint.py \
317+
--ignore=tidy3d/plugins/adjoint/
318+
--ignore=tests/test_plugins/test_adjoint.py
319+
"""
313320
markers = [
314321
"numerical: marks numerical tests for adjoint gradients that require running simulations (deselect with '-m \"not numerical\"')",
315322
]
@@ -332,82 +339,24 @@ python_files = "*.py"
332339
[tool.mypy]
333340
python_version = "3.10"
334341
files = [
335-
"tidy3d/web",
336-
"tidy3d/config",
337-
"tidy3d/material_library",
338-
"tidy3d/components/geometry"
342+
"tidy3d",
339343
]
340344
ignore_missing_imports = true
341345
follow_imports = "skip"
342346
disallow_untyped_defs = true
343347
disable_error_code = [
344-
"abstract",
345-
"annotation-unchecked",
346348
"arg-type",
347-
"assert-type",
348349
"assignment",
349350
"attr-defined",
350-
"await-not-async",
351351
"call-arg",
352352
"call-overload",
353-
"comparison-overlap",
354-
"dict-item",
355-
"empty-body",
356-
"exit-return",
357-
"explicit-override",
358-
"func-returns-value",
359-
"has-type",
360-
"ignore-without-code",
361-
"import",
362-
"import-not-found",
363353
"import-untyped",
364354
"index",
365-
"list-item",
366-
"literal-required",
367-
"method-assign",
368355
"misc",
369-
"mutable-override",
370-
"name-defined",
371-
"name-match",
372-
"narrowed-type-not-subtype",
373-
"no-any-return",
374-
"no-any-unimported",
375-
"no-overload-impl",
376-
"no-redef",
377-
"no-untyped-call",
378356
"operator",
379-
"overload-cannot-match",
380-
"overload-overlap",
381357
"override",
382-
"possibly-undefined",
383-
"prop-decorator",
384-
"redundant-cast",
385-
"redundant-expr",
386-
"redundant-self",
387-
"return",
388358
"return-value",
389-
"safe-super",
390-
"str-bytes-safe",
391-
"str-format",
392-
"syntax",
393-
"top-level-await",
394-
"truthy-bool",
395-
"truthy-function",
396-
"truthy-iterable",
397-
"type-abstract",
398-
"type-arg",
399-
"type-var",
400-
"typeddict-item",
401-
"typeddict-readonly-mutated",
402-
"typeddict-unknown-key",
403-
"unimported-reveal",
404359
"union-attr",
405-
"unreachable",
406-
"unused-awaitable",
407-
"unused-coroutine",
408-
"unused-ignore",
409-
"used-before-def",
410-
"valid-newtype",
411360
"valid-type",
412361
"var-annotated",
413362
]

0 commit comments

Comments
 (0)