Skip to content

Commit

Permalink
add poetry support
Browse files Browse the repository at this point in the history
  • Loading branch information
an-li-the-dev committed Jan 19, 2023
1 parent 044e0db commit 7ce3ac7
Show file tree
Hide file tree
Showing 7 changed files with 2,166 additions and 63 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'poetry'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install setuptools wheel twine build
run: poetry install
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
python -m build
python -m twine upload --repository pypi dist/*
poetry config pypi-token.pypi "$PYPI_TOKEN"
poetry build
poetry publish
13 changes: 8 additions & 5 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@ jobs:
platform: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v1
- name: Install poetry
run: pipx install poetry
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox-gh-actions
pip install tox
poetry add -D tox-gh-actions=^2.0.0
poetry install
- name: Test with tox
run: tox
run: poetry run tox

2,042 changes: 2,042 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

66 changes: 61 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,65 @@
[build-system]
requires = [
"setuptools>=42",
"wheel"
[tool.poetry]
name = "tidy3d-beta"
version = "1.8.1"
description = ""
authors = ["Tyler Hughes <tyler@flexcompute.com>"]
readme = "README.md"
packages = [
{ include = "tidy3d" },
{ include = "tidy3d/web" },
{ include = "tidy3d/plugins" },
]
build-backend = "setuptools.build_meta"


[tool.poetry.dependencies]
python = "^3.7.2"
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"
click = "^8.1.3"

[tool.poetry.group.dev.dependencies]
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 = ["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.web.cli:tidy3d_cli"
3 changes: 0 additions & 3 deletions pytest.ini

This file was deleted.

8 changes: 7 additions & 1 deletion tidy3d/web/cli/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ def configure(apikey):
apikey : str
User input api key.
"""
if not os.path.exists(TIDY3D_DIR):
os.mkdir(TIDY3D_DIR)
with open(CONFIG_FILE, "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))

def auth(req):
"""Enrich auth information to request.
Expand Down Expand Up @@ -66,4 +72,4 @@ def auth(req):
click.echo("API key is invalid.")


tidy3d_cli.add_command(configure)
tidy3d_cli.add_command(configure)
78 changes: 37 additions & 41 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,46 +15,42 @@ python =
3.11: python3.11

[testenv]
setenv =
MPLBACKEND=agg
deps =
-rrequirements/dev.txt
commands =
pip install requests
whitelist_externals = poetry
commands =
black --check --diff . --line-length 100
python lint.py
poetry run python lint.py

pytest -rA tests/test_components/test_apodization.py
pytest -rA tests/test_components/test_base.py
pytest -rA tests/test_components/test_boundaries.py
pytest -rA tests/test_components/test_custom.py
pytest -rA tests/test_components/test_geometry.py
pytest -rA tests/test_components/test_grid.py
pytest -rA tests/test_components/test_grid_spec.py
pytest -rA tests/test_components/test_IO.py
pytest -rA tests/test_components/test_medium.py
pytest -rA tests/test_components/test_meshgenerate.py
pytest -rA tests/test_components/test_mode.py
pytest -rA tests/test_components/test_monitor.py
pytest -rA tests/test_components/test_field_projection.py
pytest -rA tests/test_components/test_sidewall.py
pytest -rA tests/test_components/test_simulation.py
pytest -rA tests/test_components/test_source.py
pytest -rA tests/test_components/test_types.py
pytest -rA tests/test_components/test_viz.py
pytest -rA tests/test_data/test_data_arrays.py
pytest -rA tests/test_data/test_monitor_data.py
pytest -rA tests/test_data/test_sim_data.py
pytest -rA tests/test_package/test_config.py
pytest -rA tests/test_package/test_log.py
pytest -rA tests/test_package/test_main.py
pytest -rA tests/test_package/test_make_script.py
pytest -rA tests/test_package/test_material_library.py
pytest -rA tests/test_plugins/test_component_modeler.py
pytest -rA tests/test_plugins/test_mode_solver.py
pytest -rA tests/test_plugins/test_dispersion_fitter.py
pytest -rA tests/test_plugins/test_resonance_finder.py
pytest -rA tests/test_web/test_auth.py
pytest -rA tests/test_web/test_task.py
pytest -rA tests/test_web/test_webapi.py
pytest -rA tests/test_web/test_cli.py
poetry run pytest -rA tests/test_components/test_base.py
poetry run pytest -rA tests/test_components/test_apodization.py
poetry run pytest -rA tests/test_components/test_boundaries.py
poetry run pytest -rA tests/test_components/test_custom.py
poetry run pytest -rA tests/test_components/test_geometry.py
poetry run pytest -rA tests/test_components/test_grid.py
poetry run pytest -rA tests/test_components/test_grid_spec.py
poetry run pytest -rA tests/test_components/test_IO.py
poetry run pytest -rA tests/test_components/test_medium.py
poetry run pytest -rA tests/test_components/test_meshgenerate.py
poetry run pytest -rA tests/test_components/test_mode.py
poetry run pytest -rA tests/test_components/test_monitor.py
poetry run pytest -rA tests/test_components/test_field_projection.py
poetry run pytest -rA tests/test_components/test_sidewall.py
poetry run pytest -rA tests/test_components/test_simulation.py
poetry run pytest -rA tests/test_components/test_source.py
poetry run pytest -rA tests/test_components/test_types.py
poetry run pytest -rA tests/test_components/test_viz.py
poetry run pytest -rA tests/test_data/test_data_arrays.py
poetry run pytest -rA tests/test_data/test_monitor_data.py
poetry run pytest -rA tests/test_data/test_sim_data.py
poetry run pytest -rA tests/test_package/test_config.py
poetry run pytest -rA tests/test_package/test_log.py
poetry run pytest -rA tests/test_package/test_main.py
poetry run pytest -rA tests/test_package/test_make_script.py
poetry run pytest -rA tests/test_package/test_material_library.py
poetry run pytest -rA tests/test_plugins/test_component_modeler.py
poetry run pytest -rA tests/test_plugins/test_mode_solver.py
poetry run pytest -rA tests/test_plugins/test_dispersion_fitter.py
poetry run pytest -rA tests/test_plugins/test_resonance_finder.py
poetry run pytest -rA tests/test_web/test_auth.py
poetry run pytest -rA tests/test_web/test_task.py
poetry run pytest -rA tests/test_web/test_webapi.py
poetry run pytest -rA tests/test_web/test_cli.py

0 comments on commit 7ce3ac7

Please sign in to comment.