Data Scientist: from school to work, part I

Nowadays, data scientific projects do not end with the evidence of the mind; All projects aim for use in production. It is important, to bring the high quality code. I am working as a data scientist for more than ten years and I have seen that Juniors often have a weakness, understandable, because the data scientist needs to be calculated by mathematics. In this series of articles, I would like to share some advice and good habits to manage data scientific projects in Python. From the Python to Edocker, with Dequin to Git, I will present the tools I use every day.
One day, your colleague told me how to install Linux because of the wrong deception with Python. He had returned the old project that he wanted to do. As a result of the installation and extermination of packages and variable versions, his Linux-Based Python area was no longer effective: an incident that can be prevented by setting a visible location. But it shows how important it is to manage these areas. Fortunately, now there is a very good tool for this: Uv.
The origin of these two characters are not clear. According to Zanie Blue (one of the creators):
“We're looking at a ton In words – it is really difficult to choose a word without a collision today, so all the word was equal to trade. UV was given to us in PAYPI, astral-themed (iltraviolet or Universal), and short and it is easy to type. “
Now, let us get more details concerning this beautiful tool.
Introduction
UV is modern, small python projects and packages. It is fully developed in rust, designed to facilitate relief management, creating the environment and project organization. UV is designed to limit the problems of normal Python project such as leaning and environmental disputes. It aims to give up the good, more accurate, more accurate tools like the PIP + Virtualenv combo or COPKA manager. It is said to be 10 to 100 times as fast as traditional authorities.
Whether smaller personal projects or upgrade News apps for manufacturing, UV is a powerful and efficient solution to the package management.
Starting with UV
Insertion
To insert UV, if you use Windows, I recommend using this command in the shell:
winget install --id=astral-sh.uv -e
Also, if Kw-Mac or Linux Use command:
To ensure correct installation, you simply type the signal next command:
uv version
The creation of New Python project
Using UV You can create a new project by specifying the Python version. To start a new project, you must type the signal:
uv init --python x:xx project_name
python x:xx
must be replaced by the desired version (eg python 3.12
). If you do not have a Psyth version specified, UV will take care of this and download the correct version to start the project.
This command creates and starting automatically the GIT collection Project_Name. It has several files:
- A
.gitignore
file. Calculator The storage of the storage area is not overlooked in the GIT version (is basic and they should be re-written for the project ready for reproduction). - A
.python-version
File. It shows the Python version used in the project. - This page
README.md
file. It aims to explain the project and explain how to use it. - A
hello.py
File. - This page
pyproject.toml
file. This file contains all information about tools used to create project. - This page
uv.lock
file. Is used to create visual nature when using an UV to run text (can be likened to Permissions.txtSelected
Package installation
To enter new packages in the following area to use:
uv add package_name
There add The command is for the first time, UV form a new visible nature in the current active indicator and install the specified dependence. A .Veven / Directory appears. In the following run, UV will use existing environmental environment and update only new requested packages. In addition, UV has a strong relying agreement. When he pulled out the add Command, UV analyzes all the dependent graphs to find a compatible set of package versions that meet all the needs (package version and Python version). Finally, UV updates PyProject.Toml and UV.lock files after one add command.
To remove the package, type the command:
uv remove package_name
It is very important to clean the unused package from your place. You have to keep the dependence file as small as possible. If the package is not used or used, it must be deleted.
Run the Python Text
Now, it's been started with your place, your packages are included and your code is ready for exam. You can comply Visible visible nature as usual, but works well to use UV command run
:
uv run hello.py
Using the running command confirms that the script will be made at a visible project area.
Treat the types of Python
Usually recommended to use different types of Python. As mentioned before launch, you may be working on an old project that requires the old Python type. And often it will be very difficult to update the version.
uv python list
At any time, you may change the Python version of your project. To do that, you have to change the line requires python in pyproject.toml
file.
Example: It requires Python = “> = 3.9”
Then you should sync your environment using command:
uv sync
The first command assesses the installation of existing python. If the requested version is not available, UV download and install it. UV and create a new visible environment for the project guide, instead of old.
But the new place doesn't have the necessary package. Therefore, after synchronization command, you must type:
uv pip install -e .
Change from Virtualenv to UV
If you have a Pip and Virtuelv projects established and you wish to use UV, nothing can be easy. If no Requirements The file, you need to activate your visible nature and return the package + installed.
pip freeze > requirements.txt
After that, you should employ the project via UV and then enter the dependence:
uv init .
uv pip install -r requirements.txt

Use Tools
UV gives opportunities to use tools by UV tool command. Python package tools provide command sites such as fuffe, Pytests, gottenetc.. To install the tool, type the command line:
uv tool install tool_name
However, it can be used for a tool unless it is included:
uv tool run tool_name
For convenience, Alias was created: Uvxequivalent UV tool runs. Therefore, to use the tool, just type:
uvx tool_name
Store
UV is the Popular Packal Package Manager designed to provide speedy and installation repairs. It's too much passing tools like pate or cola, Making it a very good decision to manage your Python projects.
Whether you work in small text or large projects, I recommend that you enter this practice to use UV. And believe me, I try it not to take.
Progress
1 – UV documents:
2 – Uv Gitub Repository:
3 – a good database article: