Skip to content
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

Documentation upgrade after big rebase #1320

Merged
merged 1 commit into from
Dec 20, 2023
Merged

Conversation

daquinteroflex
Copy link
Collaborator

Currently verifying what has happened

tidy3d/web/api/webapi.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@tylerflex tylerflex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@daquintero this is an insane amount of work, super excited to get it merged. All of my comments are pretty minor and most are things we can probably work on later. So feel free to work on as many as you want before we take another look Monday.

And if you want people from MC or the EM team to take a look feel free to assign other reviewers.

black . --check --diff
ruff check tidy3d --fix --exit-non-zero-on-fix
pytest -rA tests
pytest -rA tests/test_data/_test_datasets_no_vtk.py
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's figure out what to do about this, if we want to keep it in the tests, we can remove the underscore.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! I think they're related to @dbochkov-flexcompute heat/vtk addition? What do you think Daniil?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tests that everything works as expected if vtk package is not installed. _test_datasets_no_vtk.py contains a mock for vtk import failure, but I couldn't make it work if it runs together with the other tests (vtk gets imported in other tests and I am not sure how to properly unload it). Thus, I added underscore to excluded it from all other tests and run it in a separate pytest execution. Is there a nicer way to accomplish this?

with:
folder: build_toc
token: ${{ secrets.GH_PAT }}
repository-name: flexcompute/tidy3d-example-library
Copy link
Collaborator

@tylerflex tylerflex Dec 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this repo exist? is it supposed to be here? https://github.com/flexcompute/tidy3d-example-library or is it referring to the website https://www.flexcompute.com/tidy3d-example-library/

Copy link
Collaborator Author

@daquinteroflex daquinteroflex Dec 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is related to the new workflow in terms of the syncing the new notebooks repo, but without affecting the existing MC setup. I understand https://github.com/flexcompute/tidy3d-example-library is what is used to host https://www.flexcompute.com/tidy3d-example-library/. This github action came from the tidy3d-docs repo, which was basically automatically filtering out stuff not needed to render the notebooks. I've modified it so that it gets updated in the same way in order not to break compatibility, but in reality MC could use the new development tidy3d-notebooks repo which is equivalent rather than this proxy repo.

In any case, this should be an equivalent github action workflow to what existed before in the tidy3d-docs repo. I'm not sure which is Yongwei's github handle. Is it @magiWei maybe wants to look into it? This is related to the message I sent you a few weeks ago and just including if it's handy?

Hi Yongwei, hope you've been well!
I have good news that maybe you find interesting. We have the new documentation demo up and running. Hope you like it. We're getting prepared to eventually implement this in the 2.6 release and it would be great to get you onboard with the plan and solve any issues to make sure we're happy with it.
The summary of the implementation is here:
Currently the demonstrated demo implemented flow goes as follows:
Development occurs in tidy3d/repo_merge_no_history. The sync-to-readthedocs-repo action synchronises the main repository with flexcompute-readthedocs/tidy3d-docs-demo which can be built and hosted by readthedocs without access to the flexcompute organisation. This demo is set up with the corresponding flexcompute/tidy3d-notebooks/develop, so that the docs build and pull this github submodule. This is what I aim to replicate with the main repositories & branches.
Summary of changes:

  • tidy3d consolidates docs + source for development.
  • tidy3d-notebooks is the new sole directory of notebooks development. (This could replace tidy3d-example-notebooks if we wanted too)
  • The easiest future for of tidy3d-docs for everyone could be that it just becomes a mirror repo to tidy3d like in the implementation I describe above. However, because the repository had to have its directories restructured, I've done some modifications to the sync and sync-to-proxy-repo Github actions. I suspect there are likely to be transition issues in the implementation which we can solve together. It's a bit tricky to test them without running them, and it'd be great to get your input and feedback here.
    I've discussed the caveats of the implementation plan here if you want a full explanation.

.gitignore Show resolved Hide resolved
README.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
tidy3d/web/api/container.py Outdated Show resolved Hide resolved
tidy3d/web/api/container.py Outdated Show resolved Hide resolved
tidy3d/web/api/container.py Show resolved Hide resolved
tidy3d/web/api/webapi.py Outdated Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add docstrings to these fns

@tylerflex
Copy link
Collaborator

Some more thoughts:

  1. Should we move the CLI to their own directory outside of tidy3d/web? does it make sense to? since now we have develop and convert, which dont need the webapi.

@tylerflex
Copy link
Collaborator

tylerflex commented Dec 15, 2023

just FYI, I got this when running tidy3d develop configure-dev-environment on my Mac

    verify_pandoc_is_installed_and_version_less_than_3()
  File "/Users/twhughes/Documents/Flexcompute/tidy3d-docs/tidy3d/tidy3d/web/cli/develop.py", line 19, in verify_pandoc_is_installed_and_version_less_than_3
    result = echo_and_run_subprocess(
TypeError: echo_and_run_subprocess() got an unexpected keyword argument 'capture_output'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/twhughes/.pyenv/versions/3.10.9/bin/tidy3d", line 8, in <module>
    sys.exit(tidy3d_cli())
  File "/Users/twhughes/.pyenv/versions/3.10.9/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/Users/twhughes/.pyenv/versions/3.10.9/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/Users/twhughes/.pyenv/versions/3.10.9/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/twhughes/.pyenv/versions/3.10.9/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/twhughes/.pyenv/versions/3.10.9/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/twhughes/.pyenv/versions/3.10.9/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/Users/twhughes/Documents/Flexcompute/tidy3d-docs/tidy3d/tidy3d/web/cli/develop.py", line 195, in configure_development_environment
    raise OSError(
OSError: Please install pandoc < 3 depending on your platform: https://pandoc.org/installing.html . Then run this command again. You can also follow our detailed instructions under the development guide.

did you want to pass the kwargs to subprocess.run and return the result like

def echo_and_run_subprocess(command: list, **kwargs):
    concatenated_command = " ".join(command)
    print("Running: " + concatenated_command)
    return subprocess.run(command, **kwargs)

After this, it's breaking because ModuleNotFoundError: No module named 'virtualenv', which I have. Interestingly I can't install it with poetry install virtualenv due to the same error.

@tylerflex
Copy link
Collaborator

yea anytime I try to poetry install "tidy3d[dev]" I get this kind of error.

poetry install "tidy3d[dev]"
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/poetry/1.7.1/libexec/lib/python3.12/site-packages/cleo/application.py", line 327, in run
    exit_code = self._run(io)
                ^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/poetry/1.7.1/libexec/lib/python3.12/site-packages/poetry/console/application.py", line 188, in _run
    self._load_plugins(io)
  File "/opt/homebrew/Cellar/poetry/1.7.1/libexec/lib/python3.12/site-packages/poetry/console/application.py", line 354, in _load_plugins
    manager.load_plugins()
  File "/opt/homebrew/Cellar/poetry/1.7.1/libexec/lib/python3.12/site-packages/poetry/plugins/plugin_manager.py", line 38, in load_plugins
    self._load_plugin_entry_point(ep)
  File "/opt/homebrew/Cellar/poetry/1.7.1/libexec/lib/python3.12/site-packages/poetry/plugins/plugin_manager.py", line 76, in _load_plugin_entry_point
    plugin = ep.load()  # type: ignore[no-untyped-call]
             ^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/metadata/__init__.py", line 205, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 994, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/opt/homebrew/Cellar/poetry/1.7.1/libexec/lib/python3.12/site-packages/poetry_plugin_export/plugins.py", line 7, in <module>
    from poetry_plugin_export.command import ExportCommand
  File "/opt/homebrew/Cellar/poetry/1.7.1/libexec/lib/python3.12/site-packages/poetry_plugin_export/command.py", line 12, in <module>
    from poetry_plugin_export.exporter import Exporter
  File "/opt/homebrew/Cellar/poetry/1.7.1/libexec/lib/python3.12/site-packages/poetry_plugin_export/exporter.py", line 11, in <module>
    from poetry.repositories.http_repository import HTTPRepository
  File "/opt/homebrew/Cellar/poetry/1.7.1/libexec/lib/python3.12/site-packages/poetry/repositories/__init__.py", line 4, in <module>
    from poetry.repositories.repository_pool import RepositoryPool
  File "/opt/homebrew/Cellar/poetry/1.7.1/libexec/lib/python3.12/site-packages/poetry/repositories/repository_pool.py", line 11, in <module>
    from poetry.config.config import Config
  File "/opt/homebrew/Cellar/poetry/1.7.1/libexec/lib/python3.12/site-packages/poetry/config/config.py", line 18, in <module>
    from poetry.locations import CONFIG_DIR
  File "/opt/homebrew/Cellar/poetry/1.7.1/libexec/lib/python3.12/site-packages/poetry/locations.py", line 9, in <module>
    from platformdirs import user_cache_path
ModuleNotFoundError: No module named 'platformdirs'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homebrew/bin/poetry", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/homebrew/Cellar/poetry/1.7.1/libexec/lib/python3.12/site-packages/poetry/console/application.py", line 411, in main
    exit_code: int = Application().run()
                     ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/poetry/1.7.1/libexec/lib/python3.12/site-packages/cleo/application.py", line 338, in run
    self.render_error(e, io)
  File "/opt/homebrew/Cellar/poetry/1.7.1/libexec/lib/python3.12/site-packages/poetry/console/application.py", line 180, in render_error
    self.set_solution_provider_repository(self._get_solution_provider_repository())
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/poetry/1.7.1/libexec/lib/python3.12/site-packages/poetry/console/application.py", line 400, in _get_solution_provider_repository
    from poetry.mixology.solutions.providers.python_requirement_solution_provider import (
  File "/opt/homebrew/Cellar/poetry/1.7.1/libexec/lib/python3.12/site-packages/poetry/mixology/solutions/providers/__init__.py", line 3, in <module>
    from poetry.mixology.solutions.providers.python_requirement_solution_provider import (
  File "/opt/homebrew/Cellar/poetry/1.7.1/libexec/lib/python3.12/site-packages/poetry/mixology/solutions/providers/python_requirement_solution_provider.py", line 9, in <module>
    from poetry.puzzle.exceptions import SolverProblemError
  File "/opt/homebrew/Cellar/poetry/1.7.1/libexec/lib/python3.12/site-packages/poetry/puzzle/__init__.py", line 3, in <module>
    from poetry.puzzle.solver import Solver
  File "/opt/homebrew/Cellar/poetry/1.7.1/libexec/lib/python3.12/site-packages/poetry/puzzle/solver.py", line 16, in <module>
    from poetry.puzzle.provider import Indicator
  File "/opt/homebrew/Cellar/poetry/1.7.1/libexec/lib/python3.12/site-packages/poetry/puzzle/provider.py", line 27, in <module>
    from poetry.packages.direct_origin import DirectOrigin
  File "/opt/homebrew/Cellar/poetry/1.7.1/libexec/lib/python3.12/site-packages/poetry/packages/direct_origin.py", line 10, in <module>
    from poetry.inspection.info import PackageInfo
  File "/opt/homebrew/Cellar/poetry/1.7.1/libexec/lib/python3.12/site-packages/poetry/inspection/info.py", line 24, in <module>
    from poetry.utils.env import EnvCommandError
  File "/opt/homebrew/Cellar/poetry/1.7.1/libexec/lib/python3.12/site-packages/poetry/utils/env/__init__.py", line 9, in <module>
    from poetry.utils.env.base_env import Env
  File "/opt/homebrew/Cellar/poetry/1.7.1/libexec/lib/python3.12/site-packages/poetry/utils/env/base_env.py", line 15, in <module>
    from virtualenv.seed.wheels.embed import get_embed_wheel
ModuleNotFoundError: No module named 'virtualenv'

@daquinteroflex
Copy link
Collaborator Author

daquinteroflex commented Dec 18, 2023

Some more thoughts:versions

  1. Should we move the CLI to their own directory outside of tidy3d/web? does it make sense to? since now we have develop and convert, which dont need the webapi.

So I thought about this too. The issue is that the tidy3d app is structured from the web section. It might involve a bit of a restructure that would have to test with the MC effects to have everything in a proper place. I could do so if we wanted.

yea anytime I try to poetry install "tidy3d[dev]" I get this kind of error.

poetry install "tidy3d[dev]"

...

So I've created a new command that should be reproducible

poetry run tidy3d develop install-in-poetry

but for reference the command style is:

poetry install -E dev

After this, it's breaking because ModuleNotFoundError: No module named 'virtualenv', which I have. Interestingly I can't install it with poetry install virtualenv due to the same error.

Hmm this is new to me! I wonder if it could be a python 3.12 thing, since I have not tested with that, shall I? I had in the tests to support till 3.11?

EDIT: I've checked that the command you ran was in 3.10, weird. Maybe this is a second effect of my installation commands, since you have two poetry versions installed, in different python versions. Hmm I will have a think how to make this more robust. It's weird since the command checks poetry is not installed before installing it in homebrew. But surely something weird is happening.

I'm going to edit that the poetry installation should use the python version that was used to install it, ie the one on the terminal you ran, rather than a system default. Maybe this helps on making it more reproducible as potentially the issue is that it is using a python on the system rather than your venv.

Could also be related to this issue

@tylerflex
Copy link
Collaborator

I tried again with tidy3d develop configure-dev-environment from the latest state of this branch and still get the same virtualenv error. It's strange to me that it runs python 3.12. I think my system default is 3.10

@daquinteroflex
Copy link
Collaborator Author

I'm currently writing a uninstall-dev-envrionment script to verify if it was an installation problem and reproduce it haha, sorry about these issues. I have a suspicion it might have to do with a faulty installation somewhere on pipx so wanted to see if you tried installing and reinstalling if it worked. Currently sorting out the final issues of the uninstall-dev-envrionment command

@daquinteroflex
Copy link
Collaborator Author

Shall we give this a try? Works on ubuntu

pip install -e .
tidy3d develop uninstall-dev-envrionment
tidy3d develop install-dev-environment
poetry run tidy3d develop verify-dev-environment

@daquinteroflex
Copy link
Collaborator Author

daquinteroflex commented Dec 18, 2023

Just to update:

In any case, what this means, is that those actions get deployed from a different repo to this one, so merging this should not affect the github actions fundamentally.

@daquinteroflex daquinteroflex merged commit 907d217 into pre/2.6 Dec 20, 2023
13 checks passed
@daquinteroflex daquinteroflex deleted the repo_merge_no_history branch December 20, 2023 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants