#πŸ”’ pip vs poetry vs pdm vs any other package manager (for flask)

31 messages Β· Page 1 of 1 (latest)

bleak epoch
#

Which python package manager is good for flask + angular related projects ? Mostly to handle dependencies. I have an Existing repo where everything is handled using pip and requirements.txt file manually

proper lightBOT
#

@bleak epoch

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

shrewd drift
#

pip and poetry/pdm are very different things,
poetry and pdm are dependencies manager that both use pip for installing stuff (poetry is also an environment manager)
you basically dont really have neither a dependencies manager nor an environment manager if you just use pip
so what i'd recommend is either use poetry or pdm/pnpm with virtualenv/pyenv

#

(nvm from what i see pdm also includes pyenv so its very similar to poetry)

bleak epoch
#

Yea, currently I m doing it manually using pip.

Which is more compatible for Flask + Angular ?

So I need to just manage the dependencies, I don't want to migrate everything

shrewd drift
#

there's no such thing as "more compatible" or not,
your flask project will work just fine with whichever one you use

#

having a dependencies manager over pip allows you to have a configuration of the dependencies needed by your project which you can use on another system or when deploying it

#

and poetry/pdm also allow you to have an isolated virtual environment so that your system python don't get polluted with dependencies that are unique to this project

#

basically, you have your main system python, and little forks of it which are isolated for each project on your system so they don't fight each other

bleak epoch
#

I already have isolated virtual environment, created using docker.

#

My main goal is to just maintain the dependencies, without making any other changes

shrewd drift
#

well if your project is in a docker container, it's fine to simply use pip, but i'd advice you to pip freeze in a requirements.txt file so that you can pip install -r requirements.txt in your Dockerfile

#

i also use poetry when working with docker but that's simply out of habit

bleak epoch
#

Yea, right now that's how I am doing it. But while researching I heard that it's better to use package manager

shrewd drift
shrewd drift
#

the main advantage of using them is having an isolated and reproducible environment

#

but docker already covers both

#

if someday you'd like to instanciate your project out of docker, having a dependency manager would be good though

bleak epoch
#

Ohhh, if my understanding is correct, ideally in my case I don't need dependency manager?

shrewd drift
#

while you do everything in docker, no you don't

bleak epoch
#

Thanks mate

waxen finch
#

!pip pip-tools or uv should be used if you go with just pip. It can ensure your pinned dependencies are up to date.

proper lightBOT
#

pip-tools keeps your pinned dependencies fresh.

Released on <t:1709727203:D>.

waxen finch
#

pdm can also create a requirements.txt automatically via ```toml
[tool.pdm.scripts]
post_install = "{pdm} export --self --prod --without-hashes -o requirements.txt"

shrewd drift
#

poetry too

poetry export --without-hashes -o requirements.txt
waxen finch
#

But poetry doesn't have a feature to run it automatically afaik

shrewd drift
#

(in docker he can simply add the export command after installing though)

proper lightBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.