Skip to content

Development#

After cloning the project, you'll need to set up the development environment. Here are the guidelines on how to do this.

Install Justfile Utility#

Install justfile on your system:

https://just.systems/man/en/prerequisites.html

View all available commands:

just

Install uv#

Install uv on your system:

https://docs.astral.sh/uv/getting-started/installation/

Init development environment#

Build faststream image and install all dependencies:

just init

By default, this builds Python 3.10. If you need another version, pass it as an argument to the just command:

just init 3.11.5

To check available Python versions, refer to the pyproject.toml file in the project root.

Run all Dependencies#

Start all dependencies as docker containers:

just up

Once you are done with development and running tests, you can stop the dependencies' docker containers by running:

just stop
# or
just down

Running Tests#

To run fast tests, use:

just test

To run all tests with brokers connections, use:

just test-all

To run tests with coverage:

just coverage-test
If you need test only specific folder or broker:

just test tests/brokers/kafka
# or
just test-all tests/brokers/kafka
# or
just coverage-test tests/brokers/kafka

If you need some pytest arguments:

just test -vv
# or
just test tests/brokers/kafka -vv
# or
just test "-vv -s"

In your project, some tests are grouped under specific pytest marks:

  • confluent
  • slow
  • rabbit
  • kafka
  • nats
  • redis
  • all

By default, "just test" will execute "not slow and not kafka and not confluent and not redis and not rabbit and not nats" tests. "just test-all" will execute tests with mark "all". You can specify marks to include or exclude tests:

just test tests/ -vv "not kafka and not rabbit"
# or
just test . -vv "not kafka and not rabbit"
# or if you no need pytest arguments
just test . "" "not kafka and not rabbit"

Linter#

Run all linters:

just linter
This command run ruff check, ruff format.

To use specific command

just ruff-check
# or
just ruff-format

Static analysis#

To run mypy, please use the following command.

just mypy

Pre-commit#

Run pre-commit:

just pre-commit
# or
just pre-commit-all

Docs#

Build docs:

just docs-build

Run docs:

just docs-serve

To run full version of the documentation (including API Reference) type the command:

just docs-serve --full

Commits#

Please, use Conventional Commits to name your commits and PR's.

  • build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
  • ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
  • docs: Documentation only changes
  • feat: A new feature
  • fix: A bug fix
  • perf: A code change that improves performance
  • refactor: A code change that neither fixes a bug nor adds a feature
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • test: Adding missing tests or correcting existing tests
  • chore Miscellaneous commits e.g. modifying .gitignore, ...