Setup VS Code for Python with Pyenv and Poetry

preview_player
Показать описание
Before diving into Programming, Test Automation, Machine Learning, and other awesome things you can do with Python, you need to setup your machine and IDE properly.

In this video, I go over my preferred Python setup using pyenv as my interpreter manager, poetry as my package manager, and VS Code as my IDE. The rest of my Python videos (from now on) will most likely be using this setup, so it's good to know how to follow along.

Steps
----------
* If on Mac, use $ brew install pyenv
* Install a Python interpreter, like $ pyenv install 3.8.6
* Set it globally with $ pyenv global 3.8.6

* $ pip install poetry

3. Start the Project
* Install Python and Pylance Extensions
* Initialize your Python Project (with $ poetry init) and follow the guide
* $ poetry install
* $ poetry add [PACKAGE] to install any additional packages

* Find the virtual environment path that poetry created (with $ poetry env info)
* Open Command Palette, then Python: Select Interpreter
* If you followed along in the video, we installed pyleniumio which comes with pytest, so now we open the Command Palette again, then Python: Configure Tests
* OPTIONAL - Configure Linter and Formatter, or just use Pylance's built-in functionality
Рекомендации по теме
Комментарии
Автор

Thanks Carlos, this is really helpful specially when you start new project using VS Code for the first time...

shamila
Автор

You just solved a 3 hour debugging session for me! I wish I found your video first. I am subscribing!

JamesWiles
Автор

Great video. I recently made the switch to poetry and this was very helpful. Maybe a good video idea would be for you to go over personal settings/extensions and the thought process on why they're there, idk I enjoy those videos haha. Cheers!

hooregi
Автор

I was looking how to use a debugger inside a Poetry environment. Setting the correct path to interpreter 10:42 helped me.

oleksandrklimenkov
Автор

Watching in 2024 - this was extremely helpful (:

karocify
Автор

This was great! I have used python for a couple years but embarrassingly, was basically running everything off of my global environment. I've dabbled with virtual environments but I'm not really comfortable with how to juggle it all and I wasn't aware how important it is to use them. This Poetry thing seems to be a few steps above virtualenv, what I've used, so I'm hoping to find a video that'll me get comfortable working with virtual environments, learning the conventions, and answer questions like is Poetry the defacto standard now-a-days? Are there trade-offs between Poetry and pyenv, virtualenv, and whatnot? I really like your style of teaching so I hope you have something like that.

deemon
Автор

Would love to see more pytest skeleton video for bigger project, if you get time

vijaybabaria
Автор

You have a great teaching/narration style. Thank you for sharing this video.
Unfortunately pyenv isn't working for me. Python 2.7 is still the default even after pyenv shows 3.9.1 is selected for global.

CandyHam
Автор

Just out of curiosity, what font are you using in VSCode?

shaiavraham
Автор

Thanks! This is awesome! What (if any) do you need to do if you want to stay with PyCharm? Or should I ask, why do you use VSCode and not Pycharm?

pa
Автор

Note: python.pythonPath has been replaced with python.defaultInterpreterPath

NostraDavid
Автор

Great tutorial, is pyenv available on windows platform? Thanks

vijaybabaria
Автор

My mans repping the SAO poster in the background

Skeatsies
Автор

why does "python --version" show 3.8.6 and "python3 --version" shows 3.8.5 at minute 2:39

Investmentpunk
Автор

What a beautiful shell! What color scheme are you using?

hansenmarc
Автор

Hi Carlos, Great Video! Also, I like your command prompt. Is there any way you can share the Script?

funmilolakatibi
Автор

Can you please explain which VSCODE Extensiions you are using?

stevey
Автор

So they didn't post that snippet after the pyenv installation. What does that snippet even do? Should I still try copying it?

getowtofheyah
Автор

What do we do when brew doctor complains about the config conflicts coming from Python installations under .pyenv directory?

orjihvy
Автор

Thanks! Can I ask what theme you use for VScode?

보쿠링