hubverse-org / hubverse-transform

Data transform functions for hubverse model-output files
MIT License
0 stars 0 forks source link

Remove PDM #13

Closed bsweger closed 1 month ago

bsweger commented 1 month ago

After some testing, the team agreed that the PDM + Conda project setup was not serving us.

This PR proposes an alternate project setup that uses Python's venv for virtual environment management and uv to resolve dependencies.

Not critical, but a few background notes about the thinking behind this suggestion: https://reichlab.atlassian.net/wiki/spaces/~7120203df9acbaa41944839969b0fa9d27fea5/pages/1835009/Python+setup+notes+on+new+laptop

lshandross commented 1 month ago

I was able to get most of the dev setup working by changing some of the commands and running the following in an administrator-elevated powershell window after cloning the repository and navigating to the local copy:

Set-ExecutionPolicyUnrestricted -Scope Process
.venv/Scripts/activate.ps1
py -m pip install -e .
py -m pip install -r requirements/requirements-dev.txt
py -m pytest

Based on some basic searches that led me to figuring out the changes to the commands above, it seems like the issue that I've been having here and with pdm previously have to do with executables other than python not being given permission to run for the user when in a virtual environment. For example, I cannot run pip within a virtual environment on its own without the py -m prefix but have no problem running it outside of the virtual environment.

After running the above commands, I ran into a number of errors with the tests whose output is shown in the attached file test_log.txt

bsweger commented 1 month ago

Thanks, @lshandross--great feedback.

It looks like a lot of the errors in the test suite are related to Windows path handling, which is worth being more careful about: https://github.com/Infectious-Disease-Modeling-Hubs/hubverse-transform/issues/15

As for running commands in a virtual environment, would love to set aside some time at your convenience to see what's going on. If using the python -m prefix is sufficient for running commands in an environment, that seems fine, and I can update the README.

If there's something more, would love better understand, since using a virtual environment for Python development is table stakes and something our lab laptops should be able to accommodate.

elray1 commented 1 month ago

I followed the instructions with success on my mac:

(.venv) elray@SPH-C02FV0TPMD6 hubverse-transform % pytest
=================================================== test session starts ===================================================
platform darwin -- Python 3.11.9, pytest-8.2.1, pluggy-1.5.0
rootdir: /Users/elray/research/epi/tools/hub-infrastructure/hubverse-transform
configfile: pyproject.toml
plugins: mock-3.14.0
collected 30 items                                                                                                        

test/integration/test_model_output_integration.py ..                                                                [  6%]
test/unit/test_model_output.py ............................                                                         [100%]

=================================================== 30 passed in 11.76s ===================================================