Skip to content

Commit 34f9a54

Browse files
committed
chore: add dependency groups for design plugin as well as heat &
charge solvers
1 parent 42afa41 commit 34f9a54

File tree

5 files changed

+81
-14
lines changed

5 files changed

+81
-14
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
### Changed
1515

16+
- Dependencies for the `design` plugin can now be installed via `pip install tidy3d[design]`.
17+
1618
### Fixed
1719
- Bug in `LayerRefinementSpec` that refines grids outside the layer region when one in-plane dimension is of size infinity.
1820
- Querying tasks was sometimes erroring unexpectedly.

docs/install.rst

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,63 @@ Some users or systems may require a more specialized installation, which we will
171171

172172
See the development installation `instructions <../development/index.html>`_. You can install ``tidy3d`` within reproducible environment guaranteed by the developers using the ``poetry.lock`` installation and the ``poetry`` toolchain.
173173

174+
Optional Dependencies
175+
=====================
176+
177+
Tidy3D provides several optional dependency groups that you can install based on your specific needs.
178+
179+
Installing Optional Core Dependencies
180+
-------------------------------------
181+
182+
Tidy3D has several optional dependencies that provide additional functionality. You can install these using the following syntax:
183+
184+
.. code-block:: bash
185+
186+
pip install "tidy3d[dependency_group]"
187+
188+
Where ``dependency_group`` is one of the following:
189+
190+
- ``gdspy``: Adds support for GDS export using `gdspy <https://github.com/heitzmann/gdspy>`_.
191+
- ``gdstk``: Adds support for GDS export using `gdstk <https://github.com/heitzmann/gdstk>`_.
192+
- ``trimesh``: Support for more complex mesh handling and manipulation.
193+
- ``vtk``: Support for working with unstructured data.
194+
- ``heatcharge``: Additional dependencies for heat & charge solvers.
195+
196+
For example, to install Tidy3D with trimesh support:
197+
198+
.. code-block:: bash
199+
200+
pip install "tidy3d[trimesh]"
201+
202+
Installing Plugin Dependencies
203+
------------------------------
204+
205+
Tidy3D also offers plugins that require additional dependencies:
206+
207+
- ``design``: Design space exploration and optimization.
208+
- ``pytorch``: A PyTorch wrapper for objective functions defined using autograd.
209+
- ``adjoint``: Adjoint optimization using JAX (deprecated in favor of native autorad support in Tidy3D)
210+
211+
For example, to install the design plugin dependencies:
212+
213+
.. code-block:: bash
214+
215+
pip install "tidy3d[design]"
216+
217+
Multiple dependency groups can be installed simultaneously:
218+
219+
.. code-block:: bash
220+
221+
pip install "tidy3d[design,trimesh]"
222+
223+
Developer Installation
224+
----------------------
225+
226+
For developers and those who want to install all optional dependencies:
227+
228+
.. code-block:: bash
229+
230+
pip install "tidy3d[dev]"
174231
175232
Next Steps
176233
==========

poetry.lock

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

pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,15 @@ docs = [
208208
]
209209
gdspy = ["gdspy"]
210210
gdstk = ["gdstk"]
211-
jax = ["jaxlib", "jax"]
212211
scikit-rf = ["scikit-rf"]
213212
trimesh = ["trimesh", "networkx", "rtree"]
214213
vtk = ["vtk"]
215214
ruff = ["ruff"]
215+
heatcharge = ["trimesh", "vtk", "devsim"]
216+
# plugins with extra deps
217+
adjoint = ["jaxlib", "jax"]
218+
pytorch = ["torch"]
219+
design = ["bayesian-optimization", "pygad", "pyswarms"]
216220

217221
[tool.poetry.scripts]
218222
tidy3d = "tidy3d.web.cli:tidy3d_cli"

tidy3d/plugins/design/method.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ def _run(self, parameters: Tuple[ParameterType, ...], run_fn: Callable, console)
245245
from bayes_opt import BayesianOptimization, UtilityFunction
246246
except ImportError:
247247
raise ImportError(
248-
"Cannot run Bayesian optimization as 'bayes_opt' module not found. Please check installation or run 'pip install bayesian-optimization'."
248+
"Cannot run Bayesian optimization as 'bayes_opt' module not found. "
249+
"Please check installation or run 'pip install bayesian-optimization==1.5.1'."
249250
)
250251

251252
# Identify non-numeric params and define boundaries for Bay-opt

0 commit comments

Comments
 (0)