Reading view

There are new articles available, click to refresh the page.

My first blog

Greetings everyone. This is the very first blog I am ever posting on my personal site as a test. Thanks for stopping by.

uv- A faster alternative to pip and pip-tools

Introduction

If you’re a Python developer, you’re probably familiar with pip and pip-tools, the go-to tools for managing Python packages. However, did you know that there’s a faster alternative that can save you time and improve your workflow?

Meet UV

uv is a package installer used for installing packages in python in a faster way. Which is written on Rust 🦀 , makes a warping speed in installation of packages as compared to pip and pip-tools.

Also, It is Free and Open Source done by astral-sh. which has around 11.3k stars on GitHub makes a very trending alternative package manager for python.

pip vs uv

As per astral-sh, they claim uv makes as very faster on installation of python packages, as compared to poetry , which is a another python package manager and pip-compile

Image courtesy: astral-sh ( Package Installation )

Also, we can able to create a virtual environment, at a warping speed as compared to python3 venv or virtualenv.

Image courtesy: astral-sh ( Virtual Environment )

My experience and Benchmarks

Nowadays, I am using uv as a package manager for doing my side projects. Which feels very good on developing python applications and it will be definitely useful on containerizing python applications using docker.

But now, uv has make my life easier with warping speed in installation on packages, suitable for building and deploying our containers as our need with many repitition and hassle-free in building docker containers.

Here is my comparison on pip and uv, Let’s start with pip

creating virtual environment with pip

The above pic shows that it takes almost 3.84 or approximately 4 seconds to create a virtual environment in python whereas,

creating Virtual environment using uv

uv takes just 0.01 seconds to create a virtual environment in python. Now we move on with installing packages such as fastapi and langchain at same time, which has more dependencies than ever worked with.

pip install fastapi langchain
Installation of fastapi and langchain using pip

This takes around 22.5 seconds, which is fast today 😂, Sometimes which makes it even slower during installation at crucial time. Now let’s check with uv.

Installation of langchain and fastapi using uv

uv, makes a warping installation of langchain and fastapi at same time within 0.12 seconds. 🤯💥

Which makes me to use ‘uv’ as my package manager for python while developing my projects at recent times.

uv Installation and usage

Firstly copy the command for installation using linux,

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/0.1.38/uv-installer.sh | sh

on Windows,

powershell -c "irm https://github.com/astral-sh/uv/releases/download/0.1.38/uv-installer.ps1 | iex"

for mac users, go and download official binaries provided by astral-sh, given here.

Virtual Environment creation

for creating virtual environments for python, we can use

uv venv <environment-name>

for <environment-name> give any name your wish.

Package Installation

for package Installation , we have to use

uv pip install <package-name>

Conclusion

Through this blog post, we have learned about uv package manager and how it is effective in making our python workflows faster and building our containers faster and ease of deployment .

To know about me, click on my github, Linkedin.


uv- A faster alternative to pip and pip-tools was originally published in Towards Dev on Medium, where people are continuing the conversation by highlighting and responding to this story.

How to create Servlet and Deploy on Apache Tomcat 10.1 in Linux

I am going to explain about how to create servlet and Deploy on Apache Tomcat Server 10.1 manually in any Linux distributions.

Directory Structure should be represented as below

directory structure to run servlets

You can keep ‘aaavvv’ folder as any name you want.

How to create Servlet on Apache Tomcat 10 in Linux

Step:1

Create a folder in /usr/share/tomcat10/webapps folder , In that folder create any folder name as you like, I create ‘myapps’ folder name as example.

cd /usr/share/tomcat10/webapps/;sudo mkdir myapps

Step:2

Go into myapps , then create ‘WEB-INF’ directory

cd myapps;sudo mkdir WEB-INF

Step:3

Go into WEB-INF, then create ‘classes’ directory

cd WEB-INF;sudo mkdir classes

Step:4

Go into classes directory, and create java file named ‘TeamTesters.java’ for this example, you can create any name you want.

cd classes;sudo nano TeamTesters.java

code for TeamTesters.java

Step:5

Run java program using javac command

sudo javac TeamTesters.java -cp /usr/share/tomcat10/lib/servlet-api.jar

here -cp represents classpath to run the program

Step:6

Go to backward directory (i.e., WEB-INF) and copy the web.xml file from ROOT directory present in the webapps folder present in tomcat10 folder

cd ..;sudo cp ../../ROOT/WEB-INF/web.xml web.xml;

Then edit web.xml file by adding <servlet> and <servlet-mapping> tag inside <web-app> tag

sudo nano web.xml

<servlet> and <servlet-mapping> in web.xml file

Step:9

Goto backward directory , (i.e., aaavvv) then create index.html file

cd ..; sudo nano index.html

content in index.html

Step:10

goto browser and type,

http://localhost:8080/myapps

servlet running on browser
Statement printed on html page declared in java

Common Troubleshooting problems:

  1. make sure tomcat server and java latest version is installed on your system .
  2. check systemctl or service status in your Linux system to ensure that tomcat server is running.

Automate this stuff…

If you wanted to automate this stuff… checkout my github repository

GitHub - vishnumur777/ServletCreationJava


How to create Servlet and Deploy on Apache Tomcat 10.1 in Linux was originally published in Towards Dev on Medium, where people are continuing the conversation by highlighting and responding to this story.

A simple design calculator on linux command line

when we open terminal or Konsole in Linux we used to think by using many utilities why calculators was not there interactively in it ?

Now here is the solution for it just by cloning a repository from GitHub on your PC. Here is the GitHub link to clone it.

Just open your terminal and make a directory for safety purpose for that type,

mkdir calculator;cd calculator

creating directory on my home directory and changing it to calculator

the above command explain about making and changing directory from home directory.

then type,

git clone https://github.com/vishnumur777/simplecalculatorbash

cloning repository through git command

this command will clone all the files present in the repository.

but please make sure that you have installed git on your PC.

Then change directory to simplecalculatorbash using

cd simplecalculatorbash/

changing directory to simplecalculatorbash

then type,

chmod +x calci.sh

modifying permissions to executables

this command changes the permission to run on user without depending on root . So that many PC cause this error that permission was denied while executing the file.

For execution run type,

./calci.sh

command to execute simplecalculator

and press enter key

which will run very colourful calculator interactive prompt by installing dependencies which I posted on GitHub.

calculator performing addition of two numbers interactively
❌