-
Notifications
You must be signed in to change notification settings - Fork 53
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
Core upgrade of pyproject.toml
#1229
Core upgrade of pyproject.toml
#1229
Conversation
Thanks @daquintero. Just FYI, the tests here ( |
Few more comments as porting into the new GitHub account, and won't edit the last one. I will consolidate all these notes to the docs once the standard building flow is sorted, but for now, I am writing them here. Again this is my current state live notes haha. There is a poetry issue with installing extras the standard way. Ie this complicates say the So in summary, to install the project with extras in a particular environment the installation flow is and run tests:
However, I believe I think maybe the Github action for the However on running this:
So this is occuring because scipy is being installed from scatch and is The solution of how this person fixed it does not satisfy me in a production build. Also worth mentioning that the poetry builds are pretty long in the sense of multiple minutes. I'm wondering if this might be a If I upgrade python to version 3.10 then it builds. I suspect that this might not be a satisfiable solution. However, I am still running into:
I need to install the old version to verify it does not have to do with me, taking a bit of time since I'm fighting environment settings from my uni work as need to sort out cpu. The older setup.py passes without any tests issues as expected. I believe the problems might have to do with a versioning issue on xarray. I wonder if the poetry caret specification might explain dependency mismatches from the older version vs poetry. Aha! On the original setup.py version:
On the poetry installed version:
To see the installed requirements you can use:
Just found out the notation of the dependency versions changes in poetry, which means that it's not just a copy paste version management from setup.py to pyproject.toml Turns out this is not a single Now I'm running into some issues with |
Great news! I think it's working now and has equivalent requirements, and tests are passing. So far it's only working till Python 3.10 as I need to understand what's the environmental building problem with Python 3.7 (I wonder if it might be a
(tidy3d) daquintero@DESKTOP-1T2BQKV:~/tidy3d$ poetry env use python
Using virtualenv: /home/daquintero/.cache/pypoetry/virtualenvs/tidy3d-OEiglnmL-py3.10
(tidy3d) daquintero@DESKTOP-1T2BQKV:~/tidy3d$ poetry env info
Virtualenv
Python: 3.10.0
Implementation: CPython
Path: /home/daquintero/.cache/pypoetry/virtualenvs/tidy3d-OEiglnmL-py3.10
Executable: /home/daquintero/.cache/pypoetry/virtualenvs/tidy3d-OEiglnmL-py3.10/bin/python
Valid: True
System
Platform: linux
OS: posix
Python: 3.10.0
Path: /home/daquintero/.anaconda/envs/tidy3d
Executable: /home/daquintero/.anaconda/envs/tidy3d/bin/python3.10
(tidy3d) daquintero@DESKTOP-1T2BQKV:~/tidy3d$ poetry install -E dev
Updating dependencies
Resolving dependencies... (11.9s)
Package operations: 99 installs, 1 update, 0 removals
• Installing six (1.16.0)
• Installing jmespath (1.0.1)
• Installing numpy (1.26.1)
• Installing python-dateutil (2.8.2)
• Installing urllib3 (1.26.18)
• Installing asttokens (2.4.1)
• Installing botocore (1.26.10)
• Installing certifi (2023.7.22)
• Installing charset-normalizer (3.3.2)
• Installing distlib (0.3.7)
• Installing exceptiongroup (1.1.3)
• Installing executing (2.0.1)
• Installing filelock (3.13.1)
• Installing idna (3.4)
• Installing iniconfig (2.0.0)
• Installing locket (1.0.0)
• Installing ml-dtypes (0.3.1)
• Installing packaging (23.2)
• Installing parso (0.8.3)
• Installing platformdirs (3.11.0)
• Installing pluggy (1.3.0)
• Installing ptyprocess (0.7.0)
• Installing pure-eval (0.2.2)
• Installing pytz (2023.3.post1)
• Installing scipy (1.11.3)
• Updating setuptools (67.8.0 -> 68.2.2)
• Installing tomli (2.0.1)
• Installing toolz (0.12.0)
• Installing traitlets (5.13.0)
• Installing tzdata (2023.3)
• Installing typing-extensions (4.8.0)
• Installing wcwidth (0.2.9)
• Installing zipp (3.17.0)
• Installing annotated-types (0.6.0)
• Installing cachetools (5.3.2)
• Installing cfgv (3.4.0)
• Installing chardet (5.2.0): Installing...
• Installing click (8.0.3)
• Installing cloudpickle (3.0.0)
• Installing colorama (0.4.6)
• Installing commonmark (0.9.1)
• Installing click (8.0.3)
• Installing cloudpickle (3.0.0)
• Installing colorama (0.4.6)
• Installing commonmark (0.9.1)
• Installing chardet (5.2.0)
• Installing click (8.0.3)
• Installing cloudpickle (3.0.0)
• Installing colorama (0.4.6)
• Installing commonmark (0.9.1)
• Installing contourpy (1.1.1): Installing...
• Installing cycler (0.12.1)
• Installing decorator (5.1.1)
• Installing cycler (0.12.1)
• Installing decorator (5.1.1)
• Installing contourpy (1.1.1)
• Installing cycler (0.12.1)
• Installing decorator (5.1.1)
• Installing fonttools (4.43.1): Pending...
• Installing fonttools (4.43.1): Installing...
• Installing fonttools (4.43.1)
• Installing fsspec (2023.10.0)
• Installing h5py (3.10.0)
• Installing identify (2.5.31)
• Installing importlib-metadata (6.8.0)
• Installing jaxlib (0.4.14)
• Installing jedi (0.19.1)
• Installing kiwisolver (1.4.5)
• Installing matplotlib-inline (0.1.6)
• Installing mypy-extensions (1.0.0)
• Installing nodeenv (1.8.0)
• Installing opt-einsum (3.3.0)
• Installing partd (1.4.1)
• Installing pathspec (0.11.2)
• Installing pandas (2.1.2)
• Installing pexpect (4.8.0)
• Installing pillow (10.1.0)
• Installing prompt-toolkit (3.0.39)
• Installing psutil (5.9.6)
• Installing pydantic-core (2.10.1)
• Installing pygments (2.16.1)
• Installing pyparsing (3.1.1)
• Installing pyproject-api (1.6.1)
• Installing pytest (7.4.3)
• Installing pyyaml (6.0.1)
• Installing requests (2.31.0)
• Installing s3transfer (0.5.2)
• Installing stack-data (0.6.3)
• Installing types-pyyaml (6.0.12.12)
• Installing virtualenv (20.24.6)
• Installing black (22.3.0)
• Installing boto3 (1.23.1)
• Installing dask (2023.10.1)
• Installing dill (0.3.7)
• Installing gdspy (1.6.13)
• Installing gdstk (0.9.46)
• Installing h5netcdf (1.0.2)
• Installing ipython (8.17.2)
• Installing jax (0.4.14)
• Installing matplotlib (3.8.1)
• Installing memory-profiler (0.61.0)
• Installing networkx (3.0)
• Installing pre-commit (3.5.0)
• Installing pydantic (2.4.2)
• Installing pyjwt (2.8.0)
• Installing pyroots (0.5.0)
• Installing pytest-timeout (2.2.0)
• Installing responses (0.23.3)
• Installing rich (12.5.1)
• Installing rtree (1.0.1)
• Installing ruff (0.1.3)
• Installing shapely (2.0.2)
• Installing toml (0.10.2)
• Installing tox (4.11.3)
• Installing trimesh (3.20.0)
• Installing xarray (2023.10.1)
Writing lock file
Installing the current project: tidy3d (2.4.3)
(tidy3d) daquintero@DESKTOP-1T2BQKV:~/tidy3d$ ls
CHANGELOG.md MANIFEST.in img poetry.lock requirements simulation_data.hdf5 tidy3d
COPYRIGHT README.md make_script.py pyproject.toml requirements.txt test_local.sh tox.ini
LICENSE __pycache__ mode_solver.hdf5 pytest.ini schema.py tests
(tidy3d) daquintero@DESKTOP-1T2BQKV:~/tidy3d$ poetry run pytest
================================================= test session starts ==================================================platform linux -- Python 3.10.0, pytest-7.4.3, pluggy-1.3.0
rootdir: /home/daquintero/tidy3d
configfile: pytest.ini
plugins: timeout-2.2.0
collected 842 items
tests/test_components/test_IO.py ............................................................. [ 7%]
tests/test_components/test_apodization.py ..... [ 7%]
tests/test_components/test_base.py ...... [ 8%]
tests/test_components/test_boundaries.py .............. [ 10%]
tests/test_components/test_custom.py .................................. [ 14%]
tests/test_components/test_field_projection.py ... [ 14%]
tests/test_components/test_geometry.py ......................................................................... [ 23%]
................................. [ 27%]
tests/test_components/test_grid.py .................. [ 29%]
tests/test_components/test_grid_spec.py ...... [ 30%]
tests/test_components/test_medium.py ............................ [ 33%]
tests/test_components/test_meshgenerate.py ................... [ 35%]
tests/test_components/test_mode.py .... [ 36%]
tests/test_components/test_monitor.py ............................ [ 39%]
tests/test_components/test_parameter_perturbation.py ... [ 39%]
tests/test_components/test_sidewall.py ......................................................................... [ 48%]
...................................................................................... [ 58%]
tests/test_components/test_simulation.py ....................................................................... [ 67%]
....... [ 67%]
tests/test_components/test_source.py ......... [ 69%]
tests/test_components/test_types.py .... [ 69%]
tests/test_components/test_viz.py ... [ 69%]
tests/test_data/test_data_arrays.py ............. [ 71%]
tests/test_data/test_monitor_data.py ...................... [ 73%]
tests/test_data/test_sim_data.py ........................................................ [ 80%]
tests/test_package/test_config.py .. [ 80%]
tests/test_package/test_convert.py .. [ 81%]
tests/test_package/test_log.py ......... [ 82%]
tests/test_package/test_main.py .. [ 82%]
tests/test_package/test_make_script.py . [ 82%]
tests/test_package/test_material_library.py .... [ 83%]
tests/test_package/test_parametric_variants.py ................ [ 84%]
tests/test_plugins/test_adjoint.py ..................................... [ 89%]
tests/test_plugins/test_component_modeler.py ............ [ 90%]
tests/test_plugins/test_dispersion_fitter.py ......... [ 91%]
tests/test_plugins/test_mode_solver.py .............. [ 93%]
tests/test_plugins/test_polyslab.py .... [ 93%]
tests/test_plugins/test_resonance_finder.py .......... [ 95%]
tests/test_plugins/test_waveguide.py .... [ 95%]
tests/test_web/test_cli.py . [ 95%]
tests/test_web/test_material_fitter.py . [ 95%]
tests/test_web/test_task.py . [ 95%]
tests/test_web/test_tidy3d_folder.py ... [ 96%]
tests/test_web/test_tidy3d_material_library.py . [ 96%]
tests/test_web/test_tidy3d_task.py ......... [ 97%]
tests/test_web/test_webapi.py ..................... [100%]
=================================================== 842 passed in 466.68s (0:07:46) ===================================================
(tidy3d) daquintero@DESKTOP-1T2BQKV:~/tidy3d$ I've been trying to sort out compatibility with Python 3.7, Ok one thing I've noticed is that if you don't delete the With python3.7, python3.8 and python 3.9:
I'm inclined we should just increase the python requirements of the package if testing is not possible in older versions. Let's chat about this. For now I'm going to fix things to 3.10 for jax. It would be beneficial to be able to run this in the Github action, I think I need to ask for access. I think we should have a Ok latest commit 5a12062..d57902d should be ready to merge into some branch
|
pyproject.toml
Outdated
@@ -44,6 +44,7 @@ pre-commit = "*" | |||
black = "22.3.0" | |||
ruff = "*" | |||
tox = "*" | |||
pylint = "*" |
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.
we stopped using pylint
by the way, since it stopped working properly with pydantic
2.*. Something maybe you could also look at if you have time.
Another comment, we will stop supporting python 3.7 in tidy3d 2.5.* |
I have a Mac, can you tell me what commands I should run and I can try it out? Thanks |
No rush, are we supporting >=3.10? Or still have to support ~3.8, 3.9? poetry is struggling to resolve the jax requirements for those python versions but I can get to the bottom of it if we're supporting those versions. So I've just re-verified that tests pass with the documentation requirements now included for >=3.10. What I do to test is:
I get on ubuntu:
This is for 94aa817 |
I have upgraded the github Discovered some issues with the poetry install pre 3.8 so maybe we have no choice but not to support them. There are some more instructions to follow. Ok, we're not supporting below 3.8. |
…e action setup instructions
…e action setup instructions yaml link
… not working otherwise
… issue activating venv
… environment properly configured
Well I reckon this is pretty nice news that all tests are passing. I've made a What do you think about this plan in terms of priority/execution @tylerflex :
Pending to decide:
|
Thanks @daquintero I will hopefully take a look at this and your other PRs in more detail tomorrow. But I think we still want to support use of python 3.8 on the front end at least. (if installed by, say |
Do you still need me to test on Mac or is that settled (since it seems to work in the automated tests?) |
Sounds good, I'll try to sort out the support for >3.8 now. I think no need to test as the tests passing guarantees it should work on Mac. |
I think this plan sounds good. just to clarify one thing: for step 3, will we merge the
Probably smaller chunks.
Would be nice to support >= 3.8. best to check with backend folks to see what python versions they will need to have supported. I think we just need to make sure of two things.
Fine by me, I think. |
Ok so I've done the changes for |
I think turns out I accidentally fixed the support for python>=3.8 when I did the package installation changes. I believe this might be ready to merge into our temporary branch I'll merge now into our |
Just find this PR that discusses poetry env. I have two general questions about poetry env that always puzzles me. Maybe @daquintero you have explained it somewhere already.
|
Hi Weiliang, Thanks for the questions.
There's a few interesting things to mention. So as of our current implementation The other thing is that you have full control over the
I've only used poetry within the project directory, and know you can use standard pip or mamba outside it, but I haven't yet tested with poetry. If you specifically want to use poetry outside I can probably find the set of commands to do that, but I think it'll just have to do with managing the
Yep all the |
Hi Dario, thank you for the detailed answer! As for the 2nd question, I guess in one case, one has to use poetry install but not pip install: install dependence based on |
I am thinking about this currently and will get back to you when I've got a clearer idea soon. So the My hunch on your query is that it has do to with configuring the poetry environment in a particular installation configuration for local path packages, which I think should be possible, but will look in detail to make sure it's equivalent to what you aim to do. |
More details re #1068 and #1148
It's importing, but I haven't been able to run proper tests as I think maybe would be best when I get the API key setup.
Ready to be integrated with docs packaging I think, but I think this needed to be upgraded before for the corresponding docs build scripts to be included.
Worthwhile documentation:
Poetry extras installation configuration
Managing envrionments with poetry
Reproducing the envrionment configuration:
Poetry manages the virtual envrionment and reproducible builds as described in its documentation:
For example, if using an existing mamba environment then you can make poetry work within that envrrionment by:
You can find out information about the poetry envrionment by:
It is possible to make it use the system python by:
You can see how it has changed the environment configuration:
One thing that I am trying to sort out is having clarity how to use the new
pip
extra configuration in terms of equivalence and also a properpoetry
configuration.The way to install development extras is through the following commands. There are more details here