Professional Project & Dependency Management in Python

NeuralNine · Beginner ·💻 AI-Assisted Coding ·3y ago

Key Takeaways

The video demonstrates the use of Poetry, a Python library for project and dependency management, to manage dependencies and create professional projects.

Full Transcript

what's going on guys welcome back in today's video we're going to learn how to professionally manage python projects and dependencies using poetry so let us get right into it [Music] alright so poetry is an all-in-one tool for managing python projects and dependencies and in this video today I want to show you briefly how to work with it and how we don't have to use multiple tools to do multiple things like managing dependencies building a project publishing a project working with virtual environments we can use poetry to do all of this with one tool and we're going to start by installing it and for this we're going to open up the command line of our choice in my case CMD and we're going to type pip install poetry and once this is installed we're going to navigate to the directory that we want to be working in so in my case this is going to be the current directory and here we're going to now create a new project using poetry and this is done by typing poetry new and then a project name for example neural 9 project and this is going to create the structure that we need for a package basically and here we have the neural 9 project directory inside of the neural 9 project directory we have another package called neuronline project with an init file in it and we also have a test directory here with another init file for the tests obviously and we also have the configuration as a Tomo file here so we have some data like name version description authors but also dependencies and also the build system that is used and now we can do a lot of different things with poetry so for example we can add dependencies easily but before we do that we can also specify that we want to use a virtual environment because if I go now into the command line I am in this project here I can now go ahead and type for example pip freeze to see what packages are installed and you can see that it's going to print all the packages that I have in my basic python installation if I don't want to have that I can also specify a virtual environment or I can create a virtual environment by specifying a python version and for that I can first type on Windows where python on Linux you type I think which and then python3 and you're going to see the path to the different python installations and the one that I want to use for this virtual environment is this python 3.9 version so I'm going to copy the path here and I'm going to say poetry and for environment use and then I'm going to pass the path and if I uh press enter now it's going to create a virtual environment and you can also see where it is created so it's going to give me that path I can then copy that and I can navigate to it or to be precise I can navigate to the scripts directory in it and call the activate executable or batch file I'm not sure and then you can see I'm working now with this virtual environment and in here I can say pip freeze and you will be able to see that there are no dependencies here and I can also type warp hip and you can see that it's using this virtual environment pip so this is how you activate virtual environment how you create one and how you use one and now what we can do is we can add dependencies easily by saying poetry add and then just some modules so for example I might want to use pandas and if I type poetry at pandas it's going to install the dependencies here it's going to install all the things that are needed for pandas like numpy also for example and once the installation is done we're going to see a couple of things first of all we're going to see that when I type pip freeze we can now see all these um dependencies here but we can also see that we have in the Tomo file here the dependency pandas and we can also see that we have a log file that is important for the installations here we can see that all these packages are tracked here as well um so we have numpy for example here we have pandas here in the log file so this is done automatically for us now what's also nice is we can also specify certain dependencies only for development so I can say for example poetry add and then I can say that I want to use my Pi for uh the typing but I don't want to use it or I don't want to force the user of the package to install it if they don't want to so I can say here Dash capital d to say that this is a development dependency and I can say my pi uh install my Pi indents going to add the dependency here but it's going to only add it for uh development purposes so we're going to see that in the Tomo file that we have now here the development dependencies my pi and we have pandas which is an overall dependency so this is how you do that and uh what you can also do here is if you want to publish your package let's say you have some code in here you have some uh some stuff that you have implemented you want to publish this package on uh Pi Pi or I think it's Pi Pi what is what how is this pronounced I'm not sure uh basically on the on the platform where you get your pip packages from so that people can say pip install neural 9 project what you can do here is you can build the wheel file by saying poetry builds uh we're actually just poetry built and this is going to then build the whole project as a wheel file and you can see that we get this directory here dist and you can see that we get this wheel file and we also get uh the compressed version here as a gz file gzip file um this is also what you can do here and then you can either publish it manually or you can do it directly with poetry I'm not going to go through the exact process here I have a video on how to publish packages with Pip I might make one with poetry as well but basically you have to set up the authentication once you have this you can say poetry publish to publish the package in my case now it's going to say that I'm not authenticated so it's not going to be able to do that but you could just use poetry publish once you have the configuration to publish the package on the PIP platform and then you can also uh show what packages you have once you have a couple of things installed you might want to have an overview what packages are installed why are they installed what packages are depending on each other by saying poetry show dash dash tree and then you're going to see what you have here installed so you can see my Pi with all these dependencies here pandas depending on numpy and stuff like that and then you have this python date util which is depending on six and so on um and that's basically it now there are some more advanced uh features here probably as well if you look into documentation but this is already quite a powerful tool and I discovered it actually because I worked with a package that I downloaded from GitHub and I saw in a make file we have these poetry commands where we just build and add and run and stuff like that it's very very um comfortable or convenient to have a tool which with which you can manage dependencies and what you can use to just build and publish with basic commands like build and publish so that's it for today's video I hope you enjoyed it and hope you learned something if so let me know by hitting the like button and leaving a comment in the comment section down below and of course don't forget to subscribe to this Channel and hit the notification Bell to not miss a single future video for free other than that thank you much for watching see you next video and bye [Music]

Original Description

Today we learn about poetry, which is an all-in-one project and dependency management library for Python. ◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾ 📚 Programming Books & Merch 📚 🐍 The Python Bible Book: https://www.neuralnine.com/books/ 💻 The Algorithm Bible Book: https://www.neuralnine.com/books/ 👕 Programming Merch: https://www.neuralnine.com/shop 🌐 Social Media & Contact 🌐 📱 Website: https://www.neuralnine.com/ 📷 Instagram: https://www.instagram.com/neuralnine 🐦 Twitter: https://twitter.com/neuralnine 🤵 LinkedIn: https://www.linkedin.com/company/neuralnine/ 📁 GitHub: https://github.com/NeuralNine 🎙 Discord: https://discord.gg/JU4xr8U3dm 🎵 Outro Music From: https://www.bensound.com/
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from NeuralNine · NeuralNine · 0 of 60

← Previous Next →
1 Visualizing Stock Data With Candlestick Charts in Python
Visualizing Stock Data With Candlestick Charts in Python
NeuralNine
2 Python Beginner Tutorial #1 - Installation and First Program
Python Beginner Tutorial #1 - Installation and First Program
NeuralNine
3 Python Beginner Tutorial #2 - Variables and Data Types
Python Beginner Tutorial #2 - Variables and Data Types
NeuralNine
4 Python Beginner Tutorial #3 - Operators and User Input
Python Beginner Tutorial #3 - Operators and User Input
NeuralNine
5 Python Beginner Tutorial #4 - If Statements and Conditions
Python Beginner Tutorial #4 - If Statements and Conditions
NeuralNine
6 Python Beginner Tutorial #5 - Loops
Python Beginner Tutorial #5 - Loops
NeuralNine
7 Python Beginner Tutorial #6 - Sequences and Collections
Python Beginner Tutorial #6 - Sequences and Collections
NeuralNine
8 Python Beginner Tutorial #7 - Functions
Python Beginner Tutorial #7 - Functions
NeuralNine
9 Python Beginner Tutorial #8 - Exception Handling
Python Beginner Tutorial #8 - Exception Handling
NeuralNine
10 Python Beginner Tutorial #9 - File Operations
Python Beginner Tutorial #9 - File Operations
NeuralNine
11 Python Beginner Tutorial #10 - String Functions
Python Beginner Tutorial #10 - String Functions
NeuralNine
12 Python Intermediate Tutorial #1 - Classes and Objects
Python Intermediate Tutorial #1 - Classes and Objects
NeuralNine
13 Python Intermediate Tutorial #2 - Inheritance
Python Intermediate Tutorial #2 - Inheritance
NeuralNine
14 Python Intermediate Tutorial #3 - Multithreading
Python Intermediate Tutorial #3 - Multithreading
NeuralNine
15 Python Intermediate Tutorial #4 - Synchronizing Threads
Python Intermediate Tutorial #4 - Synchronizing Threads
NeuralNine
16 Python Intermediate Tutorial #5 - Events and Daemon Threads
Python Intermediate Tutorial #5 - Events and Daemon Threads
NeuralNine
17 Python Intermediate Tutorial #6 - Queues
Python Intermediate Tutorial #6 - Queues
NeuralNine
18 Python Intermediate Tutorial #7 - Sockets and Network Programming
Python Intermediate Tutorial #7 - Sockets and Network Programming
NeuralNine
19 Python Intermediate Tutorial #8 - Database Programming
Python Intermediate Tutorial #8 - Database Programming
NeuralNine
20 Python Intermediate Tutorial #9 - Recursion
Python Intermediate Tutorial #9 - Recursion
NeuralNine
21 Python Intermediate Tutorial #10 - XML Processing
Python Intermediate Tutorial #10 - XML Processing
NeuralNine
22 Python Intermediate Tutorial #11 - Logging
Python Intermediate Tutorial #11 - Logging
NeuralNine
23 Python Data Science Tutorial #1 - Anaconda and PyCharm Setup
Python Data Science Tutorial #1 - Anaconda and PyCharm Setup
NeuralNine
24 Python Data Science Tutorial #2 - NumPy Arrays
Python Data Science Tutorial #2 - NumPy Arrays
NeuralNine
25 Python Data Science Tutorial #3 - Numpy Functions
Python Data Science Tutorial #3 - Numpy Functions
NeuralNine
26 Python Data Science Tutorial #4 - Plotting Functions With Matplotlib
Python Data Science Tutorial #4 - Plotting Functions With Matplotlib
NeuralNine
27 Python Data Science Tutorial #5 - Subplots and Multiple Windows
Python Data Science Tutorial #5 - Subplots and Multiple Windows
NeuralNine
28 Python Data Science Tutorial #6 - Matplotlib Styling
Python Data Science Tutorial #6 - Matplotlib Styling
NeuralNine
29 Python Data Science Tutorial #7 - Bar Charts with Matplotlib
Python Data Science Tutorial #7 - Bar Charts with Matplotlib
NeuralNine
30 Python Data Science Tutorial #8 - Pie Charts with Matplotlib
Python Data Science Tutorial #8 - Pie Charts with Matplotlib
NeuralNine
31 Python Data Science Tutorial #9 - Plotting Histograms with Matplotlib
Python Data Science Tutorial #9 - Plotting Histograms with Matplotlib
NeuralNine
32 Python Data Science Tutorial #10 - Scatter Plots with Matplotlib
Python Data Science Tutorial #10 - Scatter Plots with Matplotlib
NeuralNine
33 Python Data Science Tutorial #11 - 3D Plotting with Matplotlib
Python Data Science Tutorial #11 - 3D Plotting with Matplotlib
NeuralNine
34 Python Data Science Tutorial #12 - Pandas Series
Python Data Science Tutorial #12 - Pandas Series
NeuralNine
35 Python Data Science Tutorial #13 - Pandas Data Frames
Python Data Science Tutorial #13 - Pandas Data Frames
NeuralNine
36 Python Data Science Tutorial #14 - Pandas Statistics
Python Data Science Tutorial #14 - Pandas Statistics
NeuralNine
37 Python Data Science Tutorial #15 - Pandas Sorting and Functions
Python Data Science Tutorial #15 - Pandas Sorting and Functions
NeuralNine
38 Python Data Science Tutorial #16 - Pandas Merging Data Frames
Python Data Science Tutorial #16 - Pandas Merging Data Frames
NeuralNine
39 Python Data Science Tutorial #17 - Pandas Queries
Python Data Science Tutorial #17 - Pandas Queries
NeuralNine
40 Python Machine Learning Tutorial #1 - What is Machine Learning?
Python Machine Learning Tutorial #1 - What is Machine Learning?
NeuralNine
41 Python Machine Learning Tutorial #2 - Linear Regression
Python Machine Learning Tutorial #2 - Linear Regression
NeuralNine
42 Python Machine Learning Tutorial #3 - K-Nearest Neighbors Classification
Python Machine Learning Tutorial #3 - K-Nearest Neighbors Classification
NeuralNine
43 Python Machine Learning #4 - Support Vector Machines
Python Machine Learning #4 - Support Vector Machines
NeuralNine
44 Python Machine Learning Tutorial #5 - Decision Trees and Random Forest Classification
Python Machine Learning Tutorial #5 - Decision Trees and Random Forest Classification
NeuralNine
45 Python Machine Learning Tutorial #6 - K-Means Clustering
Python Machine Learning Tutorial #6 - K-Means Clustering
NeuralNine
46 Python Machine Learning Tutorial #7 - Neural Networks
Python Machine Learning Tutorial #7 - Neural Networks
NeuralNine
47 Python Machine Learning Tutorial #8 - Handwritten Digit Recognition with Tensorflow
Python Machine Learning Tutorial #8 - Handwritten Digit Recognition with Tensorflow
NeuralNine
48 Generating Poetic Texts with Recurrent Neural Networks in Python
Generating Poetic Texts with Recurrent Neural Networks in Python
NeuralNine
49 Stock Portfolio Visualization with Matplotlib in Python
Stock Portfolio Visualization with Matplotlib in Python
NeuralNine
50 Analyzing Coronavirus with Python (COVID-19)
Analyzing Coronavirus with Python (COVID-19)
NeuralNine
51 Making Text Images Readable Again with Python and OpenCV
Making Text Images Readable Again with Python and OpenCV
NeuralNine
52 Neural Networks Simply Explained (Theory)
Neural Networks Simply Explained (Theory)
NeuralNine
53 Motion Filtering with OpenCV in Python
Motion Filtering with OpenCV in Python
NeuralNine
54 Top 5 Programming Languages To Learn in 2020
Top 5 Programming Languages To Learn in 2020
NeuralNine
55 Simple TCP Chat Room in Python
Simple TCP Chat Room in Python
NeuralNine
56 Image Classification with Neural Networks in Python
Image Classification with Neural Networks in Python
NeuralNine
57 Edge Detection with OpenCV in Python
Edge Detection with OpenCV in Python
NeuralNine
58 S&P 500 Web Scraping with Python
S&P 500 Web Scraping with Python
NeuralNine
59 Simple Sentiment Text Analysis in Python
Simple Sentiment Text Analysis in Python
NeuralNine
60 Introduction - Algorithms & Data Structures #1
Introduction - Algorithms & Data Structures #1
NeuralNine

This video teaches how to use Poetry to manage dependencies and create professional Python projects. It covers the basics of Poetry and how to use it to improve code quality.

Key Takeaways
  1. Install Poetry using pip
  2. Create a new Poetry project
  3. Add dependencies to the project
  4. Use virtual environments with Poetry
  5. Manage dependencies with Poetry
💡 Poetry is a powerful tool for managing dependencies and creating professional Python projects, and can be used to improve code quality and simplify development workflows.

Related Reads

📰
AI's Next Frontier: Cost, Control, and the Compute Race
Learn how AI's next frontier is driven by cost, control, and the compute race, and why it matters for AI development
Dev.to AI
📰
The Rise of Enterprise AI Coding Assistant Bans: Why Cloud Tools Are Being Blocked and What to Build Instead
Learn why enterprises are banning cloud AI coding assistants and how to build a secure on-premise alternative, a $5,000/month opportunity for founders
Dev.to · ping wang
📰
coding benchmarks are becoming production dependencies
Coding benchmarks like SWE-Bench Pro have significant errors, impacting production dependencies, and it's crucial to reassess their use in decision-making
Dev.to AI
📰
The Visual Reverse Engineering Hypothesis: From Phosphenes to Latent Space
Explore the Visual Reverse Engineering Hypothesis to understand how the brain processes visual information and its potential connection to AI models
Medium · AI
Up next
How to Start a SaaS Business in 2026
Learn With Shopify
Watch →