The easiest way to start building a Dagster project is by using the dagster project CLI. This CLI tool helps generate files and folder structures that enable you to quickly get started with Dagster.
The dagster project scaffold command generates a folder structure with a single Dagster code location and other files, such as pyproject.toml and setup.py. This takes care of setting things up with an empty project, enabling you to quickly get started.
The command dagster project from-example downloads one of the official Dagster examples to the current directory. This command enables you to quickly bootstrap your project with an officially maintained example.
For more info about the examples, visit the Dagster GitHub repository or use dagster project list-examples.
The newly generated my-dagster-project directory is a fully functioning Python package and can be installed with pip.
To install it as a package and its Python dependencies, run:
pip install -e ".[dev]"
Using the --editable (-e) flag instructs pip to install your code location as a Python package in "editable mode" so that as you develop, local code changes are automatically applied.
Environment variables, which are key-value pairs configured outside your source code, allow you to dynamically modify application behavior depending on environment.
Using environment variables, you can define various configuration options for your Dagster application and securely set up secrets. For example, instead of hard-coding database credentials - which is bad practice and cumbersome for development - you can use environment variables to supply user details. This allows you to parameterize your pipeline without modifying code or insecurely storing sensitive data.