🛠️ Local Dev environment setup
I develop data science python projects in Linux OS or MAC OS. (For Windows OS I recommend WSL and run commands as Linux OS).
I setup my local development environment using the following steps:
💻 Computer setup to develop with Python
- Install Git
- Linux:
sudo apt-get install git
- MAC:
brew install git
- Linux:
- Install Make
- Linux:
sudo apt-get install make
- MAC:
brew install make
- Linux:
- Install Pyenv and after install set up the terminal for Pyenv - Link to set up
- Linux:
curl https://pyenv.run | bash
- MAC:
brew install pyenv
- Check the installation version executing in terminal:
pyenv --version
for help go to pyenv installation help
- Linux:
- Install Python using Pyenv, at this time I am using Python 3.11
(In the future, I recommend using UV to manage Python versions. UV is a faster,
more efficient alternative to traditional package managers and virtual environments.)pyenv install 3.11
# Install Python 3.11 in computerpyenv global 3.11
# Set Python 3.11 as global version- Check the installation version executing in terminal:
python --version
- Install locally UV to Install and Run Python Applications in Isolated Environments
-
Linux:
- Check the installation version executing in terminal:
uv version
- Check the installation version executing in terminal:
-
🐍 General Python tools
General Tools that I use to develop Python projects, The most important is Poetry and all this tools are installed using UV to have this tools in isolated environments, because applications runs in its own virtual environment to avoid dependencies conflicts and they are available everywhere.
- Poetry to manage the dependencies and the virtual environment of the project.
uv tool install poetry
- Cruft allows you to maintain all the necessary boilerplate for packaging and building projects separate from the code you intentionally write. Fully compatible with existing Cookiecutter templates.
uv tool install cruft
- (optional) Pip-audit to local check the security of the dependencies of the project.
uv tool install pip-audit
- (optional) Actionlint to check the syntax of the GitHub Actions configuration files of the project.
uv tool install actionlint
Note: UV is a tool that wants to replace the need of Pyenv, Poetry and other ones. So is very possible that in the future I will use UV to manage the python versions, environments and dependencies.
📁 Start a new data science project
-
Start a new project using the Cruft with the Data Science Project Template.
-
Answer the questions to create the project.
-
Run
make init_env
to init Git and Poetry. Or You can do the same running this commands: -
🎉 Congrats Start coding your project.