How to Dynamically Generate Requirements.txt file for Python Apps

  Рет қаралды 18,861

DevOps Journey

DevOps Journey

Күн бұрын

Пікірлер: 31
@bennguyen1313
@bennguyen1313 4 ай бұрын
Regarding venv, I understand it comes with python, but I've seen many manually install pyenv separately.. why, what's the difference between 1) pipx 2) venv / virtualenv 3) pyenv (not pyvenv ) with or without the virtualenv plugin (i.e. pyenv-virtualenv) Also, is pipreqs smart enough to analyze my python script and determine that some imports are not actually used, and therefore won't add it to the requirements txt? I'd like to find a way to give it a script and have it report the versions the user will need.. ONLY for the packages that are used somewhere in the code!
@samosertogo
@samosertogo Жыл бұрын
Thanks a lot, I'been struggling a lot trying to use pipreqs directly from a cmd promp but showing no results (I think it's because I'm working directly on a Sharepoint folder). This solution worked perfectly, thank you man!
@joryaock
@joryaock 2 жыл бұрын
Followed the tutorial. Typed in pipreqs to the cmd prompt and get a command not found response. Any suggestions?
@DevOpsJourney
@DevOpsJourney 2 жыл бұрын
Pip install pipreqs should fix this for you
@Pabz2030
@Pabz2030 Жыл бұрын
Use this command in powershell from the directory containing your python code: python -m pipreqs
@thiagolcmelo
@thiagolcmelo 3 жыл бұрын
Maybe it is a wrapper around pip freeze, that is where it pulls the versions from, just thinking, not sure
@rabbitinnh
@rabbitinnh 2 жыл бұрын
I tested - it uses the latest versions.
@haryakumuda6798
@haryakumuda6798 2 жыл бұрын
it give me blank requirements.txt eventhough on cmd, it detect my packages
@kod8616
@kod8616 3 жыл бұрын
Thanks, very good work and high quality videos, keep uploading!
@DevOpsJourney
@DevOpsJourney 3 жыл бұрын
Thanks, will do!
@Amr-Ibrahim-AI
@Amr-Ibrahim-AI Жыл бұрын
Thanks for the simple yet effective video Saved me some good time :)
@chikosan99
@chikosan99 2 жыл бұрын
What is the difference with pip3 freeze > requirements.txt ?
@DevOpsJourney
@DevOpsJourney 2 жыл бұрын
Pip freeze is a good solution but it will include all the packages installed on your system - and not just the ones required for your project. Being good about using virtual environments can mitigate this but not everyone is on top of maintaining venvs
@davidolona7365
@davidolona7365 2 жыл бұрын
it just created an empty requirements.txt any fix?
@DevOpsJourney
@DevOpsJourney 2 жыл бұрын
It sounds like maybe your python file might not be using any modules that aren't already built into python?
@davidolona7365
@davidolona7365 2 жыл бұрын
@@DevOpsJourney I see the reason is because I want to deploy it on heroku and it’s not working idk what to do.
@silentt2143
@silentt2143 3 жыл бұрын
Thanks for the video. I was wondering if you could help me figure out how to automatically name new files with python? I have created a very basic tkinter app that allows users to enter a url into an input, and then once they press upload, that url will be saved as a PDF. The problem is the PDF always has the same name since it is manually placed within the script. How can I get python to change the name after every new submission (e.g. pdf1.pdf, pdf2.pdf, pdf3.pdf, etc)?
@yogeshparab7852
@yogeshparab7852 2 жыл бұрын
option 1: use a random string generator option 2: define a global variable and +1 on every run and use it while saving the file
@mabrouk642
@mabrouk642 3 жыл бұрын
Thank you for another informative post
@54M1WUL
@54M1WUL 3 жыл бұрын
can u write code what devops write plz
@DevOpsJourney
@DevOpsJourney 3 жыл бұрын
Hi Samiwul. Devops write a lot of scripts, but they are not very specific. The scripts that my company wants will be very different from what yours wants. That's why I make these smaller videos showing off these modules. Every Python module video I make is based on something I had to do on the Job as a DevOps Engineer. You might enjoy my playlist: kzbin.info/aero/PLnFWJCugpwfztr1ND_n0b_j-QXV20DHNj In the future, I hope to have a course for Learning Python as a DevOps Engineer. I hope you stick around so you can see it. Thank you for your comment.
@Shubhamhirau
@Shubhamhirau 3 жыл бұрын
Hey Man , where are you ??
@DevOpsJourney
@DevOpsJourney 3 жыл бұрын
Just been busy with a few things! I've got a few videos planned, hope to be pushing out more content over the next few months! Thank you for checking up on me :)
@digitalzoul57
@digitalzoul57 2 жыл бұрын
Thanks, it was very usefull !!
@niflag
@niflag 2 жыл бұрын
Doesn't work; the term 'pipreqs' is not recognized
@DevOpsJourney
@DevOpsJourney 2 жыл бұрын
pip install pipreqs
@Pabz2030
@Pabz2030 Жыл бұрын
Use this command in powershell from the directory containing your python code: python -m pipreqs
@GauravSharma0509
@GauravSharma0509 2 жыл бұрын
Thanks.. it working in macOS 🥳
@PauloHenrique-ih2wo
@PauloHenrique-ih2wo Жыл бұрын
Thanks 🙂
@CostaGeo6683
@CostaGeo6683 3 жыл бұрын
Well……..game changer for me that is 🥃🥃
@alemaonalingua
@alemaonalingua 11 ай бұрын
NIce
Python SSH Client - Paramiko. SSH with Python.
7:21
DevOps Journey
Рет қаралды 78 М.
Python Virtual Environments & The Facts of Life
22:59
Bryan Cafferky
Рет қаралды 1,8 М.
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 23 МЛН
Generating a requirements.txt file | Django tips
14:15
Cloud With Django
Рет қаралды 2,3 М.
Python's creator wishes this feature never existed
7:21
mCoding
Рет қаралды 327 М.
How to Create and Use Virtual Environments in Python With Poetry
14:43
Using pip-tools to manage Python dependencies
3:05
Pybites
Рет қаралды 5 М.
What is a Virtual Environment in Python?
8:53
Sam Westby Tech
Рет қаралды 7 М.
DO NOT FORGET: 'requirements.txt' In Your Python Projects
9:06
CONTEXT MANAGERS In Python Are GENIUS!
4:49
Indently
Рет қаралды 31 М.
Google’s Quantum Chip: Did We Just Tap Into Parallel Universes?
9:34
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 23 МЛН