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

Replace environment.yml with conda-lock.yml #442

Merged
merged 35 commits into from
Jul 29, 2024
Merged

Replace environment.yml with conda-lock.yml #442

merged 35 commits into from
Jul 29, 2024

Conversation

sverhoeven
Copy link
Member

@sverhoeven sverhoeven commented Jul 23, 2024

TODO

  • valid pyproject.toml for pip install -e .[dev]

Refs #441

To check

  • conda-lock lock on linux
  • conda-lock install on linux
  • pip install -e . should only install ewatercycle, only few additional deps should be installed
  • pip install -e .[dev] should only install ewatercycle, few additional deps should be installed
  • installing without conda should give instructions

TODO
* [ ] valid pyproject.toml for `pip install -e .[dev]`
Currently pip does not understand pyproject.toml file
Skipped flake8 config as this will be replaced by ruff
@sverhoeven sverhoeven changed the base branch from main to hatch July 23, 2024 12:12
Base automatically changed from hatch to main July 23, 2024 13:43
@BSchilperoort
Copy link
Member

I followed the instructions:

  • environment downloaded successfully
  • did pip install . --no-deps in checked out ewatercycle repo
  • ran pytest and all tests passed 👍

However, I thought dev dependencies should not be added to the lock file but it seems like they did

@sverhoeven
Copy link
Member Author

I followed the instructions:

  • environment downloaded successfully
  • did pip install . --no-deps in checked out ewatercycle repo
  • ran pytest and all tests passed 👍

However, I thought dev dependencies should not be added to the lock file but it seems like they did

Switched to conda-lock install --no-dev for production install

@sverhoeven
Copy link
Member Author

Hmm, pip install is installing black and tokenize-rt-5.2.0 . They have been removed in csdms/bmi-python#46 , but no new version has been released yet.

@sverhoeven sverhoeven marked this pull request as ready for review July 24, 2024 10:56
@BSchilperoort
Copy link
Member

Hmm, pip install is installing black and tokenize-rt-5.2.0 . They have been removed in csdms/bmi-python#46 , but no new version has been released yet.

For me pip says it did the following:
Successfully installed black-24.4.2 ewatercycle-2.2.0 gitdir-1.2.7

And with .[dev]:
Installing collected packages: webencodings, wcwidth, snowballstemmer, pure-eval, ptyprocess, fastjsonschema, distlib, commonmark, virtualenv, types-requests, types-pyyaml, types-python-dateutil, traitlets, tokenize-rt, tinycss2, sphinxcontrib-serializinghtml, sphinxcontrib-qthelp, sphinxcontrib-jsmath, sphinxcontrib-htmlhelp, sphinxcontrib-devhelp, sphinxcontrib-applehelp, rpds-py, pyzmq, pytest-runner, pytest, pyproject_hooks, pygments, pycodestyle, prompt-toolkit, pexpect, parso, pandocfilters, ordered-set, nodeenv, mypy, mistune, mdurl, jupyterlab-pygments, isort, imagesize, identify, executing, docutils, decorator, coverage, cfgv, bump2version, bleach, babel, asttokens, astroid, alabaster, stack-data, sphinx, referencing, pre-commit, matplotlib-inline, markdown-it-py, jupyter-core, jedi, deepdiff, build, sphinxcontrib-jquery, sphinx-copybutton, sphinx-autoapi, rich, recommonmark, pytest-cov, jupyter-client, jsonschema-specifications, ipython, sphinx-rtd-theme, jsonschema, nbformat, nbclient, nbconvert, nbsphinx, ewatercycle

Which is normal as it's the dev+docs dependencies.

Perhaps edit the PR text:

pip install -e .[dev] should only install ewatercycle, no additonal deps should be installed

Copy link
Member

@BSchilperoort BSchilperoort left a comment

Choose a reason for hiding this comment

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

Tried out this branch. Encountered some issues.


  1. Tried installing ewatercycle into python (no conda or esmvaltool). Got the following error:
image

image

Importlib changed with 🐍 3.10. Changing line 4 in ewatercycle/shared.py to:

from importlib.metadata import EntryPoint

fixes this issue.


  1. currently import ewatercycle.forcing fails without esmvalcore/tool. This does not have to be this way. Want to fix that in a different PR? Would be nice to open an issue about it.

The import try/excepts can be moved to the methods which rely on esmvaltool, but still allow already generated forcing to be loaded (or e.g. caravanforcing which does not need esmvaltool)


Otherwise the conda-lock file seems to work well. It's also a lot faster, so stability + speed are both very nice to have.

CONTRIBUTING.md Show resolved Hide resolved
get_diagnostic_filename,
run_diagnostic,
)
try:
Copy link
Member

Choose a reason for hiding this comment

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

Moving this to where it's used (i.e. def *Forcing.generate(...)) would allow users to mostly use ewatercycle without esmvaltool.

@sverhoeven
Copy link
Member Author

  1. Using importlib from standard library
  2. Delayed optonal esmvaltool to Esmvaltool optional #447

Copy link

sonarcloud bot commented Jul 29, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
55.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

@sverhoeven sverhoeven merged commit 36ff0b9 into main Jul 29, 2024
3 of 4 checks passed
@sverhoeven
Copy link
Member Author

https://ewatercycle.readthedocs.io/en/stable/system_setup.html#conda-environment) is still using wget https://raw.githubusercontent.com/eWaterCycle/ewatercycle/main/environment.yml which will fail. Can be resolved by making a new release.

@sverhoeven sverhoeven deleted the lock branch July 29, 2024 08:26
@sverhoeven
Copy link
Member Author

Fixes #357

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.

2 participants