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

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

Open
stoneyv opened this issue Nov 15, 2022 · 1 comment

Comments

@stoneyv
Copy link

stoneyv commented Nov 15, 2022

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.                                                               │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯


@stoneyv stoneyv changed the title Do you run cli from src? error no typer cd to src and issue "poetry shell" to get environment before running cli Nov 15, 2022
@EthanRosenthal
Copy link
Owner

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!

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

No branches or pull requests

2 participants