EthanRosenthal / medium-data-bakeoff

A python library bakeoff for medium sized datasets
MIT License
24 stars 7 forks source link

cd to src and issue "poetry shell" to get environment before running cli #9

Open stoneyv opened 2 years ago

stoneyv commented 2 years ago

This is my first time using poetry and typer (like fastapi for cli). I needed to cd to src and issue a "poetry shell" to use the environment created by the poetry install.

stoney@laptop2:~/Desktop/medium-data-bakeoff$ poetry shell
Spawning shell within /home/stoney/.cache/pypoetry/virtualenvs/medium-data-bakeoff-2erTjUlV-py3.9
. /home/stoney/.cache/pypoetry/virtualenvs/medium-data-bakeoff-2erTjUlV-py3.9/bin/activate
stoney@laptop2:~/Desktop/medium-data-bakeoff$ . /home/stoney/.cache/pypoetry/virtualenvs/medium-data-bakeoff-2erTjUlV-py3.9/bin/activate
(medium-data-bakeoff-py3.9) stoney@laptop2:~/Desktop/medium-data-bakeoff$ 
(medium-data-bakeoff-py3.9) stoney@laptop2:~/Desktop/medium-data-bakeoff$ cd src
(medium-data-bakeoff-py3.9) stoney@laptop2:~/Desktop/medium-data-bakeoff/src$ python -m medium_data_bakeoff --help

 Usage: python -m medium_data_bakeoff [OPTIONS] COMMAND [ARGS]...                                                                   

╭─ Options ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --install-completion        [bash|zsh|fish|powershell|pwsh]  Install completion for the specified shell. [default: None]         │
│ --show-completion           [bash|zsh|fish|powershell|pwsh]  Show completion for the specified shell, to copy it or customize    │
│                                                              the installation.                                                   │
│                                                              [default: None]                                                     │
│ --help                                                       Show this message and exit.                                         │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ bakeoff            Run the bakeoff for a single dataset.                                                                         │
│ make-dataset       Make the dataset for the bakeoff.                                                                             │
│ make-partitions    Repartition the dataset into a range of partitions. See medium_data_bakeoff.config.PARTITIONS for the range   │
│                    of partitions.                                                                                                │
│ partition-bakeoff  Run the bakeoff for all partition combinations.                                                               │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
EthanRosenthal commented 2 years ago

Hmm I should add some more poetry-specific explanation. I don't usually use poetry to manage my virtual environments; I only use it for installing dependencies.

Regardless, you shouldn't need to cd into src in order to run the code. Once you've run poetry install, you should be able to call the package from any directory.

I have occasionally had some weird issues with some combination of pyenv + poetry that I don't quite understand where, after installing with poetry, I then have to open a new shell and activate my environment in order to get things to fully work. Let me know if that works for you!