<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by debayan on Medium]]></title>
        <description><![CDATA[Stories by debayan on Medium]]></description>
        <link>https://medium.com/@phoenix01?source=rss-a84a403d7e74------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*OyWjlsJKPku2uwq6K-HR9w.jpeg</url>
            <title>Stories by debayan on Medium</title>
            <link>https://medium.com/@phoenix01?source=rss-a84a403d7e74------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 19:24:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@phoenix01/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Pip commands and virtual env in python]]></title>
            <link>https://medium.com/@phoenix01/pip-commands-and-virtual-env-in-python-61c18188bb51?source=rss-a84a403d7e74------2</link>
            <guid isPermaLink="false">https://medium.com/p/61c18188bb51</guid>
            <category><![CDATA[venv]]></category>
            <category><![CDATA[virtual-environment]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[pip]]></category>
            <dc:creator><![CDATA[debayan]]></dc:creator>
            <pubDate>Fri, 14 Jan 2022 10:12:27 GMT</pubDate>
            <atom:updated>2022-01-14T10:12:27.882Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>The first basic question that comes into mind is what is pip?</strong></blockquote><p>Pip is basically a package manager for python, with the help of pip we can install and work with various packages and modules in python. Now th functionalities of pip are not just to install and uninstall packages it has vaious other important commands which we’ll dive in now.</p><blockquote><strong>Commands in pip</strong></blockquote><ul><li>pip install the most basic command in pip which is used to install any particular package, it is used as pip install packagename</li><li>pip uninstall as is evident from the word uninstall it is used to uninstall a particular package, used as pip uninstall packagename</li><li>pip list this command gives a list of packages installed in the system installation of python(considering we are not using a virtual env). Various option’s can be used with list pip list --outdated or pip list -o gives a list of all the packages that are outdated i.e not updated to the current available version , also pip list -u will give a list down all the updated packagaes.</li><li>pip install -U packagename now let’s say we find a package is outdated by running the above command we can upgrade the package to the current version available.</li><li>pip show this show information about a particular package ,used as pip show packagename ,it gives us information about the version, the author , the dependencies etc.</li><li>pip check a pretty useful commands it list downs the broken dependencies if any.</li><li>pip freeze the command is used to give a list of all the packages needed for a particular project in the requirements .txt format, it is very helpful when u give your project to someone else and the developer runs the project on his/her own system instead of installing the required packages one by one they can install all the packages at once from the requirements file .</li><li>pip install -r requirenentsfilename this command is used to install the requirements from the requirements file all at once.</li><li>pip freeze &gt; reuquirements.txt this command will directly make the requirements file in the current directory and then any other developer can use this file to install all the packages related to the project.</li></ul><p>So these are the most of the commands you will need while developing a particular project and you can always refer to the manual page with pip --help command if you ever forget a command</p><blockquote><strong>Venv module in python</strong></blockquote><p>We often her people talking about virtual environment so let’s clear the concepts of virtual env and how we create a virtual env with the help of the venv module in python.</p><p><strong><em>What is a virtual environment and why do we need one?</em></strong></p><p>A virtual environment is essentially a space which is different from the system environment or in other others words if u consider two different two different computers they represent two different workspaces or environments whatever we do in one system does not effect the other in the same way virtual environment is a virtual space in the same system and considering from from the point of view of python the packages we install in a virtual env does not effects the packages in the system environment.</p><p>Now in the first place do we need one.. let’s imagine you are working on a django project and now after completing it you want to work with another one but with a different django version so now if we upgrade django to the new version it might break the code in the old project so we can create a virtual env and install the new django package in there and hence it won’t effect the initial django installation.</p><blockquote><strong>Using pip in a virtual env</strong></blockquote><p><strong><em>First all how do we create a virtual env?</em></strong></p><p>python -m venv nameofmodule this will create a venv folder in the project folder for ex python -m venv venv.</p><p>Now we have to activate the virtual environment in order to do so.</p><p>venv/Scripts/Activate.ps1 we run this command in the terminal (in this case power shell) this command activates the virtual environment which appears as shown below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*Mc7mr4UYIHpDwYYscfTorg.png" /></figure><ul><li>If we want to deactivate the environment we just have to write <strong><em>deactivate</em></strong> in the terminal.</li><li>Now once the virtual env is activated if you run pip list it will show you just two default packages pip and setuptools and you can install whatever packages you want it won’t be reflected in the system environment. This virtual environment will not have access to the packages in the system environment.</li><li>Also the version of python used in the virtual environment will be the python version that was used to create the virtual environment in the first place.</li><li>Added to that we can create a virtual environment which actally has access to the packages in the system environment by using the command</li><li>python -m venv venv --system-site-packages this command will create a python virtual environment which will obviously be different from the system environment but also it will have access to the packages in the system installation of python.</li><li>An obvious question may arise what would pip list output to the screen in this scenario when the virtual env has access to the system packages, it will list all the sites altogether i.e both the packages in the system env as well as the virtual env.</li><li>But if we only want to see the packages installed in the virtual env we should run pip list --local command which list all the packages in the virtual env also we can use pip freeze --local to print the local packages in the requirements format.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=61c18188bb51" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git and GitHub]]></title>
            <link>https://medium.com/@phoenix01/git-and-github-9def35415256?source=rss-a84a403d7e74------2</link>
            <guid isPermaLink="false">https://medium.com/p/9def35415256</guid>
            <category><![CDATA[what-is-git-and-github]]></category>
            <category><![CDATA[beginners-guide-to-git]]></category>
            <category><![CDATA[git-and-github]]></category>
            <dc:creator><![CDATA[debayan]]></dc:creator>
            <pubDate>Fri, 14 Jan 2022 05:25:00 GMT</pubDate>
            <atom:updated>2022-01-14T05:25:00.610Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tt_4GyEp_5jUM9WI6pK9Sw.png" /></figure><p>Now often a times beginners tend to confuse <strong><em>git</em></strong> and <strong><em>github</em></strong> a lot so lets just make this a bit a easy for them…. and we’ll also look into some the bare basics of git commands for beginners.</p><blockquote><strong>Basic overview of git and github</strong></blockquote><p><strong><em>Git</em></strong> is basically a software like any other software installed in your operating system whereas github is a <strong><em>cloud based repository </em></strong>where developers can store there source code and files related to a particular project, in simpler words it is like a storage space which allows you to collaborate and work with other people.</p><blockquote><strong>Git and Version Control System</strong></blockquote><p>So to start with git is a <strong><em>version control system (VCS)</em></strong>more specifically it’s a<strong><em> distributed version control system. </em></strong><em>These two phrases sound a bit too much right well lets simplify them</em><strong><em>…</em></strong></p><blockquote><strong>What is a version control system?</strong></blockquote><p>A version control system is a system or software which can track the changes made to any file or program it treats every change made to a file as a new version of the file or code .Now version control system’s can be mainly of two types :central VCS (for example SVN) and distributed VCS(for example GIT).Now before learning about what a distributed VCS is knowing what a central VCS is will be helpful.</p><blockquote><strong>Central VCS and distributed VCS</strong></blockquote><p><strong><em>Central VCS</em></strong>: A central VCS mainly consists of a central repository(the main storage space where all files are stored) a group of developers working on a particular project can checkout files from the server or checkin files into the server. But this system actually posed some problems because of which distributed VCS is much popular now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/1*3HQh6M-VXSDotVoE9u2xzA.png" /><figcaption><strong>Central version control system</strong></figcaption></figure><p>The main problems of a central VCS are : if for some reason the server gets corrupted and if there isn’t a backup the hole project will be lost, also if the server is down or if the developer is at a place with poor internet connectivity then will be able to view only the files that they had checked out the last time.<em> All these problems were corrected with the help of a distributed VCS.</em></p><p>Now a <strong><em>distributed VCS</em></strong> is one where there is a central server also known as the remote repository where all the files are stored and then there is a local repository which is a copy of the remote repository stored in the machines of the developer’s working on the project so basically that means every developer has a exact copy of the remote repository so if for some reason the server is corrupted any one of the developer’s who had most recently synced with the remote repository can just upload the files back to the server and the server will be back online.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*kzB5KuMjpICNuAZjeUi73w.png" /><figcaption>Distributed version control system</figcaption></figure><p>Now since we have a good understanding of git and what a version control system is we can move forward with git commands and the various use cases of git.</p><p><em>After you have installed git before moving forward with the commands you should set some global config values which will be needed when you will work with other developers.</em></p><p>git config --global user.name &quot;your name&quot;</p><p>git config --global user.email &quot;your email&quot;</p><p><em>so after this whenever you commit a change to the local or to the remote repository in addition to the commit the commit message it will show the name and the email of the person who made the changes.</em></p><ul><li><strong>Let’s say we have a project of our own and we want to start tracking it with the help of git</strong></li></ul><blockquote><strong>A common workflow is as follows:</strong></blockquote><ul><li>git init: command used to initialize a empty git repository .This creates a .git folder in the working directory or the project folder.</li><li>git add: this command adds all the untracked and modified files to the staging area .If we want to add all the untracked files at once we can use git add . or git add -A or if we want to to only a particular file we can do git add file_name.</li><li>git status: this command shows the status of the files i.e which files are in the staging area and which files are in the working directory.</li><li>git commit -m &quot;commit message&quot; now after the files are added to the staging area if we are finally ready to commit the changes to the local repository we use the git commit command. Here -m “ commit message” signifies whenever we commit a change we should always mention a short description of what changes we made for ex imagine we had a function in a project to add two numbers and we changed it to add three numbers so when we commit it we’ll write git commit -m &quot;made changes to the add function” .</li></ul><blockquote>Now obviously you might be thinking what is a <strong><em>staging area?</em></strong></blockquote><p>So to understand that we first have to understand how git works in the system ,we can think of it as a three stage process.</p><ul><li>At the base is the working directory where all the untracked and modified files are present.</li><li>Then comes the staging area above that, a staging area is nothing but a intermediate stage between the working directory and the local repository. What it allows us to to do is to make a final decision on weather we finally want to commit the changes made to a file to the local repository.</li><li>At the top i.e the third layer which is the local repository where the final changes are committed.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*DVJE-7Vni2BDrG54DND7HQ.png" /><figcaption>Representation of working of git</figcaption></figure><p>Some additional basic commands</p><ul><li>git log this command will give you a log history of the commits that you have made to the local repository.</li><li>git diff file_name this command will show you the difference i.e the lines you added or removed after modifying a particular block of code in a file i.e the the files changes that are not yet staged. You can use git diff without any filename too then that will give you all the changes made which are not staged yet.</li></ul><p>Here you should not get confused with local repository and working directory local repository is the .git folder/directory which inherently recides inside the working directory but when you make changes to a file the changes are actually not reflected in the file unless you commit the changes to the local repository or the .git repository with the git commit command</p><ul><li>git checkout One important command that might come in handy , if let’s say we want to get rid of the changes we made to a particular file and the file has already been staged so we can just write git checkout file_name. What this does is it get’s rid of the recent changes that we made to the file. git checkout can be used in other ways too which we will know later as we move forward.</li><li>git clean -df this actually is a very important command let’s say we have a lot of untracked files in the project folder which i no longer need so instead of deleting them one by one we can just run git clean -df .The -df option signifies directories and folders both are to deleted when I run the above command .</li></ul><p><strong><em>Creating and using a </em></strong><strong><em>.gitignore file</em></strong></p><p>a .gitignore file is like any other file but it has some special abilities let’s say in our project we have some files which we don’t want to include while staging or for committing, we can write the file names individually or if we want to ignore all the files with a certain extension we can write *.file_extension .So what this file does is it’ll ignore all the files mentioned inside it while we run the command <strong>git add</strong> and when we run the command <strong>git status</strong> it’ll not show us the files in the terminal.</p><blockquote>That was the very basics of git and it’s usages stay tuned for the concepts of branching, merging, rebasing, stash etc.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9def35415256" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>