Add external Blok

We are going to use an existing generic business blok within our project to represent postal addresses.

Note: You can use II_setup-project directory from AnyBlok/anyblok-book-examples repository to get ready to start with this chapter.

Add dependency

According to customers specifications we need to manage addresses, so we are going to depend on the address blok developed by the community and published in the anyblok address python package .

To get the business blok, we need to install that package by adding it in the package dependencies of the project:

diff --git a/ b/
index ca2ca86..1216cde 100644
--- a/
+++ b/
@@ -28,6 +28,7 @@ requirements = [
+    'anyblok_address',

 test_requirements = [

To install new package dependencies use one of the following commands:

(rooms-venv)$ make setup-dev
# or
(rooms-venv)$ python develop
# or
(rooms-venv)$ pip install -e .

To install a new blok, you may add it as a requirement to a module as shown in the next chapter or install it from command line:

(rooms-venv)$ anyblok_updatedb -c --install-bloks address

You can now add/remove addresses with the AnyBlok Python interpreter:

anyblok_interpreter -c

In [11]: registry.Address.insert(
    street1='1 Rue de Stockholm',
Out[11]: <Address: 2ff62d0b-1168-4866-9cfa-f1ed4432d5b9, Pierre, Verkest, None, 75008, Country(alpha_2='FR', alpha_3='FRA', name='France', numeric='250', official_name='French Republic') [RO=False] >


results matching ""

    No results matching ""