-
Notifications
You must be signed in to change notification settings - Fork 65
FXC-3298 Config overhaul #2711
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FXC-3298 Config overhaul #2711
Conversation
98f0f04 to
80d31d7
Compare
9198880 to
918eaa9
Compare
037a070 to
56213d0
Compare
b3b2a4d to
e68bea1
Compare
a4de778 to
636bf31
Compare
636bf31 to
2a34a9a
Compare
|
@lucas-flexcompute tagging you as I think this will also be relevant for PF. In a follow-up, we'll also want to integrate e.g. the local caching here. We can consider making the cache path configurable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional Comments (1)
-
tidy3d/web/core/http_util.py, line 88-93 (link)style: Update the error message to reflect the new config file location and format (XDG base directory,
.tomlformat) instead of referring to the legacy~/.tidy3d/configfile.
44 files reviewed, 32 comments
0e07bdf to
33aca5e
Compare
3ad69ef to
dd49d7d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks nice! Is it possible to add config sections dynamically? Meaning, during photonforge initialization (after tidy3d) I @register_section to retrieve photonforge-specific configuration?
dd49d7d to
07c1e8b
Compare
Yes! That's exactly the intended usage. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Reading through the docs, it sounds good. We'll need to update the backend a bit to avoid deprecation warnings in some places but this can be done after this is merged. Full disclosure I did not really go carefully through the all the code. It does seem like there might be some things that still need some cleanup though.
Another thought I had while reading through this: you've moved the various constants for the adjoint plugin to the config setting, making them "feel" like they are configurable by the user. However, that would only be the case if they use local gradients. For remote gradients (default) the default config will always be used.
Yeah good point I forgot about that. I tried to be conservative with what we expose, especially with what is persisted, but I might have to iterate on that a bit more. My hope is that once this is in, we can start moving some of our globals (not only autograd) into the config. Eventually we probably also would need to transmit the config and other runtime settings if they should have an effect. |
Well, kind of, but we have to be conservative too, because the purpose of a lot of the restrictions is to avoid indefinite vjp processing on our servers. |
5f822b5 to
c108d89
Compare
|
@momchil-flex I've done the following now:
I think for now that should work? |
|
Nice, sounds good! |
8e2bbdc to
854e196
Compare
854e196 to
a421952
Compare
~/.config/tidy3d/config.tomlon macOS/Linux,%APPDATA%\tidy3d\config.tomlon Windows) while still honoring the legacy~/.tidy3d/config.jsonwhen present.tidy3d config migrate) that copies legacy files into the new location and format, plustidy3d config resetto clear the profile; loader warnings now point users to these commands.tidy3d.configobjects, the wrapper keeps API parity, and we continue to fall back to in-memory defaults if no profile is found.Greptile Overview
Updated On: 2025-10-20 12:44:02 UTC
Greptile Summary
This PR introduces a comprehensive configuration system overhaul that migrates from a legacy flat JSON-based config (
~/.tidy3d/config.json) to a structured, profile-based TOML system following XDG Base Directory standards. The new architecture usesConfigManagerto orchestrate configuration loading from multiple sources (builtin profiles, base config, user profiles, environment variables) with clear precedence, while maintaining backward compatibility throughLegacyConfigWrapper. Configuration constants previously scattered across the codebase—especially autograd-related parameters likeMAX_NUM_ADJOINT_PER_FWD,GRADIENT_DTYPE_FLOAT, and cylinder discretization settings—are now centralized underconfig.adjoint.*and accessible at runtime. The system includes CLI helpers (tidy3d config migrate,tidy3d config reset), plugin registration infrastructure, per-field persistence flags, and extensive test coverage. All existing APIs remain functional through wrapper classes that emit deprecation warnings, allowing gradual migration while providing users immediate access to configuration flexibility.Important Files Changed
Changed Files