-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
42774bf
commit e7b7724
Showing
10 changed files
with
2,226 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,59 @@ | ||
[tool.poetry] | ||
name = "tidy3d" | ||
version = "1.8.0" | ||
description = "" | ||
authors = ["Tyler Hughes <tyler@flexcompute.com>"] | ||
readme = "README.md" | ||
|
||
[tool.poetry.dependencies] | ||
python = ">=3.7.2,<3.11" | ||
shapely = [{ python = "<3.10", version = "1.8.0" }, | ||
{ python = "^3.10",version = "^1.8.1"}] | ||
scipy = [{ python = "~3.7", version = "^1.6.0" }, | ||
{ python = "~3.8", version = "^1.8.0" }, | ||
{ python = "^3.9", version = "^1.9.0" }] | ||
numpy = [{ python = "~3.7", version = "^1.19.0" }, | ||
{ python = "~3.8", version = "^1.20.0" }, | ||
{ python = "^3.9", version = "^1.23.0" }] | ||
matplotlib = [{ python = "~3.7", version = "~3.5" }, | ||
{ python = "^3.8", version = "^3.6" }] | ||
pandas = [{ python = "~3.7", version = "^1.3.0"}, {python = "^3.8", version = "^1.5.0"}] | ||
xarray = "0.20.2" | ||
pyroots = "^0.5.0" | ||
importlib-metadata = "<5.0.0" | ||
h5netcdf = "^1.1.0" | ||
h5py = "^3.7.0" | ||
rich = "^12.6.0" | ||
pydantic = "^1.10.2" | ||
pyyaml = "^6.0" | ||
dask = "~2022.02.0" | ||
boto3 = "^1.26.31" | ||
requests = "^2.28.1" | ||
pyjwt = "^2.6.0" | ||
toml = "^0.10.2" | ||
|
||
[tool.poetry.group.dev.dependencies] | ||
click = "^8.1.3" | ||
black = "^22.12.0" | ||
pylint = "^2.15.8" | ||
pytest = "^7.2.0" | ||
pytest-timeout = "^2.1.0" | ||
gdspy = "^1.6.12" | ||
memory-profiler = "^0.61.0" | ||
dill = "^0.3.6" | ||
tox = "^3.0.0" | ||
|
||
[build-system] | ||
requires = [ | ||
"setuptools>=42", | ||
"wheel" | ||
] | ||
build-backend = "setuptools.build_meta" | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" | ||
|
||
|
||
[tool.black] | ||
line-length = 100 | ||
|
||
|
||
[tool.pytest.ini_options] | ||
filterwarnings = 'ignore::DeprecationWarning' | ||
|
||
[tool.poetry.scripts] | ||
tidy3d = "tidy3d.plugins.cli:tidy3d_cli" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import os.path | ||
import shutil | ||
from os.path import expanduser | ||
|
||
from click.testing import CliRunner | ||
from tidy3d.plugins.cli import tidy3d_cli | ||
import toml | ||
|
||
|
||
def test_tidy3d_cli(): | ||
home = expanduser("~") | ||
if os.path.exists(f"{home}/.tidy3d/config"): | ||
shutil.move(f"{home}/.tidy3d/config", f"{home}/.tidy3d/config.bak") | ||
runner = CliRunner() | ||
result = runner.invoke(tidy3d_cli, ['configure'], input="apikey") | ||
assert result.exit_code == 0 | ||
|
||
with open(f"{home}/.tidy3d/config", "r", encoding="utf-8") as f: | ||
content = f.read() | ||
config = toml.loads(content) | ||
assert config.get('apikey', '') == "apikey" | ||
|
||
if os.path.exists(f"{home}/.tidy3d/config.bak"): | ||
shutil.move(f"{home}/.tidy3d/config.bak", f"{home}/.tidy3d/config") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
""" | ||
tidy3d command line tool. | ||
""" | ||
from .app import tidy3d_cli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
""" | ||
Commandline interface for tidy3d. | ||
""" | ||
import os.path | ||
from os.path import expanduser | ||
|
||
import click | ||
import toml | ||
|
||
home = expanduser("~") | ||
if os.path.exists(f"{home}/.tidy3d/config"): | ||
with open(f"{home}/.tidy3d/config", "r", encoding="utf-8") as f: | ||
content = f.read() | ||
config = toml.loads(content) | ||
config_description = f"API Key[{config.get('apikey', '')}]" | ||
|
||
|
||
@click.group() | ||
def tidy3d_cli(): | ||
""" | ||
Tidy3d command line tool. | ||
""" | ||
|
||
|
||
@click.command() | ||
@click.option( | ||
"--apikey", prompt=config_description if "config_description" in globals() else "API Key" | ||
) | ||
def configure(apikey): | ||
""" | ||
Configure Tidy3d credentials,eg: tidy3d configure | ||
:param apikey: | ||
:return: | ||
""" | ||
if not os.path.exists(f"{home}/.tidy3d"): | ||
os.mkdir(f"{home}/.tidy3d") | ||
with open(f"{home}/.tidy3d/config", "w+", encoding="utf-8") as config_file: | ||
toml_config = toml.loads(config_file.read()) | ||
toml_config.update({"apikey": apikey}) | ||
config_file.write(toml.dumps(toml_config)) | ||
click.echo("done.") | ||
|
||
|
||
tidy3d_cli.add_command(configure) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters