Skip to content

Commit 9419bd0

Browse files
FEAT: Latest git submodule testing 🍰
1 parent b2d0e6a commit 9419bd0

File tree

11 files changed

+152
-114
lines changed

11 files changed

+152
-114
lines changed

.github/workflows/run_tests.yml

+68
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,79 @@ jobs:
1818
uses: actions/setup-python@v4
1919
with:
2020
python-version: "3.10"
21+
submodules: 'recursive'
2122
- name: Test pre-commit hooks
2223
run: |
2324
python -m pip install --upgrade pip
2425
pip install pre-commit
2526
pre-commit run
27+
test-latest-submodules:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout repository with submodules
31+
uses: actions/checkout@v3
32+
with:
33+
submodules: 'recursive'
34+
# This fetches only a single branch by default, so additional fetch is needed
35+
fetch-depth: 0 # Optionally, set to 0 to fetch all history for all branches and tags
36+
37+
- name: Determine current branch or PR ref
38+
id: get_branch
39+
run: |
40+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
41+
echo "BRANCH_NAME=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV
42+
else
43+
echo "BRANCH_NAME=$(echo $GITHUB_REF | sed 's|refs/heads/||')" >> $GITHUB_ENV
44+
fi
45+
echo $BRANCH_NAME
46+
shell: bash
47+
48+
- name: Initialize and update submodule
49+
run: |
50+
git submodule update --init --recursive
51+
52+
- name: Check if submodules are up to date
53+
shell: bash
54+
run: |
55+
NOTEBOOKS_PATH=docs/notebooks
56+
FAQ_PATH=docs/faq
57+
58+
# Checking out Notebooks submodule with the same branch as the main project
59+
echo "Checking $NOTEBOOKS_PATH for updates..."
60+
cd $NOTEBOOKS_PATH
61+
echo $(git fetch --all --verbose)
62+
echo $(git remote get-url origin)
63+
git checkout origin/$BRANCH_NAME
64+
if git show-ref --verify refs/remotes/origin/$BRANCH_NAME; then
65+
echo "Branch $BRANCH_NAME exists."
66+
else
67+
echo "::error::Branch $BRANCH_NAME does not exist on remote."
68+
exit 1
69+
fi
70+
NOTEBOOKS_LATEST_COMMIT=$(git rev-parse refs/remotes/origin/${{ env.BRANCH_NAME }})
71+
NOTEBOOKS_CURRENT_COMMIT=$(git rev-parse HEAD)
72+
73+
74+
cd ../..
75+
if [ "$NOTEBOOKS_LATEST_COMMIT" != "$NOTEBOOKS_CURRENT_COMMIT" ]; then
76+
echo "::error ::Submodule $NOTEBOOKS_PATH is not up to date with the ${{ env.BRANCH_NAME }} branch. Please update it."
77+
exit 1
78+
else
79+
echo "Submodule $NOTEBOOKS_PATH is up to date with the ${{ env.BRANCH_NAME }} branch."
80+
fi
81+
82+
# Checking FAQs only on the develop branch.
83+
echo "Checking $FAQ_PATH for updates..."
84+
cd $FAQ_PATH
85+
FAQ_LATEST_COMMIT=$(git rev-parse origin/develop)
86+
FAQ_CURRENT_COMMIT=$(git rev-parse HEAD)
87+
cd ../..
88+
if [ "$FAQ_LATEST_COMMIT" != "$FAQ_CURRENT_COMMIT" ]; then
89+
echo "::error ::Submodule $FAQ_PATH is not up to date. Please update it."
90+
exit 1
91+
else
92+
echo "Submodule $FAQ_PATH is up to date."
93+
fi
2694
build:
2795
name: test ${{ matrix.python-version }} - ${{ matrix.platform }}
2896
runs-on: ${{ matrix.platform }}

.github/workflows/sync-to-readthedocs-repo.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ jobs:
8080
uses: actions/checkout@v3
8181
with:
8282
submodules: true
83+
- id: clean
84+
run: |
85+
rm -rf .github/ # removes the further triggered github actions.
8386
- name: Create new branch if version pattern
8487
uses: GuillaumeFalourd/create-other-repo-branch-action@v1.5
8588
with:

.gitmodules

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[submodule "docs/notebooks"]
22
path = docs/notebooks
33
url = git@github.com:flexcompute/tidy3d-notebooks.git
4-
branch = develop
54
[submodule "docs/faq"]
65
path = docs/faq
76
url = https://github.com/flexcompute/tidy3d-faq

README.md

+22-111
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,14 @@ Name](https://img.shields.io/badge/pypi-tidy3d-blue?style=for-the-badge)](https:
1212

1313
![](https://raw.githubusercontent.com/flexcompute/tidy3d/main/img/Tidy3D-logo.svg)
1414

15-
Tidy3D is a software product from Flexcompute that enables large scale electromagnetic simulation using the finite-difference time-domain (FDTD) method.
15+
Tidy3D is a software package for solving extremely large electrodynamics problems using the finite-difference time-domain (FDTD) method. It can be controlled through either an [open source python package](https://github.com/flexcompute/tidy3d) or a [web-based graphical user interface](https://tidy3d.simulation.cloud).
1616

17-
This repository stores the python interface for Tidy3d.
17+
This repository contains the python API to allow you to:
1818

19-
This code allows you to:
2019
* Programmatically define FDTD simulations.
2120
* Submit and manage simulations running on Flexcompute's servers.
2221
* Download and postprocess the results from the simulations.
2322

24-
You can find a detailed documentation and API reference [here](https://docs.flexcompute.com/projects/tidy3d/en/stable/).
25-
The source code for our documentation is [here](https://github.com/flexcompute-readthedocs/tidy3d-docs).
2623

2724
![](https://raw.githubusercontent.com/flexcompute/tidy3d/main/img/snippet.png)
2825

@@ -34,7 +31,7 @@ Note that while this front end package is open source, to run simulations on Fle
3431
You can sign up for an account [here](https://tidy3d.simulation.cloud/signup).
3532
After that, you can install the front end with the instructions below, or visit [this page](https://docs.flexcompute.com/projects/tidy3d/en/stable/install.html) in our documentation for more details.
3633

37-
### Installing the front end
34+
### Quickstart Installation
3835

3936
To install the Tidy3D Python API locally, the following instructions should work for most users.
4037

@@ -53,124 +50,38 @@ import tidy3d.web as web
5350
web.configure("XXX")
5451
```
5552

56-
If those commands did not work, advanced installation instructions are below, which should help solve the issue.
53+
**Advanced installation instructions for all platforms is available in the [documentation installation guides](https://docs.flexcompute.com/projects/tidy3d/en/latest/install.html).**
5754

58-
### Advanced Installation Instructions
55+
### Authentication Verification
5956

60-
Some users might require more a specialized installation, which we cover below.
61-
62-
#### Using pip (recommended)
63-
64-
The easiest way to install the tidy3d python interface is through [pip](https://pypi.org/project/tidy3d/).
65-
66-
```
67-
pip install tidy3d
68-
```
69-
70-
This will install the latest stable version.
71-
72-
To get a specific version `x.y.z`, including the "pre-release" versions, you may specify the version in the command as:
73-
74-
```
75-
pip install tidy3d==x.y.z
76-
```
77-
78-
### Installing from source
79-
80-
Alternatively, for development purposes, eg. developing your own features, you may download and install the package from source as:
81-
82-
```
83-
git clone https://github.com/flexcompute/tidy3d.git
84-
cd tidy3d
85-
pip install -e .
86-
```
87-
88-
### Configuring and authentication
89-
90-
With the front end installed, it must now be configured with your account information, which is done via an "API key".
91-
92-
You can find your API key in the [web interface](http://tidy3d.simulation.cloud). After signing in and navigating to the account page by clicking the "Account Center" icon on the left-hand side. Then, click on the "API key" tab on the right hand side of the menu and copy your API key.
93-
94-
Note: We refer to your API specific API key value as `XXX` below.
95-
96-
To link your API key with Tidy3D, you may use one of three following options:
97-
98-
#### Command line (recommended)
99-
100-
The easiest way is through the command line via the `tidy3d configure` command. Run:
101-
102-
```
103-
tidy3d configure
104-
```
105-
106-
and then enter your API key `XXX` when prompted.
107-
108-
Note that Windows users must run the following instead (ideally in an anaconda prompt):
109-
110-
```
111-
pip install pipx
112-
pipx run tidy3d configure
113-
```
114-
115-
You can also specify your API key directly as an option to this command using the `api-key` argument, for example:
116-
117-
```
118-
tidy3d configure --apikey=XXX
119-
```
120-
121-
#### Manually
122-
123-
Alternatively, you can manually set up the config file where Tidy3D looks for the API key. The API key must be in a file called `.tidy3d/config` located in your home directory, containing the following
57+
To test the authentication, you may try importing the web interface via.
12458

12559
```
126-
apikey = "XXX"
60+
python -c "import tidy3d; tidy3d.web.test()"
12761
```
12862

129-
You can manually set up your file like this, or do it through the command line line:
130-
131-
``echo 'apikey = "XXX"' > ~/.tidy3d/config``
132-
133-
Note the quotes around `XXX`.
134-
135-
Note that Windows users will most likely need to place the `.tidy3d/config` file in their `C:\Users\username\` directory (where `username` is your username).
136-
137-
#### Environment Variable
138-
139-
Lastly, you may set the API key as an environment variable named `SIMCLOUD_APIKEY`.
140-
141-
This can be set up using
142-
143-
``export SIMCLOUD_APIKEY="XXX"``
144-
145-
Note the quotes around `XXX`.
146-
147-
### Testing the installation and authentication
148-
149-
#### Front end package
150-
151-
You can verify the front end installation worked by running:
152-
153-
```
154-
python -c "import tidy3d as td; print(td.__version__)"
155-
```
63+
It should pass without any errors if the API key is set up correctly.
15664

157-
and it should print out the version number, for example:
65+
To get started, our documentation has a lot of [examples](https://docs.flexcompute.com/projects/tidy3d/en/latest/notebooks/index.html) for inspiration.
15866

159-
```
160-
2.0.0
161-
```
67+
## Common Documentation References
16268

163-
#### Authentication
69+
| API Resource | URL |
70+
|--------------------|----------------------------------------------------------------------------------|
71+
| Installation Guide | https://docs.flexcompute.com/projects/tidy3d/en/latest/install.html |
72+
| Documentation | https://docs.flexcompute.com/projects/tidy3d/en/latest/index.html |
73+
| Example Library | https://docs.flexcompute.com/projects/tidy3d/en/latest/notebooks/docs/index.html |
74+
| FAQ | https://docs.flexcompute.com/projects/tidy3d/en/latest/faq/docs/index.html |
16475

165-
To test the authentication, you may try importing the web interface via.
16676

167-
```
168-
python -c "import tidy3d.web"
169-
```
77+
## Related Source Repositories
17078

171-
It should pass without any errors if the API key is set up correctly.
79+
| Name | Repository |
80+
|-------------------|-------------------------------------------------|
81+
| Source Code | https://github.com/flexcompute/tidy3d |
82+
| Notebooks Source | https://github.com/flexcompute/tidy3d-notebooks |
83+
| FAQ Source Code | https://github.com/flexcompute/tidy3d-faq |
17284

173-
To get started, our documentation has a lot of [examples](https://docs.flexcompute.com/projects/tidy3d/en/latest/examples.html) for inspiration.
17485

17586
## Issues / Feedback / Bug Reporting
17687

docs/404.rst

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.. _404:
2+
3+
404
4+
===
5+
6+
Oops! You've hit a wavelength that doesn't resonate with our server. Try a different frequency!
7+
8+
If you have arrived here from a link in our pre-v2.6 documentation, we apologize for the inconvenience. We have restructured our documentation to make it more user-friendly and informative, and the page links have changed. We recommend you return to the `homepage <index.html>`_ and navigate to the page you were looking for from there.
9+
10+
Please let us know what happened that got you here by raising a `GitHub issue <https://github.com/flexcompute/tidy3d/issues>`_ if not! We'll do our best to help you out.
11+
12+
.. image:: /_static/img/404.png
13+
:alt: 404 - Page not found
14+
:align: center

docs/_static/img/404.png

4.75 MB
Loading

docs/development/documentation.rst

+8
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,11 @@ The command can be executed using the ``poetry run`` command. It requires specif
8181
poetry run tidy3d develop replace-in-files -d ./ -j ./docs/versions/test_replace_in_files.json -v 0.18.0 --dry-run True
8282
8383
This example will process files in the current directory (``./``), using the replacement rules specified in ``test_replace_in_files.json`` for version ``0.18.0``. The ``--dry-run`` flag set to ``True`` ensures that changes are not actually applied, allowing for a safe preview of potential modifications.
84+
85+
86+
Further Guidance
87+
-----------------
88+
89+
- The sphinx warnings are OK as long as the build occurs, errors will cause the crash the build.
90+
- Make sure all your internal API references start with ``tidy3d.<your_reference>``
91+
- In notebooks, always have absolute links, otherwise the links will break when the user downloads them.

docs/faq

Submodule faq updated 113 files

docs/index.rst

+9
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ Tidy3D Electromagnetic Solver
2222

2323
Tidy3D is a software package for solving extremely large electrodynamics problems using the finite-difference time-domain (FDTD) method. It can be controlled through either an `open source python package <https://github.com/flexcompute/tidy3d>`_ or a `web-based graphical user interface <https://tidy3d.simulation.cloud>`_.
2424

25+
This python API allows you to:
26+
27+
* Programmatically define FDTD simulations.
28+
* Submit and manage simulations running on Flexcompute's servers.
29+
* Download and postprocess the results from the simulations.
30+
31+
32+
33+
2534
Get Started
2635
===========
2736

tidy3d/constants.py

+26
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,40 @@
1414

1515
# fundamental constants (https://physics.nist.gov)
1616
C_0 = 2.99792458e14
17+
"""
18+
Speed of light in vacuum [um/s]
19+
"""
20+
1721
MU_0 = 1.25663706212e-12
22+
"""
23+
Vacuum permeability [H/um]
24+
"""
25+
1826
EPSILON_0 = 1 / (MU_0 * C_0**2)
27+
"""
28+
Vacuum permittivity [F/um]
29+
"""
1930

2031
#: Free space impedance
2132
ETA_0 = np.sqrt(MU_0 / EPSILON_0)
33+
"""
34+
Vacuum impedance in Ohms
35+
"""
36+
2237
Q_e = 1.602176634e-19
38+
"""
39+
Fundamental charge [C]
40+
"""
41+
2342
HBAR = 6.582119569e-16
43+
"""
44+
Reduced Planck constant [eV*s]
45+
"""
46+
2447
K_B = 8.617333262e-5
48+
"""
49+
Boltzmann constant [eV/K]
50+
"""
2551

2652
# floating point precisions
2753
dp_eps = np.finfo(np.float64).eps

0 commit comments

Comments
 (0)