How to Create and Use Virtual Environments in Python With Poetry

Поділитися
Вставка
  • Опубліковано 19 чер 2024
  • It can be tricky when different packages in Python don't play nice. The solution to this problem is to create an isolated, virtual environment. In this video, I’ll show you how to set up a virtual environment with poetry, a package manager for Python that simplifies dependency management and project packaging.
    🚀 Next-Level Python Skillshare Class: skl.sh/3ZQkUEN
    ✍🏻 Take a quiz on this topic: www.learntail.com/quiz/kkmnju
    💡 Get my FREE 7-step guide to help you consistently design great software: arjancodes.com/designguide.
    💻 ArjanCodes Blog: www.arjancodes.com/blog
    🎓 Courses:
    The Software Designer Mindset: www.arjancodes.com/mindset
    The Software Designer Mindset Team Packages: www.arjancodes.com/sas
    The Software Architect Mindset: Pre-register now! www.arjancodes.com/architect
    Next Level Python: Become a Python Expert: www.arjancodes.com/next-level...
    The 30-Day Design Challenge: www.arjancodes.com/30ddc
    🛒 GEAR & RECOMMENDED BOOKS: kit.co/arjancodes.
    👍 If you enjoyed this content, give this video a like. If you want to watch more of my upcoming videos, consider subscribing to my channel!
    💬 Discord: discord.arjan.codes
    🐦Twitter: / arjancodes
    🌍LinkedIn: / arjancodes
    🕵Facebook: / arjancodes
    📱Instagram: / arjancodes
    ♪ Tiktok: / arjancodes
    👀 Code reviewers:
    - Yoriz
    - Ryan Laursen
    - James Dooley
    - Dale Hagglund
    🎥 Video edited by Mark Bacskai: / bacskaimark
    💻 Code example by Henrique Branco: / henriqueajnb
    🔖 Chapters:
    0:00 Intro
    1:24 Code example
    2:00 Virtual environments
    3:00 Tools
    4:15 Why poetry?
    5:20 Creating a virtual environment with poetry
    8:33 Activating it
    8:55 Installing dependencies
    9:38 Deactivating it
    10:11 Removing it
    10:27 Packaging and publishing using poetry
    11:58 Things to watch out for
    14:18 Outro
    #arjancodes #softwaredesign #python
    DISCLAIMER - The links in this description might be affiliate links. If you purchase a product or service through one of those links, I may receive a small commission. There is no additional charge to you. Thanks for supporting my channel so I can continue to provide you with free content each week!

КОМЕНТАРІ • 197

  • @ArjanCodes
    @ArjanCodes  8 місяців тому

    💡 Get my FREE 7-step guide to help you consistently design great software: arjancodes.com/designguide.

  • @Victorinoeng
    @Victorinoeng Рік тому +46

    There are some additional super useful functionally worth mentioning:
    1) In the toml file, there are special characters that define/limit how to update dependencies versions (^, ~);
    2) the lock file “locks” the exact versions for dependencies and transient ones. This ensures reproducibility and is a game changes for production ready code. it is possible to test updating packages and only committing the new .lock file if everything works.
    3) poetry has a cli tool to auto bump the package version (major, minor, patch) which makes it even easier when managing a package
    4) for some compatibility cases, it is also possible to export the dependencies into a requirements.txt file (for example, when using serverless framework to deploy an AWS Lambda function using the pip-requirements plugin)

  • @ImARichard
    @ImARichard Рік тому +39

    Poetry is a 10/10 project tool IMO. Im glad I was able to convince my team to move over to it.

    • @codingcrashkurse6429
      @codingcrashkurse6429 Рік тому

      same here, never look back at setuptools 😀

    • @WouterVandenHove1
      @WouterVandenHove1 Рік тому

      Unfortunatelty they are introducing the horrible idea of range-pinning / upper-pinning their abstract dependencies.
      This will create a giant dependency-hell of false positives.

    • @kevon217
      @kevon217 Рік тому

      It’s been a game changer for me.

    • @zscoder
      @zscoder 11 місяців тому

      What was your team using before?

  • @PaulFWatts
    @PaulFWatts Рік тому +30

    I don't think it can be underestimated what a "rabbit hole of pain 🙂" this topic can be for the python programmer who is moving beyond the basics (I know from personal experience lol). Especially compared to `cargo` in Rust. Poetry has simplified my Python development, and this is an excellent video in getting started with it. Thanks for all your great videos!

    • @dr.mikeybee
      @dr.mikeybee 7 місяців тому

      I find that the most critical part of installing packages for some repo or another is getting the python version right. Very often if pip install -r fails, it's because you need an older version of python. So delete your virtual environment and recreate it with an older version. I usually use conda, so it's conda create -n python=3.7 or so.

  •  Рік тому +15

    This has to be one of the best and most concise tutorials I've watched lately. I've been using virtualenvs and venvs with pipfiles for years, but this looks like the next logical step. Thanks!

  • @kerryw6361
    @kerryw6361 10 місяців тому +5

    This is a great video to understand the use of poetry. After this video, I find the official Poetry documentation making a lot of sense. Thank you!!

  • @archibald-yc5le
    @archibald-yc5le Рік тому +3

    I've actually been using conda for this, even for non-Python projects, and it worked well for me so far

  • @randomclimber
    @randomclimber Рік тому

    I'm using pyenv to manage python versions, and then having poetry creating creating a virtual env inside the project. Really glad with this setup.

  • @DevelopXp
    @DevelopXp Рік тому +2

    Finally sounds like theres a decent python project package manager. Can’t wait to use it

  • @caetanog_
    @caetanog_ Рік тому

    At work we started using poetry, it helped us a lot to deploy and also manage de dependencies.

  • @EvanYoung-xo8kd
    @EvanYoung-xo8kd Рік тому

    Thanks for this!! I started playing with Poetry a little while ago and needed this video!

  • @user-wr4yl7tx3w
    @user-wr4yl7tx3w Рік тому

    This was really well explained.

  • @davidl3383
    @davidl3383 Рік тому

    Thank you son much exactly when I tart learning poetry😊 excellent tips to delete old env and reinstall them evently to limite size of project

  • @DarknezRocks
    @DarknezRocks Рік тому +7

    Thanks Arjan, was waiting a long time for this video. Finally Poetry gets explained in a good and clear way!

    • @ArjanCodes
      @ArjanCodes  Рік тому +1

      Thank you, glad you liked it!

  • @cdgarzon1
    @cdgarzon1 Рік тому +2

    Good video! I've been using poetry for some time now, and recently ran into the case where you have a poetry project that uses a python version that needs to be updated, which means you have to manage multiple python version in your system and need to tell poetry to go from one version to another. That would be a really good topic for another video as I see a lot of confusing information online about pyenv and poetry working together

  • @daineminton9687
    @daineminton9687 Рік тому +1

    Love the videos & quality work you put into them. Could you at some point do some examples, such as: wave function collapse, etc ...?

  • @milandean
    @milandean Рік тому

    So glad this video finally came out!!

    • @ArjanCodes
      @ArjanCodes  Рік тому +1

      Haha, yes it took me a while :)

  • @loic1665
    @loic1665 Рік тому

    Poetry is life! Seriously it's a great tool, at word we use it all the time and for my personal projets I would use it without an hesitation too!

  • @FollowPathfinder
    @FollowPathfinder Рік тому +1

    Thank for the video Arjan, I think some medieval emperors would be interested in the practical applications of a language like Python, such as its ability to automate tasks and process large amounts of data. They would appreciate its ability to create visualizations and simulations, which could be useful for military planning or other strategic purposes.

  • @hY-ug8vn
    @hY-ug8vn Рік тому +1

    you're a champ Arjan

  • @neobrandsainclair3407
    @neobrandsainclair3407 Рік тому +1

    Thanks for the video. If I recall correctly, Poetry also allows to have multiple sets of dependencies, for example a dev set where you put all your tests dependancies (like pytest), and a prod set for the app dependencies.

    • @loic1665
      @loic1665 Рік тому +1

      Yes that's right!

  • @yash1152
    @yash1152 11 місяців тому +1

    3:04 venv (built-in)

    • @yash1152
      @yash1152 11 місяців тому

      5:13 lock file: yeah conda also uses that. but i dont understand what does that entail practically.

    • @yash1152
      @yash1152 11 місяців тому

      8:20 idky but in default github codespaces (running ubuntu); via python's builtin venv: the .venv dir was actually only 25 MB despite the packages being large 100-200 MB. and also, on rm -r .venv and reinstalling; it didnt download but used from cache.
      I thought maybe the packages are at a global location there.

    • @yash1152
      @yash1152 4 місяці тому

      coming today back to this quick rununp. the extension for reStructuredText lextudio.restructuredtext on vscodium mentions in #409 that
      _"While many ... , Pipenv shows a good enough architecture and a clean way to integrate. However, venv is widely used and part of Python standard."_
      and looking at pipenv's pypi listing, it seems really good: brings _most_ benefits of conda lineage here:
      * manageable as a separate app (via pipx)
      * lock files
      * separate abstract dependency declarations from the last tested combination
      * dependency graph
      * Automatically install required Pythons, if pyenv or asdf is available.
      * Automatically adds/removes packages to a Pipfile when they are installed/uninstalled
      i had tried micromamba¹ (from conda lineage) to install c++ based dlib² package (which₂ doesn't distribute binary .whl on pypi). but it₁ was hard to configure properly, and a bit opaque on where are its things going. there's even no official way to uninstall it lol.

    • @yash1152
      @yash1152 4 місяці тому

      benefits of poetry over pipenv seems that it can be used to:
      4:53 * specify python version, so no need of pyenv?
      5:04 * publish packages, so no need of setuptools? yeah, the build system table here
      5:57 * dev dependencies are mentioned separately :)
      6:57 * get info about project. it is even shows python implementation used, so, it hints that it's compatible with other implementations 😋?
      things to note:
      13:21 python packages using c-extensions (numpy, etc). yeah see, the dlib thing - but yep, i was already aware that this would be issue in any project manager which is python's native.

  • @jindy94
    @jindy94 Рік тому +16

    Another great video!! Just a few questions:
    1. Could you share your shell setup? The autocomplete is amazing!!
    2. There doesn't seem to have a seamless way to build the dependencies into a docker and make it as lightweight as compared to building the dependencies through requirements.txt.. How would you suggest going around this problem?

    • @wevertonmarx
      @wevertonmarx Рік тому

      You can use poetry export to generate a requirements.txt based on the dependencies in your poetry.lock file

    • @mattiapiccinetti4301
      @mattiapiccinetti4301 Рік тому +2

      About the autocomplete: it seems Fig, and you can do some magic AI tricks

    • @Eisesser01
      @Eisesser01 Рік тому

      @@mattiapiccinetti4301 Sadly, macOS only right now :(

  • @blanketfish
    @blanketfish Рік тому

    I love poetry + pyenv. It allows me to define the dependencies exactly so that anybody that clones my repo can get the exact experience I get.

  • @thebrigandier
    @thebrigandier Рік тому +7

    That .venv tip can be handy for people using VSCode's dev containers feature. If you need to rebuild the dev container you end up trashing its filesystem usually, along with any Poetry virtualenvs that may have been created in the container filesystem. By using .venv within your repo's source directory (probably want to .gitignore it), you can rebuild the dev container without wiping your venv, saving you from doing poetry install repeatedly.

  • @jithinsasikumar9576
    @jithinsasikumar9576 Рік тому

    Thanks a lot for this video. Loved it :)

  • @chineduezeofor2481
    @chineduezeofor2481 5 місяців тому +1

    Thank you for making this awesome video.

    • @ArjanCodes
      @ArjanCodes  5 місяців тому

      Glad you enjoyed the video!

  • @MrSith-yp3yq
    @MrSith-yp3yq 7 місяців тому

    Another fantastic video! Thank you 🙂

    • @ArjanCodes
      @ArjanCodes  7 місяців тому

      Glad you enjoyed it!

  • @alefrodrigopereira9708
    @alefrodrigopereira9708 8 місяців тому

    Very good. Thanks for sharing your knowlage with us.

    • @ArjanCodes
      @ArjanCodes  8 місяців тому

      My pleasure!Thanks for your comment :)

  • @DaveParr
    @DaveParr Рік тому +1

    @arjancodes great video as always. I'm curious about how you have your terminal set up to get context aware autocomplete suggestions? E.g. the drop down like prompts that describe the rest of the commands and flags?

    • @waylune
      @waylune 10 місяців тому

      It's Fig

  • @awuyadaniel8982
    @awuyadaniel8982 5 місяців тому

    Wow.. Made it look so easy
    Thank you very much

    • @ArjanCodes
      @ArjanCodes  5 місяців тому

      Glad the video was helpful!

  • @UNgineering
    @UNgineering Рік тому +5

    2 questions:
    1. which config/plugin/script are you using to provide those neat autocompletions when typing terminal commands?
    2. what is the advantage of poetry over pipenv? they look very similar in functionality (aside from publishing to pypi), and pipenv creates Pipfile, which looks almost identical to pryproject.toml (same with their lockfiles).

    • @wevertonmarx
      @wevertonmarx Рік тому +3

      2. I have used Pipenv before and switched to Poetry because it's much faster

    • @bonquaviusdingle5720
      @bonquaviusdingle5720 Рік тому +3

      Poetry locks dependencies faster, and clearly explains when there is a dependency conflict.

  • @johncrunk8038
    @johncrunk8038 Рік тому +2

    I have been using pipenv for a couple years. I really like poetry so maybe it's time to learn a new tool. It's actually not that different than pipenv, but cool. Thanks.

    • @tommybrecher7742
      @tommybrecher7742 Рік тому

      Yeah I'm fond of pipenv too but it's so slow... 😱

  • @wernerlippert5499
    @wernerlippert5499 Рік тому

    Thank you for this video. Do you know how to install / compile prophet using any of the virtual env tools? (for python 3.11.2)

  • @iliandili
    @iliandili 6 місяців тому

    I moved now from 1.7.1 to August 2023 version 1.6.1 and it worked smoothly

  • @talhaamir9023
    @talhaamir9023 Рік тому

    Great Video, just wanted to know if poetry is capable of managing multiple dependency files like we de have different requirements.txt from dev,stag and prod. If that is supported would love to switch to it.

  • @senzmaki4890
    @senzmaki4890 5 місяців тому

    nice vid, what do you use for the terminal intellisense

  • @SumitSahoo
    @SumitSahoo Рік тому

    Thanks for introducing me to Poetry :)

  • @BillTheGreek7
    @BillTheGreek7 Рік тому +3

    Hello!
    I love your videos!
    Only one thing I would like to point out (in case it happens and you see this comment) is to use a bigger screen? or zoom out a bit?, because it looks really crowded now (watching on PC though)
    Thank you for your content!!

  • @user-sh1bz4ql6t
    @user-sh1bz4ql6t 3 місяці тому

    Thank you for this great intro! Unrelated: how are you getting that autocomplete tooltip in your vscode terminal ?

  • @samoylov1973
    @samoylov1973 Рік тому +2

    Thanks for explaining! But docker looks more preferable to me in such cases. Poetry could be, if it were not as complicated for set up.

  • @OlliWilkman
    @OlliWilkman Рік тому +2

    I used Poetry for a while but switched to PDM lately. It's pretty much the same experience but follows the Python PEP standards a little better (though has to sacrifice the nice version number operators), and I hear the dependency resolver is faster in many cases though that hasn't been an issue for me.

    • @alsonyang230
      @alsonyang230 9 місяців тому

      Hey mate, how's your experience with PDM since then compared to Poetry? I am trying to learn either of the two and saw your comments, hope you could shed some light. I found poetry is more popular (for now) and hence would get more community support. If there is no noticeable difference, I might just pick poetry.

    • @OlliWilkman
      @OlliWilkman 9 місяців тому +2

      @@alsonyang230 I still use PDM and I wouldn't go back to Poetry. I'm also just today considering converting an older Poetry project into PDM. But I don't have any very strong recommendation either way. And I'd say that if you learn one, you'll get the hang of the other one fairly quickly if necessary.

    • @alsonyang230
      @alsonyang230 9 місяців тому

      @@OlliWilkman Thanks mate, appreciate your input

  • @zscoder
    @zscoder 11 місяців тому +1

    How were you able to have a terminal as a tab in this video on vscode?

  • @alansnyder8448
    @alansnyder8448 9 місяців тому +2

    Personally, I've not had much luck with poetry. It isn't deterministic. Sometimes it breaks in bad ways, and this has happened enough in a team environment that I've given up on it completely.
    I'm looking for something other than poetry. Currently just using virtual environments, but I am waiting for the right solution to come along.

  • @abencomo
    @abencomo Місяць тому

    @ArjanCodes, is that Python tab a plug-in console for VSCode?

  • @user-lz3wv6sk5k
    @user-lz3wv6sk5k Рік тому +2

    As always, thanks Arjan for your excellent content! I've not tried Poetry yet but I can't yet see a compelling reason to do so vs using conda/mamba (I usually use the latter). It does look pretty easy to use, but not any easier than conda, just different. What am I missing about Poetry? It does have its enthusiasts here in the comments. How is it's spec easier than a conda env spec?
    Having .venv in the project folder seems ok, but I assume you gitignore it and recreate it as needed so it doesn't clutter things up?
    What I've done using cookiecutter is to setup a project template with simple make machinery that does conda package generation running 'out of the box' so it's easy to deploy the project as a conda package to a local channel (or other). It creates a project conda env with the project with a basic set of packages for dev, incl. sphinx and pytest. It also does sphinx docs and comes with an initial set of strawman doc files. The make also maintains a conda env spec yaml file so I don't bother with requirements.txt and other devs can recreate the env on their platforms when we share the project through a local GitLab (or just a local bare repo). If I need to deploy a wheel or source package the template has all the bits to do that as well (our use cases do not involve deploying to PyPi or other public repos).
    A consideration for us is that we use conda to set envs in which analysts do interactive Python work for operations. In future we might need shell scripts that specify which env to use when invoking particular versions of tools. Some analysts don't even use conda directly, it's invoked in setup scripts to set the correct env or their path is just set to the correct, shared env location when they log in. I guess this is more of the data-sciencey use case that conda is intended for!
    The most painful thing about Python packaging is the ever evolving 'how to do' Python packaging question. What I have in that cookiecutter is a bit of a frankenstein between the setup.py, setup.cfg, the new kid on the block pyproject.toml, and the conda-recipe meta.yml. (I need to watch your recent vid about the PyPi way...)

  • @_jdfx
    @_jdfx 11 місяців тому

    Very cool! it's like Cargo but for Python :)

  • @geozeke
    @geozeke Рік тому

    Just curious. Do poetry and dependabot work well together? I've read conflicting reports. I tried it on a test repo, and it seemed like dependabot recommended radical version changes in both pyproject.toml and poetry.lock, where poetry said "No dependencies to install or update"

  • @armagaan009
    @armagaan009 4 місяці тому

    Thank you for the video. It is better than Poetry's "Introduction" and "Basic Usage" pages. They are confusing.

    • @ArjanCodes
      @ArjanCodes  4 місяці тому

      I'm glad the video was helpful!

  • @benengelen6224
    @benengelen6224 Рік тому

    For a quite big project we are going to build about 50-100 packages, some larger or more complicated then others. Would it be a good practice to create a project and a venv. for each package we build? And is there a good way to host them privately, and have a way to use these packages to build our applications

  • @rbalfanz
    @rbalfanz Рік тому

    I like pip-compile (from pip-tools) for the simplicity and keeping with the de facto requirements.txt file.

  • @adibmosharrof217
    @adibmosharrof217 Рік тому

    what terminal do you use? its really handy to have autocomplete feature in terminal

  • @Ezio2848
    @Ezio2848 Рік тому +1

    Hello, love your videos!
    Maybe there is something I'm missing, but if I'm already working well with conda, is there any reason I should switch over to Poetry?

    • @pythonsamurai
      @pythonsamurai Рік тому

      there is no reason to switch even from pip actually

  • @kluchtube7042
    @kluchtube7042 Рік тому

    hey can you tell how do you use intelli sense like code suggestion in your terminal when you type python commands ?

  • @mounikaav46
    @mounikaav46 3 місяці тому

    Great vedio. how can we debug the poetry app from VSCode ?

  • @import_this
    @import_this Рік тому +1

    Hello Arjan!
    Thanks for your video!
    I would like to know what is the difference between "pip install poetry" and installing with curl (from official docs)? See the difference when working with pyenv?

    • @bartman060890
      @bartman060890 Рік тому +1

      Follow the official documentation for installation. Rationale: it is better isolated from your python installation. There are scenarios where poetry will uninstall itself if it was installed through pip, because it sees poetry installed even though it is not a dependency of your package.
      Poetry in general removes packages that are not a dependency of your package. I combine poetry with pipx. With pipx I install dev tools like black, mypy, pylint, pycln, etc. In that way they are out of sight for poetry, but I can still use them.

    • @import_this
      @import_this Рік тому

      @@bartman060890 Thanks for such a detailed answer! It makes sense.
      What is the advantage of combining pipx and poetry instead of using --group dev?

    • @bartman060890
      @bartman060890 Рік тому +1

      @@import_this that would work too! I prefer this approach as it extends nicely to all my python work, also if I don't use poetry. But by all means experiment and see what works best for you :)

    • @import_this
      @import_this Рік тому +1

      @@bartman060890 I will :)

  • @tommybrecher7742
    @tommybrecher7742 Рік тому

    What are you using on the shell to get those completions? That look really nice

    • @blanketfish
      @blanketfish Рік тому

      If you go to the poetry page, there's actually an installation option to get Shell completion for whatever shell you use

  • @jewpcabra666
    @jewpcabra666 Рік тому

    i wish you had talked more about the lock file - that is what always messes me up with poetry!

  • @brainforest88
    @brainforest88 Рік тому

    I started with Python a year ago and came across pipenv and use it since then. Is there an option like the --dev in poetry to install packages only in dev environment? For example, I install mypy and pytest only in dev but not when I run it in prod.

  • @user-cz2el2eg8v
    @user-cz2el2eg8v 3 місяці тому

    Hello @ArjanCodes, great jvideo about poetry! Thanks! I see that you are using a Python's shell??? What kind of magic is that? Is it an extension of VScode? Thanks man! Have a great day!

  • @davea136
    @davea136 Рік тому

    Arjan is it okay if I link to this video as a reference in a post I am writing about virtual environments (venv, renv, jail-rooted servers, etc.)?
    Thank you for the excellent channel!

    • @ArjanCodes
      @ArjanCodes  Рік тому

      Sure Dave! You can link it as a reference :)

  • @user-cd8ze7eo6e
    @user-cd8ze7eo6e 5 місяців тому

    perfect thanks

    • @ArjanCodes
      @ArjanCodes  5 місяців тому

      Glad the video was helpful!

  • @user-hj4wq7uz4z
    @user-hj4wq7uz4z 11 місяців тому

    nice content

  • @darkjord5823
    @darkjord5823 9 місяців тому +1

    yooo what terminal is that that gives you suggestions like that?

  • @user-wr4yl7tx3w
    @user-wr4yl7tx3w Рік тому

    why do you prefer to have the environment inside your project?
    but if you want to share the same virtualenv across multiple projects, then is it better to keep it at default?
    Given that creating a virtualenv inside of each project ends up taking up more disk space, would it be possible to have multiple projects share the same environment? If so, where do you recommend to put the environment in that case?

  • @DavidFodor1
    @DavidFodor1 Рік тому

    The metaverse joke was fire 😄

  • @RonWaller
    @RonWaller 10 місяців тому

    can Poetry config in project setting be a default when setting up future projects?

  • @NickWindham
    @NickWindham Рік тому +1

    I use Pycharm. A main reason is how it creates a new environment for me for each new project. VS Code needs an easier built in feature like Pycharm.

    • @EngineerNick
      @EngineerNick Рік тому

      pycharm was my favorite until vscode's pylance started giving better code hints and i got attached to some vscode extensions. But there are many features I miss... the doc-string rendering on hover was much neater in pycharm.

  • @pythonsamurai
    @pythonsamurai Рік тому +1

    I saw almost 0 real pros to use some wrapper over pip. What poetry is actually do beside just adding reqs to file for you which pip won't be able to do?

  • @converter
    @converter 8 місяців тому

    May I ask whats the type hinting in your command line? :)

  • @mileta99
    @mileta99 Рік тому

    Hi Arjan, nice video, I've been using venv and pipenv for a long time, and I do like poetry seems like more complete then pipenv. But I'm just curious what is the best practice to use poetry in docker (for PROD environment )? I found a lot of different approaches on stuck-overflow but not sure which is the best. It would be nice if you share your approach and how you use poetry with docker. Thanks in advance :)

    • @alphenit
      @alphenit Рік тому

      Does the docker image itself not provide enough isolation?

    • @mileta99
      @mileta99 Рік тому

      @@alphenit of course, but for local deveopment its easier to use virtual environment.

    • @alphenit
      @alphenit Рік тому

      @@mileta99 Then I must have misunderstood you because you wrote: "But I'm just curious what is the best practice to use poetry in docker"

    • @mileta99
      @mileta99 Рік тому

      @@alphenit yes, well poetry doesnt requirements.txt when I run docker I need to generate this file using poetry, I was wondering if there is a better way use poetry with docker :)

  • @Djzaamir
    @Djzaamir Рік тому

    Hi great tutorial, although can anyone tell me how is the auto complete working in his shell, it looks quite amazing and useful.

  • @IanWootten
    @IanWootten Рік тому

    12:16 You mention if you're using "pipenv" packages won't automatically be added to a requirements.txt file. I'm guessing you meant to say "pip", since with pipenv dependencies are added to the Pipfile and Pipfile.lock.

  • @wevertonmarx
    @wevertonmarx Рік тому +4

    Can you make a video about Poetry's competitor PDM and compare the two?

    • @M3MYS3LF1979
      @M3MYS3LF1979 Рік тому +1

      Ditto the newest kid on the block, Rye. Same dev as Flask

  • @pope-pylinux-vi
    @pope-pylinux-vi Рік тому +2

    Thanks for the video! For me poetry was a love at first sight ❤ and I use it in every personal project ever since (and often at my work too 😉) A question: what autocompletion for poetry commands do you use here?

    • @transatlant1c
      @transatlant1c Рік тому +1

      It has native completion support built in. Run “poetry help completions” and follow the steps.

  • @stoicescucornel4998
    @stoicescucornel4998 Рік тому

    What are the differences between poetry and pipenv? I don't see many based on this video, maybe just publishing packages on pypi.

  • @anefuoche1053
    @anefuoche1053 11 місяців тому

    I am a beginner. how did you arrive in the environment(IDE OR FOLDER) you are using for installing poetry?

  • @EngineerNick
    @EngineerNick Рік тому

    I adopted 'hatch' for package builds because it claims to more closely follow modern PEP standards, but after this video, and reading the comments that mention PDM, I am very confused about the best tool to use :S

  • @AAZinvicto
    @AAZinvicto Рік тому

    what is the benefit of having the virtual environment folder within the project directory?

  • @alessandrosantini8956
    @alessandrosantini8956 Рік тому

    How do you deploy an application built with poetry, e.g. what do I have to do if I want to containerise it?

  • @nbansal
    @nbansal Рік тому

    Thanks for this video. I just have a small question. What do you think about `pyenv virtualenv` VS `poetry`?
    More specifically, here is what I would like and would appreciate your help --
    1. I really like `pyenv`. I use it to install different python versions and **also to install virtual environments**. I don't want poetry to replace it.
    2. However, I would like to install packages using poetry so that it automatically gets added to `.toml` file generated using `poetry init` command.
    However, I faced an issue in the second command. When I did `poetry add numpy`, it says `Failed to unlock the collection!`.
    I am completely new to poetry. Could anyone help me out?

  • @FrocketGaming
    @FrocketGaming Рік тому

    I ran into an issue the moment I installed poetry. I'm pretty new to Python so I don't know what the issue is but no matter if I try in bash, powershell etc all poetry commands are not found. I tried adding it to the $PATH and nothing works. Any help would be appreciated but nothing has worked for me.
    I tried it again on another computer (both use the Microsoft Python) and it worked perfectly but just doesn't work on this other laptop.

  • @Mike-dt1yg
    @Mike-dt1yg Рік тому +1

    Poetry rocks!

  • @pingpangqiu5605
    @pingpangqiu5605 2 місяці тому

    should poetry be installed in an venv or globally?

  • @michaelxia99
    @michaelxia99 11 місяців тому

    Does anyone know what terminal setting he is using to get that green arrow and short clean path?

  • @ErikS-
    @ErikS- Рік тому

    Great video!
    I think some viewers may be confused with the "shell". The difference between "normal commands" and "shell commands" isn't that clear in the video.

  • @pythonsamurai
    @pythonsamurai Рік тому +1

    7:04 You can do it by simply writing... (watching in the notes to find the command) ...

  • @yomajo
    @yomajo Рік тому +1

    Sticking to pipenv, thank you. Still ("Activated") post exit, change in conventional keywords (add vs install, remove vs uninstall). If you don't publish packages, I don't see poetry benefits over pipenv. For docker, pipenv has support for requirements.txt (the old dusty way) and poetry does not support it. Having setup pipenv in docker image, gotta say, it's ugly, so I would imagine poetry is no different in that front.

  • @rangav8638
    @rangav8638 5 місяців тому

    If I have sub modules that have their own packages that need to be installed (thing of plugins). How will we manage installation of these with Poetry?

  • @ReRubis
    @ReRubis Рік тому

    But what do you think about pdm?

  • @alirezahaghi2812
    @alirezahaghi2812 9 місяців тому

    how your terminal suggests all arguments? I've already installed zsh and oh-my-zsh, but it does not suggest options.

  • @buzzdev
    @buzzdev Рік тому

    VSCode was never recognizing my poetry env unless i’ve added it manually into settings.

  • @tpag20
    @tpag20 Рік тому +2

    how about the PDM

  • @_rtdp_
    @_rtdp_ 11 місяців тому

    poetry + poethepoem = easy python development ❤

  • @RahulSharma-lw2ss
    @RahulSharma-lw2ss 7 місяців тому

    Nice

  • @M3MYS3LF1979
    @M3MYS3LF1979 Рік тому

    Can export a requirements.txt file for backward compatibility/docker containers:
    `poetry export -f requirements.txt --output requirements.txt --without-hashes`

  • @bonquaviusdingle5720
    @bonquaviusdingle5720 Рік тому

    poetry lock
    poetry update
    Much simpler than a lot of other managers

  • @djchrisi
    @djchrisi Рік тому

    How do you manage multiple python interpreters with poetry? how do you install them and make sure, they don"t interact with the system installed interpreter?

  • @fmvm
    @fmvm Рік тому

    i use Pycharm as IDE, ¿need to change to VSCODE? Please @ArjanCodes, do a video of IDEs.

  • @djl3009
    @djl3009 Рік тому +1

    Thanks. Poetry seems really useful but I was put off looking at it more closely a few months ago, after seeing a video on the anthonywritescode youtube channel, where he explained the reasons why he would never use Poetry. Besides citing technical reasons, his decision not to use Poetry also included a "broken trust" issue regarding the actions of package owners.