This document contains instructions for collaborating on the different libraries of Nixtla.Sometimes, diving into a new technology can be challenging and overwhelming. We’ve been there too, and we’re more than ready to assist you with any issues you may encounter while following these steps. Don’t hesitate to reach out to us on Slack. Just give fede a ping, and she’ll be glad to assist you.
fork-and-pull
worklowfork-and-pull
worklowgit clone https://github.com/<your-username>/nixtla.git
. This allows
you to work with the code directly on your system.
3. Create a Branch:
Branching in GitHub is a key strategy for effectively managing and
isolating changes to your project. It allows you to segregate work on
different features, fixes, and issues without interfering with the main,
production-ready codebase.
git checkout -b feature/new-model
.
git checkout -b fix/forecasting-bug
.
git checkout -b issue/issue-number
or
git checkout -b issue/issue-description
.
If you want to use Docker or Codespaces, let us know opening an issue and we will set you up.Next, you’ll need to set up a Conda environment. Conda is an open-source package management and environment management system that runs on Windows, macOS, and Linux. It allows you to create separate environments containing files, packages, and dependencies that will not interact with each other. First, ensure you have Anaconda or Miniconda installed on your system. Alternatively checkout these guides: Anaconda, Miniconda, and Mamba. Then, you can create a new environment using
conda create -n nixtla-env python=3.10
.
You can also use mamba for creating the environment (mamba is faster
than Conda) using mamba create -n nixtla-env python=3.10
.
You can replace nixtla-env
for something more meaningful to you. Eg.
statsforecast-env
or mlforecast-env
. You can always check the list
of environments in your system using conda env list
.
Activate your new environment with conda activate nixtla-env
.
environment.yml
file contains all the dependencies required for
the project. To install these dependencies, use the mamba
package
manager, which offers faster package installation and environment
resolution than Conda. If you haven’t installed mamba
yet, you can do
so using conda install mamba -c conda-forge
. Run the following command
to install the dependencies:
enviorment.yml
is sometimes inside
a folder called dev
. In that case, you should run
mamba env update -f dev/environment.yml
.
pip install -e ".[dev]"
.
This means the package is linked directly to the source code, allowing
any changes made to the source code to be immediately reflected in your
Python environment without the need to reinstall the package. This is
useful for testing changes during package development.
nbdev
and a notebook editor
(such as VS Code, Jupyter Notebook or Jupyter Lab). nbdev
and jupyter
have been installed in the previous step. If you use VS Code follow
this
tutorial.
nbdev makes debugging and refactoring
your code much easier than in traditional programming environments since
you always have live objects at your fingertips. nbdev
also promotes
software engineering best practices because tests and documentation are
first class.
All your changes must be written in the notebooks contained in the
library (under the nbs
directory). Once a specific notebook is open
(more details to come), you can write your Python code in cells within
the notebook, as you would do in a traditional Python development
workflow. You can break down complex problems into smaller parts,
visualizing data, and documenting your thought process. Along with your
code, you can include markdown cells to add documentation directly in
the notebook. This includes explanations of your logic, usage examples,
and more. Also, nbdev
allows you to write tests
inline
with your code in your notebook. After writing a function, you can
immediately write tests for it in the following cells.
Once your code is ready, nbdev
can automatically convert your notebook
into Python scripts. Code cells are converted into Python code, and
markdown cells into comments and docstrings.
jupyter lab
(or VS Code).
git add [your_modified_file_0.ipynb] [your_modified_file_1.ipynb]
,
then commit these changes using
git commit -m "<type>: <Your descriptive commit message>"
. Please
use Conventional
Commits
git push origin feature/your-feature-name
.
Nixtla offers the possibility of assisting with stipends for computing infrastructure for our contributors. If you are interested, please join our slack and write to fede or Max.You can find a detailed step by step buide with screen-shots below.
conda install mamba -c conda-forge
in the terminal you just opened:
mlforecast
with the following
command: mamba create -n mlforecast python=3.10
:
conda activate mlforecast
:
environment.yml
using mamba env update -f environment.yml
:
pip install -e ".[dev]"
:
git checkout -b [new_branch]
like this:
nbs/utils.ipynb
, which contains the metadata for the prediction
intervals. After opening it, click on the environment you want to use
(top right) and select the mlforecast
environment:
PredictionIntervals
class:
n_window
from 2 to 3:
nbdev_export
in the terminal.
You will see that the mlforecast/utils.py
file has been modified (the
changes from nbs/utils.ipynb
are reflected in that module). Before
committing the changes, we need to clean the notebooks using the command
./action_files/clean_nbs
and verify that the linters pass using
./action_files/lint
:
git add nbs/utils.ipynb mlforecast/utils.py
:
git commit -m "[description of changes]"
:
git push
: