ImperialCollegeLondon / SWMManywhere

SWMManywhere is used to derive and simulate a sewer network anywhere in the world
https://imperialcollegelondon.github.io/SWMManywhere/
BSD 3-Clause "New" or "Revised" License
4 stars 1 forks source link

`netcomp` not working properly #290

Closed barneydobson closed 1 month ago

barneydobson commented 1 month ago

Assuming have copied config and updated accordingly. @dalonsoa it'd be amazing if you could take a look please.

python -m venv ./sa_env
./sa_env/Scripts/activate.bat
pip install swmmanywhere
python -m swmmanywhere --config_path=minimum_viable_template.yml 

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\bdobson\Downloads\temp\sa_env\Lib\site-packages\swmmanywhere\__main__.py", line 8, in <module>
    from swmmanywhere import swmmanywhere
  File "C:\Users\bdobson\Downloads\temp\sa_env\Lib\site-packages\swmmanywhere\swmmanywhere.py", line 22, in <module>
    from swmmanywhere.metric_utilities import iterate_metrics, validate_metric_list
  File "C:\Users\bdobson\Downloads\temp\sa_env\Lib\site-packages\swmmanywhere\metric_utilities.py", line 21, in <module>
    import netcomp
ModuleNotFoundError: No module named 'netcomp'
dalonsoa commented 1 month ago

It seems that netcomp was included in the source application but not in the wheel, so when installed from PyPI, it is not there. Let's see what I need to do to make that happen. This will require another release, I'm affraid, and mark the previous one as wrong, so no one installs it.

barneydobson commented 1 month ago

OK great thanks - how do I mark as wrong?

barneydobson commented 1 month ago

closed by #293

cheginit commented 1 month ago

@barneydobson make sure to yank the release. Can be done by the manager of the package on https://pypi.org/ which I think is @dalonsoa?

barneydobson commented 1 month ago

I think @dalonsoa did 👍

barneydobson commented 1 month ago

@dalonsoa new bug with the distribution:

Run if [[ "false" != 'true' ]]; then
/tmp/baipp/dist/swmmanywhere-0.1.2-py3-none-any.whl: W009: Wheel contains multiple toplevel library entries:
  netcomp/
  swmmanywhere/
Error: Process completed with exit code 1.
cheginit commented 1 month ago

You need to move the netcomp folder under swmmanywhere as a subpackage.

dalonsoa commented 1 month ago

I've just seen it, but I don't understand why that is a problem. The wheel works and it is not uncommon to distribute multiple packages together. If we move netcomp to within swmmanywhere, we need to change all of import statements for netcomp.

barneydobson commented 1 month ago

looking at examples - could we move both into src?

dalonsoa commented 1 month ago

That's what I was starting to think, to be honest.

cheginit commented 1 month ago

I second the src-layout (I use it for all my projects). You have to make a couple of changes to pyproject.toml for hatchling, pytest, and coverage.

dalonsoa commented 1 month ago

On it...

barneydobson commented 1 month ago

OK still failing: https://github.com/ImperialCollegeLondon/SWMManywhere/actions/runs/11036163538/job/30654221348

I guess we're not fixing this today - but any ideas from @cheginit or @dalonsoa are welcome!

barneydobson commented 1 month ago

( I will first try the suggestion here )

barneydobson commented 1 month ago

(nope didn't help)