Repository: IGNF/route-graph-generator (language: python)

Issue:
feat(changelog): update version to 2.2.0 and add changelog



Discussion / hints:

Fix patch:
diff --git a/.github/workflows/docker_publish.yml b/.github/workflows/docker_publish.yml
new file mode 100644
index 0000000..b1a3632
--- /dev/null
+++ b/.github/workflows/docker_publish.yml
@@ -0,0 +1,69 @@
+name: Docker GitHub Container Registry
+
+# This workflow uses actions that are not certified by GitHub.
+# They are provided by a third-party and are governed by
+# separate terms of service, privacy policy, and support
+# documentation.
+
+on:
+  push:
+    branches: [ "master" ]
+    # Publish semver tags as releases.
+    tags: [ '*.*.*' ]
+  pull_request:
+    branches: [ "master", "develop" ]
+
+env:
+  # Use docker.io for Docker Hub if empty
+  REGISTRY: ghcr.io
+  # github.repository as <account>/<repo>
+  IMAGE_NAME: ${{ github.repository }}
+
+
+jobs:
+  build:
+
+    runs-on: ubuntu-latest
+    permissions:
+      contents: read
+      packages: write
+
+    steps:
+      - name: Checkout repository
+        uses: actions/checkout@v3
+
+      # Workaround: https://github.com/docker/build-push-action/issues/461
+      - name: Setup Docker buildx
+        uses: docker/setup-buildx-action@v2
+
+      # Login against a Docker registry except on PR
+      # https://github.com/docker/login-action
+      - name: Log into registry ${{ env.REGISTRY }}
+        if: github.event_name != 'pull_request'
+        uses: docker/login-action@v2
+        with:
+          registry: ${{ env.REGISTRY }}
+          username: ${{ github.actor }}
+          password: ${{ secrets.GITHUB_TOKEN }}
+
+      # Extract metadata (tags, labels) for Docker
+      # https://github.com/docker/metadata-action
+      - name: Extract Docker metadata
+        id: meta
+        uses: docker/metadata-action@v3
+        with:
+          images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
+
+      # Build and push Docker image with Buildx (don't push on PR)
+      # https://github.com/docker/build-push-action
+      - name: Build and push Docker image
+        id: build-and-push
+        uses: docker/build-push-action@v3
+        with:
+          context: .
+          file: ./docker/debian/Dockerfile
+          push: ${{ github.event_name != 'pull_request' }}
+          tags: ${{ steps.meta.outputs.tags }}
+          labels: ${{ steps.meta.outputs.labels }}
+          cache-from: type=gha
+          cache-to: type=gha,mode=max
diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml
new file mode 100644
index 0000000..a92457e
--- /dev/null
+++ b/.github/workflows/documentation.yml
@@ -0,0 +1,67 @@
+# Simple workflow for deploying static content to GitHub Pages
+name: Deploy static content to Pages
+
+on:
+  # Runs on pushes targeting the default branch
+  push:
+    branches: ["master"]
+  pull_request:
+    branches: [ "master", "develop" ]
+
+  # Allows you to run this workflow manually from the Actions tab
+  workflow_dispatch:
+
+# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
+permissions:
+  contents: read
+  pages: write
+  id-token: write
+
+# Allow one concurrent deployment
+concurrency:
+  group: "pages"
+  cancel-in-progress: true
+
+env:
+  PYTHON_VERSION: "3.10"
+
+jobs:
+
+  build:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v3
+
+      - name: Set up Python
+        uses: actions/setup-python@v4
+        with:
+          python-version: ${{ env.PYTHON_VERSION }}
+          cache: "pip"
+          cache-dependency-path: "requirements/*.txt"
+
+      - name: Install documentation requirements
+        run: python -m pip install -U -r requirements/documentation.txt
+      
+      - name: Build doc using Sphinx
+        run: sphinx-build -b html -j auto -d docs/_build/cache -q docs docs/_build/html
+
+      - name: Setup Pages
+        uses: actions/configure-pages@v2
+
+      - name: Upload artifact
+        uses: actions/upload-pages-artifact@v1
+        with:
+          path: 'docs/_build/html'
+
+  deploy:
+    if: github.event_name != 'pull_request'
+    environment:
+      name: github-pages
+      url: ${{ steps.deployment.outputs.page_url }}
+    runs-on: ubuntu-latest
+    needs: build
+    steps:
+      - name: Deploy to GitHub Pages
+        id: deployment
+        uses: actions/deploy-pages@v1
\ No newline at end of file
diff --git a/.github/workflows/pypi_publish.yml b/.github/workflows/pypi_publish.yml
new file mode 100644
index 0000000..173d29a
--- /dev/null
+++ b/.github/workflows/pypi_publish.yml
@@ -0,0 +1,42 @@
+name: Publish Python 🐍 distribution 📦 to PyPI
+
+on: 
+  release:
+    types: [released]
+  pull_request:
+    branches: [ "master" ]
+
+jobs:
+ build-n-publish:
+    name: Build and publish Python 🐍 distributions 📦 to PyPI 
+    runs-on: ubuntu-latest
+    
+    steps:
+      - uses: actions/checkout@master
+
+      - name: Set up Python 3.10
+        uses: actions/setup-python@v3
+        with:
+          python-version: "3.10"
+
+      - name: Install pypa/build
+        run: >-
+          python -m
+          pip install
+          build
+          --user
+
+      - name: Build a binary wheel and a source tarball
+        run: >-
+          python -m
+          build
+          --sdist
+          --wheel
+          --outdir dist/
+          .
+
+      - name: Publish distribution 📦 to PyPI
+        if: startsWith(github.ref, 'refs/tags')
+        uses: pypa/gh-action-pypi-publish@release/v1
+        with:
+          password: ${{ secrets.PYPI_TOKEN }}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..de02ef0
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+.coverage
+coverage.xml
+junit
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..f288702
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,674 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+    <program>  Copyright (C) <year>  <name of author>
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<https://www.gnu.org/licenses/>.
+
+  The GNU General Public License does not permit incorporating your program
+into proprietary programs.  If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.  But first, please read
+<https://www.gnu.org/licenses/why-not-lgpl.html>.
diff --git a/readme.md b/README.md
similarity index 89%
rename from readme.md
rename to README.md
index dcbcb34..4e4ee06 100644
--- a/readme.md
+++ b/README.md
@@ -6,11 +6,11 @@ Route Graph Generator (r2gg) est un script Python qui permet la génération de
 
 Actuellement, il y a trois formats de sortie : OSRM, pgRouting et Valhalla. 
 
-La conversion se fait via les fonctions de la bibliothèque r2gg développée dans ce but. Une documentation plus détaillée de r2gg est consultable [ici](r2gg).
+La conversion se fait via les fonctions de la bibliothèque r2gg développée dans ce but. Une documentation plus détaillée de r2gg est consultable [ici](https://ignf.github.io/route-graph-generator/).
 
 ## Prérequis
 
-Les prérequis au fonctionnement des scripts de génération sont décrits dans le [readme](docker) de l'image docker.
+Les prérequis au fonctionnement des scripts de génération sont décrits dans le [readme](https://ignf.github.io/route-graph-generator/docker/readme.html) de l'image docker.
 
 Les extensions SQL `postgres_fdw` et `PostGIS` doivent être installées sur la base de données `pivot` :
 
@@ -44,9 +44,9 @@ pip3 install --user -e .
 
 Pour pouvoir lancer les scripts de génération, il faut définir une configuration (au format JSON) par ressource à générer. Ce fichier de configuration fait références à d'autres fichiers de configuration : pour la gestion des logs, la gestion des connexions aux bases de données, et pour le calcul des coûts.
 Des exemples de tous ces fichiers sont présents dans le dépôt dans le dossier `io`.
-La documentation de ces fichiers de configuration est consultable [ici](io). 
+La documentation de ces fichiers de configuration est consultable [ici](https://github.com/IGNF/route-graph-generator/tree/master/io). 
 
-Un exemple de ces fichier est disponible dans la partie [docker](./docker/config/). 
+Un exemple de ces fichiers est disponible dans la partie [docker](https://github.com/IGNF/route-graph-generator/tree/master/docker/config). 
 
 ### Exécution
 
diff --git a/changelog.md b/changelog.md
index f329cac..40b5c91 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,9 +1,69 @@
-# 1.2.1
+# CHANGELOG
+
+## 2.2.1 
+
+CHANGED:
+- reference de la doc à la branche master
+- modification de la ci github pour prendre en compte la branche master
+- suppression du déploiement de github pages lors d'un tag
+
+## 2.2.0
+
+FIX:
+- pas d'exception si certains attributs non nécessaire ne sont pas présent dans le .json pour la création de configuration road2
+- suppression d'attribut 'name' dans la configuration d'exemple
+
+ADD:
+- ajout d'un json-schema pour le fichier cost_calculations
+
+## 2.1.0
+
+FIX:
+- Déconnexion de la base de données de travail après traitement
+
+CHANGES:
+- Pas de connexion à la base de travail si non utilisée
+
+ADD:
+- Ajout de la documentation sur GitHub Pages : https://ignf.github.io/route-graph-generator/
+- Ajout de la publication de l'image docker sur le container GitHub : https://github.com/IGNF/route-graph-generator/pkgs/container/route-graph-generator
+- Première livraison sur PyPi
+- Ajout de tests de bout en bout avec pytest. Pour l'instant sql2pivot et pivot2osm sont testés.
+- Ajout support des schémas d'entrée pour la conversion vers la base pivot
+- Ajout d'un script pour la conversion d'une BDTOPO
+
+UPDATE: 
+- Mise à jour version python en 3.10 dans l'image docker
+- Mise à jour dockerfile pour meilleur gestion des requirements
+- Mise à jour dockerfile pour utiliser la version bullseye de debian
+
+## 2.0.0
+
+FIX:
+- Mauvaises configurations dans certains fichiers pour la partie docker
+
+CHANGE:
+- Ajout de 5 secondes en milieu urbain pour les données BDuni
+- Modification de la version de notre fork valhalla
+
+ADD:
+- Ajout du fichier licence
+
+UPDATE: 
+- Mise à jour de la documentation des fichiers de génération
+- Mise à jour des fichiers de génération dans la partie docker (wkt, renommage de fichiers, contraintes sur valhalla)
+
+## 1.2.3
+
+DEPS:
+- Utilisation d'un fork de Valhalla pour avoir plus d'options (en attente de merge sur le projet initial)
+
+## 1.2.1
 
 UPDATE
 - Passage à OSRM 5.26.0
 
-# 1.2.0
+## 1.2.0
 
 CHANGE :
 - suppression de la partie ssh
@@ -12,18 +72,18 @@ CHANGE :
 - Ajout d'une commande pour générer la configuration de Road2 r2gg-road2config
 - Gestion interne différente pour prendre en compte la nouvelle configuration de Road2 (gestion de sources et ressources différente)
 
-# 1.1.2
+## 1.1.2
 
 FEATURES
 - génération de données Valhalla
 - possibilité d'utiliser des fichiers .osm.pbf pour osrm
 
-# 1.1.1
+## 1.1.1
 
 FEATURES :
 - génération à partir de données OSM dans l'image docker si aucun argument n'est fourni
 
-# 1.1.0
+## 1.1.0
 
 FEATURES :
 - génération des ressources smartpgr
diff --git a/docker/config/bdtopo2osrm.json b/docker/config/bdtopo2osrm.json
index 3666850..ae5401c 100644
--- a/docker/config/bdtopo2osrm.json
+++ b/docker/config/bdtopo2osrm.json
@@ -58,9 +58,8 @@
             "source": {
               "baseId": "base_bduni"
             },
-            "storage": {
-              "file": "/home/docker/sql/bduni_convert.sql",
-              "baseId": "base_pivot"
+            "conversion": {
+              "file": "/home/docker/sql/bduni_convert.sql"
             }
           },
           "storage": {
@@ -92,9 +91,8 @@
             "source": {
               "baseId": "base_bduni"
             },
-            "storage": {
-              "file": "/home/docker/sql/bduni_convert.sql",
-              "baseId": "base_pivot"
+            "conversion": {
+              "file": "/home/docker/sql/bduni_convert.sql"
             }
           },
           "storage": {
@@ -126,9 +124,8 @@
             "source": {
               "baseId": "base_bduni"
             },
-            "storage": {
-              "file": "/home/docker/sql/bduni_convert.sql",
-              "baseId": "base_pivot"
+            "conversion": {
+              "file": "/home/docker/sql/bduni_convert.sql"
             }
           },
           "storage": {
@@ -160,9 +157,8 @@
             "source": {
               "baseId": "base_bduni"
             },
-            "storage": {
-              "file": "/home/docker/sql/bduni_convert.sql",
-              "baseId": "base_pivot"
+            "conversion": {
+              "file": "/home/docker/sql/bduni_convert.sql"
             }
           },
           "storage": {
@@ -247,7 +243,8 @@
               "defaultValueContent": "geojson",
               "values": [
                 "geojson",
-                "polyline"
+                "polyline",
+                "wkt"
               ]
             },
             {
diff --git a/docker/config/bdtopo2pgr.json b/docker/config/bdtopo2pgr.json
index 3851d21..a184f54 100644
--- a/docker/config/bdtopo2pgr.json
+++ b/docker/config/bdtopo2pgr.json
@@ -61,7 +61,7 @@
       "sources": [
         {
           "id": "bduni-pgr",
-          "description":"Graphe BDuni au format PGRouting France entière", 
+          "description":"Graphe BDuni au format PGRouting France entière",
           "type": "pgr",
           "projection": "EPSG:4326",
           "bbox": "-180,-90,180,90",
@@ -77,11 +77,6 @@
             "base": {
               "baseId": "base_sortie",
               "attributes": [
-                {
-                  "key": "name",
-                  "column": "way_names",
-                  "default": "false"
-                },
                 {
                   "key": "nom_1_gauche",
                   "column": "nom_1_gauche",
@@ -233,80 +228,80 @@
                   "default": "false"
                 }
               ]
-            } 
+            }
           },
           "costs": [
             {
               "profile": "car",
               "optimization": "fastest",
               "costType": "time",
-              "costColumn": "cost_s_car",                      
+              "costColumn": "cost_s_car",
               "rcostColumn": "reverse_cost_s_car",
               "compute": {
                 "storage": {
-                  "file": "/home/docker/config/costs_calculation_sample.json"
+                  "file": "/home/docker/config/costs_calculation.json"
                 },
                 "configuration": {
                   "name": "cost_s_car",
                   "storage": {
-                    "file": "/home/docker/config/costs_calculation_sample.json"
+                    "file": "/home/docker/config/costs_calculation.json"
                   }
                 }
-              }           
+              }
             },
             {
-              "profile": "car",                               
-              "optimization": "shortest",  
-              "costType": "distance",                    
-              "costColumn": "cost_m_car",                  
+              "profile": "car",
+              "optimization": "shortest",
+              "costType": "distance",
+              "costColumn": "cost_m_car",
               "rcostColumn": "reverse_cost_m_car",
               "compute": {
                 "storage": {
-                  "file": "/home/docker/config/costs_calculation_sample.json"
+                  "file": "/home/docker/config/costs_calculation.json"
                 },
                 "configuration": {
                   "name": "cost_m_car",
                   "storage": {
-                    "file": "/home/docker/config/costs_calculation_sample.json"
+                    "file": "/home/docker/config/costs_calculation.json"
                   }
                 }
-              }            
+              }
             },
             {
-              "profile": "pedestrian",                               
-              "optimization": "fastest",  
-              "costType": "time",                    
-              "costColumn": "cost_s_pedestrian",                  
+              "profile": "pedestrian",
+              "optimization": "fastest",
+              "costType": "time",
+              "costColumn": "cost_s_pedestrian",
               "rcostColumn": "reverse_cost_s_pedestrian",
               "compute": {
                 "storage": {
-                  "file": "/home/docker/config/costs_calculation_sample.json"
+                  "file": "/home/docker/config/costs_calculation.json"
                 },
                 "configuration": {
                   "name": "cost_s_pedestrian",
                   "storage": {
-                    "file": "/home/docker/config/costs_calculation_sample.json"
+                    "file": "/home/docker/config/costs_calculation.json"
                   }
                 }
-              }            
+              }
             },
             {
-              "profile": "pedestrian",                               
-              "optimization": "shortest",  
-              "costType": "distance",                    
-              "costColumn": "cost_m_pedestrian",                  
+              "profile": "pedestrian",
+              "optimization": "shortest",
+              "costType": "distance",
+              "costColumn": "cost_m_pedestrian",
               "rcostColumn": "reverse_cost_m_pedestrian",
               "compute": {
                 "storage": {
-                  "file": "/home/docker/config/costs_calculation_sample.json"
+                  "file": "/home/docker/config/costs_calculation.json"
                 },
                 "configuration": {
                   "name": "cost_m_pedestrian",
                   "storage": {
-                    "file": "/home/docker/config/costs_calculation_sample.json"
+                    "file": "/home/docker/config/costs_calculation.json"
                   }
                 }
-              }            
+              }
             }
           ]
         }
@@ -365,7 +360,6 @@
             {
               "id": "waysAttributes",
               "values": [
-                "name",
                 "nom_1_gauche",
                 "nom_1_droite",
                 "cpx_numero",
@@ -403,7 +397,8 @@
               "defaultValueContent": "geojson",
               "values": [
                 "geojson",
-                "polyline"
+                "polyline",
+                "wkt"
               ]
             },
             {
@@ -773,7 +768,8 @@
               "defaultValueContent": "geojson",
               "values": [
                 "geojson",
-                "polyline"
+                "polyline",
+                "wkt"
               ]
             },
             {
diff --git a/docker/config/bdtopo2valhalla.json b/docker/config/bdtopo2valhalla.json
index a56dab0..234d550 100644
--- a/docker/config/bdtopo2valhalla.json
+++ b/docker/config/bdtopo2valhalla.json
@@ -58,9 +58,8 @@
             "source": {
               "baseId": "base_bduni"
             },
-            "storage": {
-              "file": "/home/docker/sql/bduni_convert.sql",
-              "baseId": "base_pivot"
+            "conversion": {
+              "file": "/home/docker/sql/bduni_convert.sql"
             }
           },
           "storage": {
@@ -89,7 +88,7 @@
             {
               "profile": "car",
               "optimization": "shortest",
-              "costType": "time",
+              "costType": "distance",
               "costing": "auto_shorter",
               "compute": {
                 "storage": {
@@ -106,6 +105,23 @@
             {
               "profile": "pedestrian",
               "optimization": "shortest",
+              "costType": "distance",
+              "costing": "pedestrian",
+              "compute": {
+                "storage": {
+                  "file": "/home/docker/config/graph_bdtopo.lua"
+                },
+                "configuration": {
+                  "costing": "pedestrian",
+                  "storage": {
+                    "file": "/home/docker/config/costs_calculation.json"
+                  }
+                }
+              }
+            },
+            {
+              "profile": "pedestrian",
+              "optimization": "fastest",
               "costType": "time",
               "costing": "pedestrian",
               "compute": {
@@ -185,7 +201,8 @@
               "defaultValueContent": "geojson",
               "values": [
                 "geojson",
-                "polyline"
+                "polyline",
+                "wkt"
               ]
             },
             {
@@ -228,7 +245,15 @@
                   "availableValues": [
                     {
                       "value": "autoroute",
-                      "field": "toll"
+                      "field": "exclude_tolls"
+                    },
+                    {
+                      "value": "pont",
+                      "field": "exclude_bridges"
+                    },
+                    {
+                      "value": "tunnel",
+                      "field": "exclude_tunnels"
                     }
                   ]
                 }
@@ -293,7 +318,15 @@
                   "availableValues": [
                     {
                       "value": "autoroute",
-                      "field": "toll"
+                      "field": "exclude_tolls"
+                    },
+                    {
+                      "value": "pont",
+                      "field": "exclude_bridges"
+                    },
+                    {
+                      "value": "tunnel",
+                      "field": "exclude_tunnels"
                     }
                   ]
                 }
@@ -317,7 +350,8 @@
               "defaultValueContent": "geojson",
               "values": [
                 "geojson",
-                "polyline"
+                "polyline",
+                "wkt"
               ]
             },
             {
diff --git a/docker/config/bduni2valhalla_idf.json b/docker/config/bdtopo2valhalla_idf.json
similarity index 80%
rename from docker/config/bduni2valhalla_idf.json
rename to docker/config/bdtopo2valhalla_idf.json
index 7259e98..474c900 100644
--- a/docker/config/bduni2valhalla_idf.json
+++ b/docker/config/bdtopo2valhalla_idf.json
@@ -1,7 +1,7 @@
 {
   "generation": {
     "general": {
-      "id": "bduni2valhalla-idf",
+      "id": "bdtopo2valhalla",
       "logs": {
         "configFile": "/home/docker/config/sample_log_config.json"
       },
@@ -44,12 +44,12 @@
       }
     },
     "resource": {
-      "id": "bduni-idf-valhalla",
+      "id": "bdtopo-idf-valhalla",
       "type": "valhalla",
       "description": "Données BDUNI v2.",
       "sources": [
         {
-          "id": "bduni-idf-valhalla",
+          "id": "bdtopo-idf-valhalla",
           "type": "valhalla",
           "description": "Données issues de la BDUNI de l'IGN au format Valhalla.",
           "projection": "EPSG:4326",
@@ -58,15 +58,14 @@
             "source": {
               "baseId": "base_bduni"
             },
-            "storage": {
-              "file": "/home/docker/sql/bduni_convert.sql",
-              "baseId": "base_pivot"
+            "conversion": {
+              "file": "/home/docker/sql/bduni_convert.sql"
             }
           },
           "storage": {
-            "tar": "/home/docker/data/bduni-idf-valhalla-tiles.tar",
-            "dir": "/home/docker/data/bduni-idf-valhalla-tiles/",
-            "config": "/home/docker/data/valhalla-idf.json"
+            "tar": "/home/docker/data/bdtopo-valhalla-tiles.tar",
+            "dir": "/home/docker/data/bdtopo-valhalla-tiles/",
+            "config": "/home/docker/data/valhalla.json"
           },
           "costs": [
             {
@@ -76,12 +75,12 @@
               "costing": "auto",
               "compute": {
                 "storage": {
-                  "file": "/home/docker/config/graph_bduni.lua"
+                  "file": "/home/docker/config/graph_bdtopo.lua"
                 },
                 "configuration": {
                   "costing": "auto",
                   "storage": {
-                    "file": "/home/docker/config/costs_calculation_sample.json"
+                    "file": "/home/docker/config/costs_calculation.json"
                   }
                 }
               }
@@ -89,16 +88,16 @@
             {
               "profile": "car",
               "optimization": "shortest",
-              "costType": "time",
+              "costType": "distance",
               "costing": "auto_shorter",
               "compute": {
                 "storage": {
-                  "file": "/home/docker/config/graph_bduni.lua"
+                  "file": "/home/docker/config/graph_bdtopo.lua"
                 },
                 "configuration": {
                   "costing": "auto_shorter",
                   "storage": {
-                    "file": "/home/docker/config/costs_calculation_sample.json"
+                    "file": "/home/docker/config/costs_calculation.json"
                   }
                 }
               }
@@ -106,16 +105,33 @@
             {
               "profile": "pedestrian",
               "optimization": "shortest",
+              "costType": "distance",
+              "costing": "pedestrian",
+              "compute": {
+                "storage": {
+                  "file": "/home/docker/config/graph_bdtopo.lua"
+                },
+                "configuration": {
+                  "costing": "pedestrian",
+                  "storage": {
+                    "file": "/home/docker/config/costs_calculation.json"
+                  }
+                }
+              }
+            },
+            {
+              "profile": "pedestrian",
+              "optimization": "fastest",
               "costType": "time",
               "costing": "pedestrian",
               "compute": {
                 "storage": {
-                  "file": "/home/docker/config/graph_bduni.lua"
+                  "file": "/home/docker/config/graph_bdtopo.lua"
                 },
                 "configuration": {
                   "costing": "pedestrian",
                   "storage": {
-                    "file": "/home/docker/config/costs_calculation_sample.json"
+                    "file": "/home/docker/config/costs_calculation.json"
                   }
                 }
               }
@@ -130,7 +146,7 @@
             {
               "id": "resource",
               "values": [
-                "bduni-idf-valhalla"
+                "bdtopo-idf-valhalla"
               ]
             },
             {
@@ -185,7 +201,8 @@
               "defaultValueContent": "geojson",
               "values": [
                 "geojson",
-                "polyline"
+                "polyline",
+                "wkt"
               ]
             },
             {
@@ -228,7 +245,15 @@
                   "availableValues": [
                     {
                       "value": "autoroute",
-                      "field": "toll"
+                      "field": "exclude_tolls"
+                    },
+                    {
+                      "value": "pont",
+                      "field": "exclude_bridges"
+                    },
+                    {
+                      "value": "tunnel",
+                      "field": "exclude_tunnels"
                     }
                   ]
                 }
@@ -242,7 +267,7 @@
             {
               "id": "resource",
               "values": [
-                "bduni-idf-valhalla"
+                "bdtopo-idf-valhalla"
               ]
             },
             {
@@ -293,7 +318,15 @@
                   "availableValues": [
                     {
                       "value": "autoroute",
-                      "field": "toll"
+                      "field": "exclude_tolls"
+                    },
+                    {
+                      "value": "pont",
+                      "field": "exclude_bridges"
+                    },
+                    {
+                      "value": "tunnel",
+                      "field": "exclude_tunnels"
                     }
                   ]
                 }
@@ -317,7 +350,8 @@
               "defaultValueContent": "geojson",
               "values": [
                 "geojson",
-                "polyline"
+                "polyline",
+                "wkt"
               ]
             },
             {
diff --git a/docker/config/bduni2osrm_idf.json b/docker/config/bduni2osrm_idf.json
index 5fce7cd..a5935ea 100644
--- a/docker/config/bduni2osrm_idf.json
+++ b/docker/config/bduni2osrm_idf.json
@@ -58,9 +58,8 @@
             "source": {
               "baseId": "base_bduni"
             },
-            "storage": {
-              "file": "/home/docker/sql/bduni_convert.sql",
-              "baseId": "base_pivot"
+            "conversion": {
+              "file": "/home/docker/sql/bduni_convert.sql"
             }
           },
           "storage": {
@@ -76,7 +75,7 @@
               "configuration": {
                 "name": "cost_s_car",
                 "storage": {
-                  "file": "/home/docker/config/costs_calculation_sample.json"
+                  "file": "/home/docker/config/costs_calculation.json"
                 }
               }
             }
@@ -92,9 +91,8 @@
             "source": {
               "baseId": "base_bduni"
             },
-            "storage": {
-              "file": "/home/docker/sql/bduni_convert.sql",
-              "baseId": "base_pivot"
+            "conversion": {
+              "file": "/home/docker/sql/bduni_convert.sql"
             }
           },
           "storage": {
@@ -110,7 +108,7 @@
               "configuration": {
                 "name": "cost_m_car",
                 "storage": {
-                  "file": "/home/docker/config/costs_calculation_sample.json"
+                  "file": "/home/docker/config/costs_calculation.json"
                 }
               }
             }
@@ -178,7 +176,8 @@
               "defaultValueContent": "geojson",
               "values": [
                 "geojson",
-                "polyline"
+                "polyline",
+                "wkt"
               ]
             },
             {
diff --git a/docker/config/bduni2pgr_idf.json b/docker/config/bduni2pgr_idf.json
index de0395d..0594468 100644
--- a/docker/config/bduni2pgr_idf.json
+++ b/docker/config/bduni2pgr_idf.json
@@ -61,7 +61,7 @@
       "sources": [
         {
           "id": "bduni-idf-pgr",
-          "description":"Graphe BDuni au format PGRouting France entière", 
+          "description":"Graphe BDuni au format PGRouting France entière",
           "type": "pgr",
           "projection": "EPSG:4326",
           "bbox": "1.7,48.4,3.3,49.1",
@@ -77,11 +77,6 @@
             "base": {
               "baseId": "base_sortie",
               "attributes": [
-                {
-                  "key": "name",
-                  "column": "way_names",
-                  "default": "false"
-                },
                 {
                   "key": "nom_1_gauche",
                   "column": "nom_1_gauche",
@@ -234,80 +229,80 @@
                 }
               ]
             }
-            
+
           },
           "costs": [
             {
               "profile": "car",
               "optimization": "fastest",
               "costType": "time",
-              "costColumn": "cost_s_car",                      
+              "costColumn": "cost_s_car",
               "rcostColumn": "reverse_cost_s_car",
               "compute": {
                 "storage": {
-                  "file": "/home/docker/config/costs_calculation_sample.json"
+                  "file": "/home/docker/config/costs_calculation.json"
                 },
                 "configuration": {
                   "name": "cost_s_car",
                   "storage": {
-                    "file": "/home/docker/config/costs_calculation_sample.json"
+                    "file": "/home/docker/config/costs_calculation.json"
                   }
                 }
-              }           
+              }
             },
             {
-              "profile": "car",                               
-              "optimization": "shortest",  
-              "costType": "distance",                    
-              "costColumn": "cost_m_car",                  
+              "profile": "car",
+              "optimization": "shortest",
+              "costType": "distance",
+              "costColumn": "cost_m_car",
               "rcostColumn": "reverse_cost_m_car",
               "compute": {
                 "storage": {
-                  "file": "/home/docker/config/costs_calculation_sample.json"
+                  "file": "/home/docker/config/costs_calculation.json"
                 },
                 "configuration": {
                   "name": "cost_m_car",
                   "storage": {
-                    "file": "/home/docker/config/costs_calculation_sample.json"
+                    "file": "/home/docker/config/costs_calculation.json"
                   }
                 }
-              }            
+              }
             },
             {
-              "profile": "pedestrian",                               
-              "optimization": "fastest",  
-              "costType": "time",                    
-              "costColumn": "cost_s_pedestrian",                  
+              "profile": "pedestrian",
+              "optimization": "fastest",
+              "costType": "time",
+              "costColumn": "cost_s_pedestrian",
               "rcostColumn": "reverse_cost_s_pedestrian",
               "compute": {
                 "storage": {
-                  "file": "/home/docker/config/costs_calculation_sample.json"
+                  "file": "/home/docker/config/costs_calculation.json"
                 },
                 "configuration": {
                   "name": "cost_s_pedestrian",
                   "storage": {
-                    "file": "/home/docker/config/costs_calculation_sample.json"
+                    "file": "/home/docker/config/costs_calculation.json"
                   }
                 }
-              }            
+              }
             },
             {
-              "profile": "pedestrian",                               
-              "optimization": "shortest",  
-              "costType": "distance",                    
-              "costColumn": "cost_m_pedestrian",                  
+              "profile": "pedestrian",
+              "optimization": "shortest",
+              "costType": "distance",
+              "costColumn": "cost_m_pedestrian",
               "rcostColumn": "reverse_cost_m_pedestrian",
               "compute": {
                 "storage": {
-                  "file": "/home/docker/config/costs_calculation_sample.json"
+                  "file": "/home/docker/config/costs_calculation.json"
                 },
                 "configuration": {
                   "name": "cost_m_pedestrian",
                   "storage": {
-                    "file": "/home/docker/config/costs_calculation_sample.json"
+                    "file": "/home/docker/config/costs_calculation.json"
                   }
                 }
-              }            
+              }
             }
           ]
         }
@@ -366,7 +361,6 @@
             {
               "id": "waysAttributes",
               "values": [
-                "name",
                 "nom_1_gauche",
                 "nom_1_droite",
                 "cpx_numero",
@@ -404,7 +398,8 @@
               "defaultValueContent": "geojson",
               "values": [
                 "geojson",
-                "polyline"
+                "polyline",
+                "wkt"
               ]
             },
             {
@@ -774,7 +769,8 @@
               "defaultValueContent": "geojson",
               "values": [
                 "geojson",
-                "polyline"
+                "polyline",
+                "wkt"
               ]
             },
             {
diff --git a/docker/config/bduni2smartpgr_idf.json b/docker/config/bduni2smartpgr_idf.json
index 9c3e245..1d620af 100644
--- a/docker/config/bduni2smartpgr_idf.json
+++ b/docker/config/bduni2smartpgr_idf.json
@@ -72,7 +72,7 @@
         },
         {
           "id": "bduni-idf-pgr",
-          "description":"Graphe BDuni au format PGRouting France entière", 
+          "description":"Graphe BDuni au format PGRouting France entière",
           "type": "pgr",
           "projection": "EPSG:4326",
           "bbox": "1.7,48.4,3.3,49.1",
@@ -88,11 +88,6 @@
             "base": {
               "baseId": "base_sortie",
               "attributes": [
-                {
-                  "key": "name",
-                  "column": "way_names",
-                  "default": "false"
-                },
                 {
                   "key": "nom_1_gauche",
                   "column": "nom_1_gauche",
@@ -251,73 +246,73 @@
               "profile": "car",
               "optimization": "fastest",
               "costType": "time",
-              "costColumn": "cost_s_car",                      
+              "costColumn": "cost_s_car",
               "rcostColumn": "reverse_cost_s_car",
               "compute": {
                 "storage": {
-                  "file": "/home/docker/config/costs_calculation_sample.json"
+                  "file": "/home/docker/config/costs_calculation.json"
                 },
                 "configuration": {
                   "name": "cost_s_car",
                   "storage": {
-                    "file": "/home/docker/config/costs_calculation_sample.json"
+                    "file": "/home/docker/config/costs_calculation.json"
                   }
                 }
-              }           
+              }
             },
             {
-              "profile": "car",                               
-              "optimization": "shortest",  
-              "costType": "distance",                    
-              "costColumn": "cost_m_car",                  
+              "profile": "car",
+              "optimization": "shortest",
+              "costType": "distance",
+              "costColumn": "cost_m_car",
               "rcostColumn": "reverse_cost_m_car",
               "compute": {
                 "storage": {
-                  "file": "/home/docker/config/costs_calculation_sample.json"
+                  "file": "/home/docker/config/costs_calculation.json"
                 },
                 "configuration": {
                   "name": "cost_m_car",
                   "storage": {
-                    "file": "/home/docker/config/costs_calculation_sample.json"
+                    "file": "/home/docker/config/costs_calculation.json"
                   }
                 }
-              }            
+              }
             },
             {
-              "profile": "pedestrian",                               
-              "optimization": "fastest",  
-              "costType": "time",                    
-              "costColumn": "cost_s_pedestrian",                  
+              "profile": "pedestrian",
+              "optimization": "fastest",
+              "costType": "time",
+              "costColumn": "cost_s_pedestrian",
               "rcostColumn": "reverse_cost_s_pedestrian",
               "compute": {
                 "storage": {
-                  "file": "/home/docker/config/costs_calculation_sample.json"
+                  "file": "/home/docker/config/costs_calculation.json"
                 },
                 "configuration": {
                   "name": "cost_s_pedestrian",
                   "storage": {
-                    "file": "/home/docker/config/costs_calculation_sample.json"
+                    "file": "/home/docker/config/costs_calculation.json"
                   }
                 }
-              }            
+              }
             },
             {
-              "profile": "pedestrian",                               
-              "optimization": "shortest",  
-              "costType": "distance",                    
-              "costColumn": "cost_m_pedestrian",                  
+              "profile": "pedestrian",
+              "optimization": "shortest",
+              "costType": "distance",
+              "costColumn": "cost_m_pedestrian",
               "rcostColumn": "reverse_cost_m_pedestrian",
               "compute": {
                 "storage": {
-                  "file": "/home/docker/config/costs_calculation_sample.json"
+                  "file": "/home/docker/config/costs_calculation.json"
                 },
                 "configuration": {
                   "name": "cost_m_pedestrian",
                   "storage": {
-                    "file": "/home/docker/config/costs_calculation_sample.json"
+                    "file": "/home/docker/config/costs_calculation.json"
                   }
                 }
-              }            
+              }
             }
           ]
         }
@@ -376,7 +371,6 @@
             {
               "id": "waysAttributes",
               "values": [
-                "name",
                 "nom_1_gauche",
                 "nom_1_droite",
                 "cpx_numero",
@@ -414,7 +408,8 @@
               "defaultValueContent": "geojson",
               "values": [
                 "geojson",
-                "polyline"
+                "polyline",
+                "wkt"
               ]
             },
             {
@@ -713,7 +708,8 @@
               "defaultValueContent": "geojson",
               "values": [
                 "geojson",
-                "polyline"
+                "polyline",
+                "wkt"
               ]
             },
             {
diff --git a/docker/config/costs_calculation_sample.json b/docker/config/costs_calculation.json
similarity index 91%
rename from docker/config/costs_calculation_sample.json
rename to docker/config/costs_calculation.json
index abd1520..aa9207d 100644
--- a/docker/config/costs_calculation_sample.json
+++ b/docker/config/costs_calculation.json
@@ -19,6 +19,11 @@
       "name": "sens",
       "column_name": "direction",
       "mapping": "value"
+    },
+    {
+      "name": "urbain",
+      "column_name": "urbain",
+      "mapping" : { "True": 5, "False": 0}
     }
   ],
   "outputs": [
@@ -43,7 +48,8 @@
       "operations": [
         ["add", "length_m"],
         ["divide", "vitesse_voiture"],
-        ["multiply", 3.6]
+        ["multiply", 3.6],
+        ["add", "urbain"]
       ]
     },
     {
diff --git a/docker/config/data-osm.resource b/docker/config/data-osm.resource
index ba9b6c7..452ef91 100644
--- a/docker/config/data-osm.resource
+++ b/docker/config/data-osm.resource
@@ -67,7 +67,8 @@
           "defaultValueContent": "geojson",
           "values": [
             "geojson",
-            "polyline"
+            "polyline",
+            "wkt"
           ]
         },
         {
diff --git a/docker/debian/Dockerfile b/docker/debian/Dockerfile
index 77b89bc..18ddda9 100644
--- a/docker/debian/Dockerfile
+++ b/docker/debian/Dockerfile
@@ -1,4 +1,4 @@
-FROM python:3.6.13-slim-buster as build
+FROM python:3.10.9-slim-bullseye as build
 
 ### Installation des dépendances
 RUN apt update && apt install -y wget git g++ cmake libboost-dev libboost-filesystem-dev libboost-thread-dev \
@@ -21,18 +21,18 @@ apt-get install -y libgeos-dev libgeos++-dev libluajit-5.1-dev libspatialite-dev
 apt-get install -y libsqlite3-mod-spatialite
 
 WORKDIR /home/prime-server
-RUN apt-get install -y git autoconf automake pkg-config libtool make gcc g++ lcov libcurl4-openssl-dev libzmq3-dev libczmq-dev
+RUN apt-get install -y git cmake autoconf automake pkg-config libtool make gcc g++ lcov libcurl4-openssl-dev libzmq3-dev libczmq-dev
 RUN git clone --depth 1 --recursive https://github.com/kevinkreiser/prime_server.git && cd prime_server && \
-./autogen.sh && ./configure && make && make install
+cmake -B build . && cmake --build build && make -C build install
 
 WORKDIR /home/valhalla/
-RUN pip install conan
-RUN git clone --branch feature-exclude_bridges/tunnels/toll --depth 1 --recursive https://github.com/IGNF/valhalla.git && cd valhalla && \
+RUN pip install --upgrade "conan<2.0.0"
+RUN git clone --branch 3.2.0-with_hard_exclude --depth 1 --recursive https://github.com/IGNF/valhalla.git && cd valhalla && \
 mkdir build && cmake -B build -DCMAKE_BUILD_TYPE=Release && make -C build && make -C build package
 
-FROM python:3.6.13-slim-buster as r2gg
+FROM python:3.10.9-slim-bullseye as r2gg
 
-ENV PYTHON_VERSION "3.6.13"
+ENV PYTHON_VERSION "3.10.9"
 ENV HOME=/home
 
 ### Installation des dépendances pour OSRM
@@ -54,25 +54,33 @@ RUN apt-get install -y git libcurl4-openssl-dev libzmq3-dev libczmq-dev
 COPY --from=build /home/osrm/osrm-backend-5.26.0/build/OSRM-0.1.1-Linux.tar.gz ./
 RUN tar -xzvf OSRM-0.1.1-Linux.tar.gz && cd OSRM-0.1.1-Linux && cp -r bin/* /usr/bin/ && cp -r lib/* /usr/lib/ && cp -r include/* /usr/include/ && cp -r share/* /usr/share/
 
-## Installation prime-server
-COPY --from=build /usr/local/lib/libprime_server.so.0.0.0 /usr/lib/libprime_server.so.0.0.0
+### Installation prime-server
+COPY --from=build /usr/local/lib/libprime_server.so.0.7.0 /usr/lib/libprime_server.so.0.0.0
 COPY --from=build /usr/local/lib/libprime_server.so.0 /usr/lib/libprime_server.so.0
 COPY --from=build /usr/local/lib/libprime_server.so /usr/lib/libprime_server.so
-COPY --from=build /usr/local/lib/libprime_server.la /usr/lib/libprime_server.la
-COPY --from=build /usr/local/lib/libprime_server.a /usr/lib/libprime_server.a
 
 ### Installation de valhalla
-COPY --from=build /home/valhalla/valhalla/build/valhalla-3.1.4-Linux.tar.gz ./
-RUN tar -xzvf valhalla-3.1.4-Linux.tar.gz && cd valhalla-3.1.4-Linux && cp -r bin/* /usr/bin/ && cp -r lib/* /usr/lib/ && cp -r include/* /usr/include/ && cp -r share/* /usr/share/
+COPY --from=build /home/valhalla/valhalla/build/valhalla-3.2.0-Linux.tar.gz ./
+RUN tar -xzvf valhalla-3.2.0-Linux.tar.gz && cd valhalla-3.2.0-Linux && cp -r bin/* /usr/bin/ && cp -r lib/* /usr/lib/ && cp -r include/* /usr/include/ && cp -r share/* /usr/share/
 
-### Installation des dépendances pour R2GG
+### Installation des dépendances pour psycopg2
+RUN apt update && \
+    apt install -y libpq-dev gcc
 #### Dépendances Python
-RUN pip install 'psycopg2-binary==2.8.5' 'sqlparse==0.2.4' 'lxml==4.3.1' 'osmium==3.2.0'
 ### Installation de R2GG
-WORKDIR /usr/lib/python3.6/site-packages/r2gg/r2gg
-COPY r2gg ./
-COPY setup.py ../
-RUN cd ../ && pip install -e .
+WORKDIR /user/app
+
+COPY requirements.txt ./
+COPY requirements/base.txt ./requirements/
+
+RUN python -m pip install --no-cache-dir -U pip && \
+    python -m pip install --no-cache-dir -U setuptools wheel
+
+COPY . ./
+
+RUN python -m pip install -U --no-cache-dir -r requirements.txt
+
+RUN python -m pip install -e .
 
 ### Installation de wget pour l'image
 RUN apt-get install -y wget
@@ -80,7 +88,7 @@ RUN apt-get install -y wget
 ### Opérations pour le fonctionnement de l'image
 #### Récupérations des scripts SQL du dépôt
 WORKDIR /home/docker/sql
-COPY sql/bduni_convert.sql ./bduni_convert.sql
+COPY sql/*.sql ./
 #### Récupération des autres fichiers de configuration
 WORKDIR /home/docker/config
 COPY docker/config/* ./
diff --git a/docker/readme.md b/docker/readme.md
deleted file mode 100644
index 4c1ce67..0000000
--- a/docker/readme.md
+++ /dev/null
@@ -1,8 +0,0 @@
-# Utiliser r2gg avec Docker 
-
-Ce dossier regroupe les différents fichiers permettant d'utiliser r2gg avec docker. 
-
-Les sous-dossiers sont ordonnés ainsi pour des raisons pratiques : 
-- [scripts](./scripts/) : Ce dossier regroupe des scripts utiles dans les différents docker. 
-- [config](./config/) : Ce dossier regroupe plusieurs fichiers de configurations qui se trouvent être communs aux autres sous-dossiers. 
-- [debian](./debian/) : Pour utiliser r2gg sur debian 10
diff --git a/docs/.gitignore b/docs/.gitignore
new file mode 100644
index 0000000..9c5f578
--- /dev/null
+++ b/docs/.gitignore
@@ -0,0 +1,1 @@
+_build
\ No newline at end of file
diff --git a/docs/conf.py b/docs/conf.py
new file mode 100644
index 0000000..eb7d2a9
--- /dev/null
+++ b/docs/conf.py
@@ -0,0 +1,140 @@
+#!python3
+
+"""
+    Configuration for project documentation using Sphinx.
+"""
+
+# standard
+import sys
+from datetime import datetime
+from os import environ, path
+
+sys.path.insert(0, path.abspath(".."))  # move into project package
+
+# project
+from r2gg import __about__
+
+# -- Build environment -----------------------------------------------------
+on_rtd = environ.get("READTHEDOCS", None) == "True"
+
+# -- Project information -----------------------------------------------------
+author = __about__.__author__
+copyright = __about__.__copyright__
+description = __about__.__summary__
+project = __about__.__title__
+version = release = __about__.__version__
+
+# -- General configuration ---------------------------------------------------
+
+# Add any Sphinx extension module names here, as strings. They can be
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
+# ones.
+extensions = [
+    # Sphinx included
+    "sphinx.ext.autosectionlabel",
+    "sphinx.ext.extlinks",
+    "sphinx.ext.githubpages",
+    "sphinx.ext.imgmath",
+    "sphinx.ext.intersphinx",
+    "sphinx.ext.viewcode",
+    # 3rd party
+    "myst_parser",
+    "sphinx_copybutton",
+    "sphinx.ext.napoleon",
+]
+
+# The suffix(es) of source filenames.
+# You can specify multiple suffix as a list of string:
+source_suffix = {".md": "markdown", ".rst": "restructuredtext"}
+autosectionlabel_prefix_document = True
+# The master toctree document.
+master_doc = "index"
+
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+# This pattern also affects html_static_path and html_extra_path .
+exclude_patterns = [
+    "_build",
+    "*.csv",
+    "samples/*",
+    "Thumbs.db",
+    ".DS_Store",
+    "*env*",
+    "libs/*",
+    "*.xml",
+    "input/*",
+    "output/*",
+]
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = "sphinx"
+
+
+# -- Options for HTML output -------------------------------------------------
+
+# -- Theme
+
+#html_favicon = str(__about__.__icon_path__)
+#html_logo = str(__about__.__icon_path__)
+html_theme = "furo"
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+# html_static_path = ["static"]
+
+# Custom sidebar templates, must be a dictionary that maps document names
+# to template names.
+#
+# The default sidebars (for documents that don't match any pattern) are
+# defined by theme itself.  Builtin themes are using these templates by
+# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
+# 'searchbox.html']``.
+#
+# html_sidebars = {
+#     "**": ["globaltoc.html", "relations.html", "sourcelink.html", "searchbox.html"]
+# }
+
+# Language to be used for generating the HTML full-text search index.
+# Sphinx supports the following languages:
+#   'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
+#   'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
+html_search_language = "fr"
+
+# Example configuration for intersphinx: refer to the Python standard library.
+intersphinx_mapping = {
+    "python": ("https://docs.python.org/3/", None),
+}
+
+# -- Extension configuration -------------------------------------------------
+
+
+# MyST Parser
+myst_enable_extensions = [
+    "amsmath",
+    "colon_fence",
+    "deflist",
+    "dollarmath",
+    "html_image",
+    "linkify",
+    "replacements",
+    "smartquotes",
+    "substitution",
+]
+
+myst_heading_anchors = 3
+
+# replacement variables
+myst_substitutions = {
+    "author": author,
+    "date_update": datetime.now().strftime("%d %B %Y"),
+    "description": description,
+    "repo_branch": "master",
+    "repo_url": __about__.__uri__,
+    "title": project,
+    "version": version,
+}
+
+
+myst_url_schemes = ("http", "https", "mailto")
diff --git a/docs/development/documentation.md b/docs/development/documentation.md
new file mode 100644
index 0000000..de0168a
--- /dev/null
+++ b/docs/development/documentation.md
@@ -0,0 +1,28 @@
+# Documentation
+
+Sphinx est utilisé pour la génération de la documentation depuis des pages écrites en Markdown (via le [parser MyST](https://myst-parser.readthedocs.io/en/latest/)).
+
+## Génération du site web de documentation
+
+Pour la génération:
+
+```bash
+# install base dependencies
+python -m pip install -U -r requirements/base.txt
+# install aditionnal dependencies
+python -m pip install -U -r requirements/documentation.txt
+# build it
+sphinx-build -b html docs docs/_build
+# optimized (quiet, multiprocessing, doctrees separated)
+sphinx-build -b html -d docs/_build/cache -j auto -q docs docs/_build/html
+```
+
+Ouvrir `docs/_build/index.html` dans un navigateur web.
+
+## Ecrire la documentation avec un rendu en direct
+
+```bash
+sphinx-autobuild -b html -d docs/_build/cache docs/ docs/_build
+```
+
+Ouvrir <http://localhost:8000> dans un navigateur web pour voir le rendu HTML mis à jour quand un fichier est sauvegardé.
diff --git a/docs/development/history.md b/docs/development/history.md
new file mode 100644
index 0000000..9553e9f
--- /dev/null
+++ b/docs/development/history.md
@@ -0,0 +1,2 @@
+```{include} ../../changelog.md
+```
\ No newline at end of file
diff --git a/docker/debian/readme.md b/docs/docker/debian/readme.md
similarity index 100%
rename from docker/debian/readme.md
rename to docs/docker/debian/readme.md
diff --git a/docs/docker/readme.md b/docs/docker/readme.md
new file mode 100644
index 0000000..f407eea
--- /dev/null
+++ b/docs/docker/readme.md
@@ -0,0 +1,8 @@
+# Utiliser r2gg avec Docker 
+
+Le dossier {{ '[docker]({}tree/{}/docker)'.format(repo_url, repo_branch) }} regroupe les différents fichiers permettant d'utiliser r2gg avec docker. 
+
+Les sous-dossiers sont ordonnés ainsi pour des raisons pratiques : 
+- {{ '[scripts]({}tree/{}/docker/scripts)'.format(repo_url, repo_branch) }} : Ce dossier regroupe des scripts utiles dans les différents docker. 
+- {{ '[config]({}tree/{}/docker/config)'.format(repo_url, repo_branch) }} : Ce dossier regroupe plusieurs fichiers de configurations qui se trouvent être communs aux autres sous-dossiers. 
+- [debian](./debian/readme.md) : Pour utiliser r2gg sur debian 10
diff --git a/docs/index.md b/docs/index.md
new file mode 100644
index 0000000..0878c7c
--- /dev/null
+++ b/docs/index.md
@@ -0,0 +1,48 @@
+# {{ title }} - Documentation
+
+> **Description:** {{ description }}  
+> **Auteur et contributeurs:** {{ author }}  
+> **Version:** {{ version }}  
+> **Code source:** {{ repo_url }}  
+> **Dernière mise à jour de la documentation:** {{ date_update }}
+
+## Présentation 
+
+Route Graph Generator (r2gg) est un script Python qui permet la génération de graphes pour des moteurs de calcul d'itinéraire. Il a été développé pour générer les données directement utilisable par [Road2](https://github.com/IGNF/road2). 
+
+Actuellement, il y a trois formats de sortie : OSRM, pgRouting et Valhalla. 
+
+La conversion se fait via les fonctions de la bibliothèque r2gg développée dans ce but. Une documentation plus détaillée des fonctions de r2gg est consultable [ici](./usage/r2gg.md).
+
+---
+
+```{toctree}
+---
+caption: Route Graph Generator
+---
+R2GG <usage/r2gg>
+Configuration <usage/configuration>
+```
+
+```{toctree}
+---
+caption: Utilisation avec Docker
+---
+Utiliser r2gg avec Docker <docker/readme>
+R2GG sur Debian <docker/debian/readme>
+```
+
+```{toctree}
+---
+caption: SQL
+---
+Scripts SQL <sql/readme>
+```
+
+```{toctree}
+---
+caption: Développement
+---
+Documentation <development/documentation>
+Changelog <development/history>
+```
diff --git a/sql/readme.md b/docs/sql/readme.md
similarity index 78%
rename from sql/readme.md
rename to docs/sql/readme.md
index e045694..b6f7040 100644
--- a/sql/readme.md
+++ b/docs/sql/readme.md
@@ -1,9 +1,9 @@
 # Scripts SQL
 
-Les scripts SQL doivent permettre la conversion d'une base de données sources vers un format pivot.
+Les {{ '[scripts SQL]({}tree/{}/sql)'.format(repo_url, repo_branch) }} doivent permettre la conversion d'une base de données sources vers un format pivot.
 Les spécifications de ce dernier sont les suivantes :
 
-### Table "nodes"
+## Table "nodes"
 
 ```sql
 CREATE TABLE IF NOT EXISTS nodes (
@@ -15,7 +15,7 @@ CREATE TABLE IF NOT EXISTS nodes (
 );
 ```
 
-### Table "edges"
+## Table "edges"
 
 ```sql
 CREATE TABLE IF NOT EXISTS edges (
diff --git a/io/readme.md b/docs/usage/configuration.md
similarity index 83%
rename from io/readme.md
rename to docs/usage/configuration.md
index 5c9cdee..689b91f 100644
--- a/io/readme.md
+++ b/docs/usage/configuration.md
@@ -1,19 +1,25 @@
 # Fichiers de configuration de route-graph-generator
 
 ## Fichier principal
+
 Ce fichier de configuration est conséquent, pour le comprendre il est conseillé de lire ses spécifications et ses exemples.
 
 ### Exemple
+
 Plusieurs exemples sont présents dans le dossier `docker/config/`.
 
 ## Configuration des logs
-#### Attribut "level"
+
+### Attribut "level"
+
 Niveau d'importance des logs à enregistrer. Doit avoir comme valeur l'un de `CRITICAL` `ERROR` `WARNING` `INFO` `DEBUG`.
 
-#### Attribut "filename"
+### Attribut "filename"
+
 Fichier où enregistrer les logs. Chemin absolu conseillé.
 
-#### Exemple
+### Exemple
+
 ```json
 {
 	"level": "DEBUG",
@@ -22,22 +28,29 @@ Fichier où enregistrer les logs. Chemin absolu conseillé.
 ```
 
 ## Configuration des bases de données
-#### Attribut "host"
+
+### Attribut "host"
+
 Adresse du serveur de base de données.
 
-#### Attribut "port"
+### Attribut "port"
+
 Port du serveur de base de données.
 
-#### Attribut "database"
+### Attribut "database"
+
 Nom de la base de données concernée.
 
-#### Attribut "user"
+### Attribut "user"
+
 Nom d'utilisateur.
 
-#### Attribut "password"
+### Attribut "password"
+
 Mot de passe
 
-#### Exemple
+### Exemple
+
 ```json
 {
 	"host": "host",
@@ -49,18 +62,24 @@ Mot de passe
 ```
 
 ## Configuration des coûts
+
 Afin de configurer les coûts pour pgRouting, et désormais également pour OSRM, il a été défini un format statique basé sur du JSON permettant de réaliser le calcul de ces coûts
+
 ### Attribut "variables"
+
 Il s'agit d'une liste de "variables", c'est-à-dire de valeurs qui sont utilisées pour le calcul des coûts, définies à partir de colonnes de la table en entrée.
 Chaque élément de la liste a plusieurs attributs :
 
-#### Attribut "name"
+### Attribut "name"
+
 Nom de la varaible, permettant de l'identifier dans le calcul des coûts.
 
-#### Attribut "column_name"
+### Attribut "column_name"
+
 Nom de la colonne dans la base en entrée correspondant à la valeur.
 
-#### Attribut "mapping"
+### Attribut "mapping"
+
 Valeur que doit prendre la varaible en fonction de la valeur retournée par le SQL. Il s'agit soit de la chaîne de caractère `"value"`, soit d'un objet JSON. Dans le premier cas, la valeur de la variable est la valeur retournée par l'instruction SQL. Dans le second cas, il est défini un mapping valeur SQL vers valeur de la variable. Par exemple :
 ```json
 "mapping": {
@@ -72,38 +91,48 @@ Valeur que doit prendre la varaible en fonction de la valeur retournée par le S
 Ce mapping permet de traduire une valeur en lettres en SLQ en une valeur chiffrée pour la varaible. Le mapping devra comporter toutes les valeurs pouvant être prise par le résultat de la requête SQL.
 
 ### Attribut "outputs"
+
 Il s'agit d'une liste d'"outputs", c'est-à-dire des colonnes dans la table de sortie qui correspondront à des coûts. Chaque élément de la lite a plusieurs attributs.
-#### Attribut "name"
+
+### Attribut "name"
+
 Nom de la colonne de coûts résultante.
 
-#### Attribut "speed_value"
+### Attribut "speed_value"
+
 Nom de la varaible correspondant à la vitesse de ce coût OU valeur numérique
 
-#### Attributs "direct_conditions" et "reverse_conditions"
+### Attributs "direct_conditions" et "reverse_conditions"
+
 Chaînes de caractères définissant des conditions toutes nécessaires pour la circulabilité des tronçons, séparés par des points-virgules `;`.
 Si toutes les conditions ne sont pas vérifiées, le tronçon n'est pas praticable.
 Si aucune condition n'est spécifiée, le tronçon est praticable.
 
 L'attribut `direct_condition` correspond au sens direct de parcours du graphe, l'attribut `reverse_condition` correspond au sens inverse de parcours du graphe.
 
-##### Exemple
+#### Exemple
+
 ```json
 "direct_condition": "sens>=0;vitesse>0",
 "reverse_condition": "sens<=0;vitesse>0"
 ```
 
-#### Attribut "turn_restrictions"
+### Attribut "turn_restrictions"
+
 Booléen, indique s'il faut prendre en compte les restrictions de virage (non_communication dans la bd uni) pour le calcul d'itinéraire
 
-#### Attribut "cost_type"
+### Attribut "cost_type"
+
 Type du coût (OSRM). Pour l'instant, parmi {'distance', 'duration'}
 
-#### Attribut "operations"
+### Attribut "operations"
+
 Il s'agit d'une liste d'opérations à réaliser pour obtenir le coût. Les opérations sont réalisées dans l'odre de la liste, à partir du nombre 0 (la première opération est donc toujours une addition ou une soustraction).
 
 Les opérations sont des lites de 2 éléments. Le premier est une chaîne de caractères parmi `"add"` `"substract"` `"multiply"` et `"divide"`, et le scond est soit une chaîne de caractère, soint un nombre. Dans le premiers cas, la chaîne de caractères est le nom d'une variable. __Attention aux divisions par zéro.__
 
-##### Exemple d'operations - calcul du temps en fonction de la longueur et de la vitesse :
+#### Exemple d'operations - calcul du temps en fonction de la longueur et de la vitesse :
+
 ```json
 "operations": [
     ["add", "length_m"],
@@ -113,10 +142,13 @@ Les opérations sont des lites de 2 éléments. Le premier est une chaîne de ca
 ```
 
 ### Exemple
-Un exemple complet est présent dans le dossier [io](./costs_calculation_sample.json).
+
+Un exemple complet est présent dans le dossier {{ '[docker/config]({}blob/{}/docker/config/costs_calculation.json)'.format(repo_url, repo_branch) }}.
 
 ## Configuration des profils (OSRM)
+
 La configuration des profils OSRM se fait _via_ des fonctions écrites en LUA. Se référer à la [documentation officielle](https://github.com/Project-OSRM/osrm-backend/blob/master/docs/profiles.md). Ces fichiers sont générés à la volée à partir du fichier JSON de configuration des coûts.
 
-#### Exemple
-Des exemples complets sont présents dans le dossier [lua](../lua).
+### Exemple
+
+Un exemple complet est présent dans le dossier {{ '[io]({}blob/{}/io/graph_bdtopo.lua)'.format(repo_url, repo_branch) }}.
diff --git a/r2gg/readme.md b/docs/usage/r2gg.md
similarity index 93%
rename from r2gg/readme.md
rename to docs/usage/r2gg.md
index 820eae5..0aa723c 100644
--- a/r2gg/readme.md
+++ b/docs/usage/r2gg.md
@@ -7,7 +7,7 @@ Bibliothèque de scripts Python permettant la génération de graphs utilisables
 Les fonctions publiques exposées par r2gg permettent de réaliser les trois processus des scripts de génération. Les fonctions utile à une génération complète peuvent être lancées via la commande suivante :
 `python3 r2gg.fonction config.json`
 
-Au passage, ces fonctions ont toutes besoin d'un fichier de configuration (décrit [ici](../io)) pour pouvoir fonctionner. Des exemples sont dans disponibles [ici](../docker/config/).
+Au passage, ces fonctions ont toutes besoin d'un fichier de configuration (décrit [ici](./configuration.md)) pour pouvoir fonctionner. Des exemples sont disponibles dans le dossier {{ '[docker/config]({}/tree/{}/docker/config)'.format(repo_url, repo_branch) }}.
 
 Mais on peut décider de n'en lancer que certaines selon le résultat que l'on souhaite obtenir. 
 
diff --git a/io/generation_model_osrm.yaml b/io/generation_model_osrm.yaml
index 478b161..f201a9a 100644
--- a/io/generation_model_osrm.yaml
+++ b/io/generation_model_osrm.yaml
@@ -63,23 +63,48 @@
           "configFile":
             type: string
             required: true
-    # Information pour pouvoir se connecter, lire et écrire dans un cluster CEPH
-    "ceph":
+          # Schema utilisé dans la base 
+          "schema":
+            type: string
+            required: true
+            # Informations sur les résultats de la génération.
+    "outputs":
       type: object
-      required: false
+      required: true
       properties:
-        # Nom du cluster
-        "clusterName":
-          type: string
-          required: true
-        # Nom de l'utilisateur
-        "userName":
-          type: string
-          required: true
-        # Fichier de configuration
-        "configFile":
-          type: string
+        # La génération doit produire un fichier de ressource utilisable par l'application de calcul d'itinéraire.
+        "configurations":
+          type: object
           required: true
+          properties:
+            # Information sur la ressource 
+            "resource":
+              type: object
+              required: true
+              properties:
+                # Stockage du fichier de configuration.
+                "storage":
+                  type: object
+                  required: true
+                  properties:
+                    # Dossier contenant les configurations
+                    "directory":
+                      type: string
+                      required: true
+            # Information sur les sources 
+            "sources":
+              type: object
+              required: true
+              properties:
+                # Stockage du fichier de configuration.
+                "storage":
+                  type: object
+                  required: true
+                  properties:
+                    # Dossier contenant les configurations
+                    "directory":
+                      type: string
+                      required: true
     # Espace de travail nécessaire à l'application pour travailler. Il faut un endroit sur disque où écrire et une base de données accessible en écriture.
     "workingSpace":
       type: object
@@ -108,60 +133,6 @@
         "description":
           type: string
           required: true
-        # Informations sur la topologie de la ressource
-        "topology":
-          type: object
-          required: true
-          properties:
-            # id de la topologie, utile pour la charger une seule fois dans Road2
-            "id":
-              type: string
-              required: true
-            # Type de la topologie
-            "type":
-              type: string
-              required: true
-            # Description de la topologie
-            "description":
-              type: string
-              required: true
-            # Stockage de la topologie
-            "storage":
-              $ref: "#/components/schemas/storage"
-              required: true
-            # Projection des données sources
-            "projection":
-              type: string
-              required: true
-            # Bbox des données de la topologie, pas nécessairement la même que pour la ressource
-            "bbox":
-              type: string
-              required: true
-            # Pour faire le lien entre une bdd source et les informations utiles pour générer un graphe, il faut indiquer un fichier SQL qui va lire la base, extraire les données et les formater pour les scripts de génération.
-            "mapping":
-              type: object
-              required: true
-              properties:
-                # Source des données, il s'agit de l'id d'une base de données
-                "source":
-                  type: object
-                  required: true
-                  properties:
-                    # Id de la base de données qui doit être présentes dans les bases de ce fichier
-                    "baseId":
-                      type: string
-                      required: true
-                # Emplacement du script SQL
-                "storage":
-                  $ref: "#/components/schemas/storage"
-                  required: true
-            # Liste des attributs qui seront des attributs par défaut pour la ressource
-                  "defaultAttributes":
-                    type: array
-                    required: false
-                    minItems: 1
-                    items:
-              type: "string"
         # Liste des sources qui vont être générées
         "sources":
           type: array
@@ -178,10 +149,50 @@
               "type":
                 type: string
                 required: true
+              # Description de la source
+              "description":
+                type: string
+                required: true
+              # Projection des données sources
+              "projection":
+                type: string
+                required: true
+              # Bbox des données de la topologie, pas nécessairement la même que pour la ressource
+              "bbox":
+                type: string
+                required: true
+              # Pour faire le lien entre une bdd source et les informations utiles pour générer un graphe, il faut indiquer un fichier SQL qui va lire la base, extraire les données et les formater pour les scripts de génération.
+              "mapping":
+                type: object
+                required: true
+                properties:
+                  # Source des données, il s'agit de l'id d'une base de données
+                  "source":
+                    type: object
+                    required: true
+                    properties:
+                      # Id de la base de données qui doit être présentes dans les bases de ce fichier
+                      "baseId":
+                        type: string
+                        required: true
+                  # Emplacement du script SQL utilisé pour créer la base pivot
+                  "conversion":
+                    type: object
+                    required: true
+                    properties:
+                      # Fichier SQL utilisé pour créer la base pivot
+                      "file":
+                        type: string
+                        required: true
               # Stockage de la source, du .osrm en l'occurence
               "storage":
-                $ref: "#/components/schemas/storage"
-                required: true
+                type: object
+                    required: true
+                    properties:
+                      # Fichier .osrm
+                      "file":
+                        type: string
+                        required: true
               # Coûts qui seront calculés sur la topologie précisée précedemment. On peut en avoir plusieurs.
               "cost":
                 type: object
@@ -244,44 +255,14 @@
                   "values":
                     type: string or array or object
                     required: true
-        # Informations sur les résultats de la génération.
-        "outputs":
-          type: object
-          required: true
-          properties:
-            # La génération doit produire un fichier de ressource utilisable par l'application de calcul d'itinéraire.
-            "configuration":
-              type: object
-              required: true
-              properties:
-                # Stockage du fichier de configuration.
-                "storage":
-                  $ref: "#/components/schemas/storage"
-                  required: true
-        # Dossiers utilisés à la fin de la génération pour mettre les données au bons emplacements
-        "dirs":
-          type: object
-          required: false
-          properties:
-            # Dossier final des données
-            "dataDir":
-              type: string
-              required: true
-            # Dossier pour les profiles
-            "profileDir":
-              type: string
-              required: true
-            # Dossier pour les ressources
-            "resourceDir":
-              type: string
-              required: true
+
 components:
   schemas:
-    # storage d'un document: fichier ou ceph
+    # storage d'un document: fichier 
     "storage":
       type: object
       properties:
-          # Fichier
+        # Fichier
         "file":
           type: string
               required: false
diff --git a/io/generation_model_pgr.yaml b/io/generation_model_pgr.yaml
index 05d5b7c..869c4bf 100644
--- a/io/generation_model_pgr.yaml
+++ b/io/generation_model_pgr.yaml
@@ -1,4 +1,4 @@
-# Description d'un fichier de configuration de génération pour des ressources OSRM
+# Description d'un fichier de configuration de génération pour des ressources PGR
 
 # Une génération est un objet qui contient toutes les informations utiles pour que les scripts de génération puissent créer une ressource.
 "generation":
@@ -63,23 +63,48 @@
           "configFile":
             type: string
             required: true
-    # Information pour pouvoir se connecter, lire et écrire dans un cluster CEPH
-    "ceph":
+          # Schema utilisé dans la base 
+          "schema":
+            type: string
+            required: true
+            # Informations sur les résultats de la génération.
+    "outputs":
       type: object
-      required: false
+      required: true
       properties:
-        # Nom du cluster
-        "clusterName":
-          type: string
-          required: true
-        # Nom de l'utilisateur
-        "userName":
-          type: string
-          required: true
-        # Fichier de configuration
-        "configFile":
-          type: string
+        # La génération doit produire un fichier de ressource utilisable par l'application de calcul d'itinéraire.
+        "configurations":
+          type: object
           required: true
+          properties:
+            # Information sur la ressource 
+            "resource":
+              type: object
+              required: true
+              properties:
+                # Stockage du fichier de configuration.
+                "storage":
+                  type: object
+                  required: true
+                  properties:
+                    # Dossier contenant les configurations
+                    "directory":
+                      type: string
+                      required: true
+            # Information sur les sources 
+            "sources":
+              type: object
+              required: true
+              properties:
+                # Stockage du fichier de configuration.
+                "storage":
+                  type: object
+                  required: true
+                  properties:
+                    # Dossier contenant les configurations
+                    "directory":
+                      type: string
+                      required: true
     # Espace de travail nécessaire à l'application pour travailler. Il faut un endroit sur disque où écrire et une base de données accessible en écriture.
     "workingSpace":
       type: object
@@ -100,7 +125,7 @@
         "id":
           type: string
           required: true
-        # Type de la ressource, pge dans ce cas
+        # Type de la ressource, osrm dans ce cas
         "type":
           type: string
           required: true
@@ -108,97 +133,6 @@
         "description":
           type: string
           required: true
-        # Informations sur la topologie de la ressource
-        "topology":
-          type: object
-          required: true
-          properties:
-            # id de la topologie, utile pour la charger une seule fois dans Road2
-            "id":
-              type: string
-              required: true
-            # Type de la topologie
-            "type":
-              type: string
-              required: true
-            # Description de la topologie
-            "description":
-              type: string
-              required: true
-            # Stockage de la topologie
-            "storage":
-              type: object
-              required: true
-              properties:
-                # Id de la base utilisée en sortie, utile que pour r2gg
-                "baseId":
-                  type: string
-                  required: true
-                # Information sur la base qui contient la topologie
-                "base":
-                  type: object
-                  required: true
-                  properties:
-                    # Fichier de configuration pour se connecter à la base de données, utile que pour Road2
-                    "dbConfig":
-                      type: string
-                      required: true
-                    # Schéma dans la base de données
-                    "schema":
-                      type: string
-                      required: true
-                    # Liste des attributs de le topologie disponibles dans la réponse
-                    "attributes":
-                      type: array
-                      required: false
-                      items:
-                        type: object
-                        properties:
-                          # Clé utilisée par le client de l'api
-                          "key":
-                            type: string
-                            required: true
-                          # Nom de la colonne dans la base de donnés
-                          "column":
-                            type: string
-                            required: true
-                          # Indique si l'attribut est présent par défaut dans la réponse, "true" ou "false"
-                          "default":
-                            type: string
-                            required: true
-            # Projection des données sources
-            "projection":
-              type: string
-              required: true
-            # Bbox des données de la topologie, pas nécessairement la même que pour la ressource
-            "bbox":
-              type: string
-              required: true
-            # Pour faire le lien entre une bdd source et les informations utiles pour générer un graphe, il faut indiquer un fichier SQL qui va lire la base, extraire les données et les formater pour les scripts de génération.
-            "mapping":
-              type: object
-              required: true
-              properties:
-                # Source des données, il s'agit de l'id d'une base de données
-                "source":
-                  type: object
-                  required: true
-                  properties:
-                    # Id de la base de données qui doit être présentes dans les bases de ce fichier
-                    "baseId":
-                      type: string
-                      required: true
-                # Emplacement du script SQL
-                "storage":
-                  $ref: "#/components/schemas/storage"
-                  required: true
-            # Liste des attributs qui seront des attributs par défaut pour la ressource
-                  "defaultAttributes":
-                    type: array
-                    required: false
-                    minItems: 1
-                    items:
-              type: "string"
         # Liste des sources qui vont être générées
         "sources":
           type: array
@@ -215,56 +149,122 @@
               "type":
                 type: string
                 required: true
-              # Stockage de la source, du .osrm en l'occurence
-              "storage":
-                type: object
+              # Description de la source
+              "description":
+                type: string
                 required: true
-                properties:
-                  # Fichier de configuration de la base de données
-                  "dbConfig":
-                    type: string
-                    required: true
-                  # Colonne des coûts
-                  "costColumn":
-                    type: string
-                    required: true
-                  # Colonne des coûts inverse
-                  "rcostColumn":
-                    type: string
-                    required: true
-              # Coûts qui seront calculés sur la topologie précisée précedemment. On peut en avoir plusieurs.
-              "cost":
+              # Projection des données sources
+              "projection":
+                type: string
+                required: true
+              # Bbox des données de la topologie, pas nécessairement la même que pour la ressource
+              "bbox":
+                type: string
+                required: true
+              # Pour faire le lien entre une bdd source et les informations utiles pour générer un graphe, il faut indiquer un fichier SQL qui va lire la base, extraire les données et les formater pour les scripts de génération.
+              "mapping":
                 type: object
                 required: true
                 properties:
-                  # Chaque coût correspond à un profil
-                  "profile":
-                    type: string
-                    required: true
-                  # Chaque coût correspond à un profil
-                  "optmization":
-                    type: string
-                    required: true
-                  # Fichier permettant de calculer le coût
-                  "compute":
+                  # Source des données, il s'agit de l'id d'une base de données
+                  "source":
                     type: object
                     required: true
                     properties:
-                      # Stockage du fichier permettant de calculer le coût
-                      "storage":
-                        $ref: "#/components/schemas/storage"
-                  # Configuration pour le calcul des couts
-                  "configuration":
+                      # Id de la base de données qui doit être présentes dans les bases de ce fichier
+                      "baseId":
+                        type: string
+                        required: true
+                  # Emplacement du script SQL utilisé pour créer la base pivot
+                  "conversion":
                     type: object
                     required: true
                     properties:
-                      # Nom du coût dans le fichier de configuration
-                      "name":
+                      # Fichier SQL utilisé pour créer la base pivot
+                      "file":
+                        type: string
+                        required: true
+              # Stockage de la source, de la BDD ici
+              "storage":
+                type: object
+                    required: true
+                    properties:
+                      # BDD
+                      "base":
+                        type: object
+                        required: true
+                        properties:
+                          # Id de la base, doit exister dans bases
+                          "baseId":
+                            type: string
+                            required: true
+                          # Attributs, permet de faire le lien entre les attributs requêtables et la BDD
+                          "attributes":
+                            type: array
+                            minItems: 1
+                            items:
+                              type: object
+                              properties:
+                                # Clé pour les requêtes Road2
+                                "key":
+                                  type: string
+                                  required: true
+                                # Nom de la colonne dans la base
+                                "column":
+                                  type: string
+                                  required: true
+                                # Indiquer si cet attribut est présent par défaut dans la réponse de la ressource Road2 générée
+                                "default":
+                                  type: string
+                                  required: true
+              # Coûts qui seront calculés sur la topologie précisée précedemment. On peut en avoir plusieurs.
+              "costs":
+                type: array
+                minItems: 1
+                items:
+                  type: object
+                  required: true
+                  properties:
+                      # Chaque coût correspond à un profil
+                      "profile":
+                        type: string
+                        required: true
+                      # Chaque coût correspond à un profil
+                      "optmization":
+                        type: string
+                        required: true
+                      # Chaque coût correspond à un costType pour les isochrones
+                      "costType":
+                        type: string
+                        required: true
+                      # Chaque coût correspond à une colonne de coût dans la base
+                      "costColumn":
+                        type: string
+                        required: true
+                      # Chaque coût correspond à une colonne de coût inverse dans la base
+                      "rcostColumn":
                         type: string
                         required: true
-                      # Stockage du fichier de calcul des couts. C'est un JSON.
-                      "storage":
-                        $ref: "#/components/schemas/storage"
+                      # Fichier permettant de calculer le coût
+                      "compute":
+                        type: object
+                        required: true
+                        properties:
+                          # Stockage du fichier permettant de calculer le coût
+                          "storage":
+                            $ref: "#/components/schemas/storage"
+                      # Configuration pour le calcul des couts
+                      "configuration":
+                        type: object
+                        required: true
+                        properties:
+                          # Nom du coût dans le fichier de configuration
+                          "name":
+                            type: string
+                            required: true
+                          # Stockage du fichier de calcul des couts. C'est un JSON.
+                          "storage":
+                            $ref: "#/components/schemas/storage"
         # Informations sur les opérations autorisées sur la ressource qui va être générée.
         "availableOperations":
           type: array
@@ -294,44 +294,14 @@
                   "values":
                     type: string or array or object
                     required: true
-        # Informations sur les résultats de la génération.
-        "outputs":
-          type: object
-          required: true
-          properties:
-            # La génération doit produire un fichier de ressource utilisable par l'application de calcul d'itinéraire.
-            "configuration":
-              type: object
-              required: true
-              properties:
-                # Stockage du fichier de configuration.
-                "storage":
-                  $ref: "#/components/schemas/storage"
-                  required: true
-        # Dossiers utilisés à la fin de la génération pour mettre les données au bons emplacements
-        "dirs":
-          type: object
-          required: false
-          properties:
-            # Dossier final des données
-            "dataDir":
-              type: string
-              required: true
-            # Dossier pour les profiles
-            "profileDir":
-              type: string
-              required: true
-            # Dossier pour les ressources
-            "resourceDir":
-              type: string
-              required: true
+
 components:
   schemas:
-    # storage d'un document: fichier ou ceph
+    # storage d'un document: fichier 
     "storage":
       type: object
       properties:
-          # Fichier
+        # Fichier
         "file":
           type: string
               required: false
diff --git a/io/generation_model_valhalla.yaml b/io/generation_model_valhalla.yaml
new file mode 100644
index 0000000..a1e056c
--- /dev/null
+++ b/io/generation_model_valhalla.yaml
@@ -0,0 +1,287 @@
+# Description d'un fichier de configuration de génération pour des ressources valhalla
+
+# Une génération est un objet qui contient toutes les informations utiles pour que les scripts de génération puissent créer une ressource.
+"generation":
+  type: object
+  required: true
+  properties:
+    # Généralités sur la génération
+    "general":
+      type: object
+      required: true
+      properties:
+        # Id de la génération
+        "id":
+          type: string
+          required: true
+        # Gestion des logs
+        "logs":
+          type: object
+          required: true
+          properties:
+            # Emplacement du fichier de configuration des logs
+            "configFile":
+              type: string
+              required: true
+        # Gestion de la parallélisation
+        "parallelization":
+          type: object
+          required: false
+          properties:
+            # Nombre de thread utilisable
+            "threads":
+              type: number
+              format: integer
+              required: true
+        # Gestion de la reprise sur erreur
+        "overwrite":
+          type: "boolean"
+          required: false
+        # Permet d'indiquer si la génération va partir de 0 ou s'il s'agit de mettre à jour une ressource déjà existante
+        "operation":
+        type: string
+        required: true
+        enum: {"creation","update"}
+    # Informations sur les bases de données qui seront utilisées pour la génération
+    "bases":
+      type: array
+      required: true
+      minItems: 1
+      items:
+        type: object
+        properties:
+          # Id de la base qui va être utile dans la suite de la configuration
+          "id":
+            type: string
+            required: true
+          # Type de base, pour le moment, il n'y aura que des bases de données
+          "type":
+            type: string
+            required: true
+            enum: ["bdd"]
+          # Fichier de configuration contenant toutes les informations pour se connecter à la base
+          "configFile":
+            type: string
+            required: true
+          # Schema utilisé dans la base 
+          "schema":
+            type: string
+            required: true
+            # Informations sur les résultats de la génération.
+    "outputs":
+      type: object
+      required: true
+      properties:
+        # La génération doit produire un fichier de ressource utilisable par l'application de calcul d'itinéraire.
+        "configurations":
+          type: object
+          required: true
+          properties:
+            # Information sur la ressource 
+            "resource":
+              type: object
+              required: true
+              properties:
+                # Stockage du fichier de configuration.
+                "storage":
+                  type: object
+                  required: true
+                  properties:
+                    # Dossier contenant les configurations
+                    "directory":
+                      type: string
+                      required: true
+            # Information sur les sources 
+            "sources":
+              type: object
+              required: true
+              properties:
+                # Stockage du fichier de configuration.
+                "storage":
+                  type: object
+                  required: true
+                  properties:
+                    # Dossier contenant les configurations
+                    "directory":
+                      type: string
+                      required: true
+    # Espace de travail nécessaire à l'application pour travailler. Il faut un endroit sur disque où écrire et une base de données accessible en écriture.
+    "workingSpace":
+      type: object
+      required: true
+      properties:
+        "directory":
+          type: string
+          required: true
+        "baseId":
+          type: string
+          required: true
+    # Information sur la ressource générée. La plupart de ces informations permettront de générer le fichier de ressource utilisable par l'application de calcul d'itinéraire.
+    "resource":
+      type: object
+      required: true
+      properties:
+        # Id de la ressource
+        "id":
+          type: string
+          required: true
+        # Type de la ressource, osrm dans ce cas
+        "type":
+          type: string
+          required: true
+        # Description de la ressource
+        "description":
+          type: string
+          required: true
+        # Liste des sources qui vont être générées
+        "sources":
+          type: array
+          required: true
+          minItems: 1
+          items:
+            type: object
+            properties:
+              # id de la source, utile pour la charger une seule fois dans Road2.
+              "id":
+                type: string
+                required: true
+              # Type de la source, ici ce doit être osrm
+              "type":
+                type: string
+                required: true
+              # Description de la source
+              "description":
+                type: string
+                required: true
+              # Projection des données sources
+              "projection":
+                type: string
+                required: true
+              # Bbox des données de la topologie, pas nécessairement la même que pour la ressource
+              "bbox":
+                type: string
+                required: true
+              # Pour faire le lien entre une bdd source et les informations utiles pour générer un graphe, il faut indiquer un fichier SQL qui va lire la base, extraire les données et les formater pour les scripts de génération.
+              "mapping":
+                type: object
+                required: true
+                properties:
+                  # Source des données, il s'agit de l'id d'une base de données
+                  "source":
+                    type: object
+                    required: true
+                    properties:
+                      # Id de la base de données qui doit être présentes dans les bases de ce fichier
+                      "baseId":
+                        type: string
+                        required: true
+                  # Emplacement du script SQL utilisé pour créer la base pivot
+                  "conversion":
+                    type: object
+                    required: true
+                    properties:
+                      # Fichier SQL utilisé pour créer la base pivot
+                      "file":
+                        type: string
+                        required: true
+              # Stockage de la source, de la BDD ici
+              "storage":
+                type: object
+                    required: true
+                    properties:
+                      # Emplacement des tuiles générées 
+                      "tar":
+                        type: string
+                        required: true
+                      # Dossier correspondant aux tuiles générées 
+                      "dir":
+                        type: string
+                        required: true
+                      # configuration des tuiles générées
+                      "config":
+                        type: string
+                        required: true
+              # Coûts qui seront calculés sur la topologie précisée précedemment. On peut en avoir plusieurs.
+              "costs":
+                type: array
+                minItems: 1
+                items:
+                  type: object
+                  required: true
+                  properties:
+                      # Chaque coût correspond à un profil
+                      "profile":
+                        type: string
+                        required: true
+                      # Chaque coût correspond à un profil
+                      "optmization":
+                        type: string
+                        required: true
+                      # Chaque coût correspond à un costType pour les isochrones
+                      "costType":
+                        type: string
+                        required: true
+                      # Chaque coût correspond à un costing pour valhalla
+                      "costing":
+                        type: string
+                        required: true
+                      # Fichier permettant de calculer le coût
+                      "compute":
+                        type: object
+                        required: true
+                        properties:
+                          # Stockage du fichier permettant de calculer le coût
+                          "storage":
+                            $ref: "#/components/schemas/storage"
+                      # Configuration pour le calcul des couts
+                      "configuration":
+                        type: object
+                        required: true
+                        properties:
+                          # Nom du coût dans le fichier de configuration
+                          "name":
+                            type: string
+                            required: true
+                          # Stockage du fichier de calcul des couts. C'est un JSON.
+                          "storage":
+                            $ref: "#/components/schemas/storage"
+        # Informations sur les opérations autorisées sur la ressource qui va être générée.
+        "availableOperations":
+          type: array
+          required: true
+          minItems: 1
+          items:
+            # Id de l'opération
+            "id":
+              type: string
+              required: true
+            # Paramètres de l'opération
+            "parameters":
+              type: array
+              required: true
+              items:
+                type: object
+                properties:
+                  # Id du parametre
+                  "id":
+                    type: string
+                    required: true
+                  # Valeur par défaut possible pour ce parametre
+                  "defaultValueContent":
+                    type: string
+                    required: false
+                  # Valeurs possibles pour ce parametre
+                  "values":
+                    type: string or array or object
+                    required: true
+
+components:
+  schemas:
+    # storage d'un document: fichier 
+    "storage":
+      type: object
+      properties:
+        # Fichier
+        "file":
+          type: string
+              required: false
diff --git a/r2gg/__about__.py b/r2gg/__about__.py
new file mode 100644
index 0000000..91bbbf0
--- /dev/null
+++ b/r2gg/__about__.py
@@ -0,0 +1,46 @@
+#! python3  # noqa: E265
+
+"""Metadata about the package to easily retrieve informations about it.
+
+See: https://packaging.python.org/guides/single-sourcing-package-version/
+"""
+
+from datetime import date
+
+__all__ = [
+    "__author__",
+    "__copyright__",
+    "__email__",
+    "__license__",
+    "__summary__",
+    "__title__",
+    "__uri__",
+    "__version__",
+]
+
+__author__ = "IGNF"
+__copyright__ = "2022 - {0}, {1}".format(date.today().year, __author__)
+__email__ = ""
+__executable_name__ = "r2gg"
+__package_name__ = "r2gg"
+
+__keywords__ = ['cli', ' IGN', ' osrm', ' routing', ' pgrouting', ' valhalla', ' generation-algorithms', ' isochrone', ' road2']
+__license__ = "GPL v3"
+__summary__ = "Route Graph Generator (r2gg) est un script Python qui permet la génération de graphes pour des moteurs de calcul d'itinéraire"
+__title__ = "Route Graph Generator"
+__title_clean__ = "".join(e for e in __title__ if e.isalnum())
+__uri_homepage__ = "https://ignf.github.io/route-graph-generator"
+__uri_repository__ = "https://github.com/IGNF/route-graph-generator/"
+__uri_tracker__ = f"{__uri_repository__}issues/"
+__uri__ = __uri_repository__
+
+__version__ = "2.2.1"
+__version_info__ = tuple(
+    [
+        int(num) if num.isdigit() else num
+        for num in __version__.replace("-", ".", 1).split(".")
+    ]
+)
+
+
+__cli_usage__ = f"{__summary__}."
diff --git a/r2gg/__init__.py b/r2gg/__init__.py
index 6a5c8da..8c446ac 100644
--- a/r2gg/__init__.py
+++ b/r2gg/__init__.py
@@ -1,46 +1,4 @@
-from r2gg._configure import configure
-from r2gg._main import sql_convert, pgr_convert, osm_convert, osrm_convert, valhalla_convert, write_road2_config
+#! python3  # noqa: E265
 
-__version__ = "1.2.3"
-
-def sql2pivot():
-    config, resource, db_configs, connection, logger = configure()
-    sql_convert(config, resource, db_configs, connection, logger)
-
-def pivot2pgrouting():
-    config, resource, db_configs, connection, logger = configure()
-    pgr_convert(config, resource, db_configs, connection, logger)
-
-def pivot2osm():
-    config, resource, _, connection, logger = configure()
-    osm_convert(config, resource, connection, logger)
-
-def osm2osrm():
-    config, resource, _, _, logger = configure()
-    osrm_convert(config, resource, logger)
-
-def osm2valhalla():
-    config, resource, _, _, logger = configure()
-    valhalla_convert(config, resource, logger)
-
-def road2config():
-    config, resource, _, _, logger = configure()
-    write_road2_config(config, resource, logger)
-
-if __name__ == '__main__':
-    config, resource, db_configs, connection, logger = configure()
-    sql_convert(config, resource, db_configs, connection, logger)
-    if (resource['type'] in ['pgr', 'smartpgr']):
-        config, resource, db_configs, connection, logger = configure()
-        pgr_convert(config, resource, db_configs, connection, logger)
-    elif (resource['type'] == 'osrm'):
-        config, resource, db_configs, connection, logger = configure()
-        osm_convert(config, resource, connection, logger)
-        osrm_convert(config, resource, logger)
-    elif (resource['type'] == 'valhalla'):
-        config, resource, db_configs, connection, logger = configure()
-        osm_convert(config, resource, connection, logger, True)
-        valhalla_convert(config, resource, logger)
-    else:
-        raise ValueError("Wrong resource type, should be in ['pgr',osrm','valhalla','smartpgr']")
-    write_road2_config(config, resource, logger)
+# submodules
+from .__about__ import __version__  # noqa: F401
diff --git a/r2gg/_configure.py b/r2gg/_configure.py
index 7535423..6000c33 100644
--- a/r2gg/_configure.py
+++ b/r2gg/_configure.py
@@ -33,7 +33,8 @@ def configure():
     """
     parser = argparse.ArgumentParser()
     parser.add_argument('config_file_path', type=str)
-    config_path = parser.parse_known_args()[0].config_file_path
+    args = parser.parse_args()
+    config_path = args.config_file_path
 
     # Récupération de l'objet 'génération' qui contient toute la config
     config = config_from_path(config_path)['generation']
@@ -71,6 +72,30 @@ def configure():
     # Récupération de l'objet permettant de générer la ressource
     resource = config['resource']
 
+    # Création de l'espace de travail
+    if not os.path.exists(config['workingSpace']['directory']):
+        os.makedirs(config['workingSpace']['directory'])
+
+    return config, resource, db_configs, logger
+
+def connect_working_db(config, db_configs, logger):
+    """
+    Fonction de connexion à la BDD de travail
+
+    Parameters
+    ----------
+    config: dict
+        dictionnaire correspondant à la configuration décrite dans le fichier passé en argument
+    db_configs: dict
+        dictionnaire correspondant aux configurations des bdd
+    logger: logging.Logger
+    Returns
+    -------
+    connection: psycopg2.connection
+        connection à la bdd de travail
+
+    """
+
     # Configuration de la bdd de travail
     work_db_config = db_configs[ config['workingSpace']['baseId'] ]
 
@@ -86,8 +111,18 @@ def configure():
     connection = psycopg2.connect(connect_args)
     connection.set_client_encoding('UTF8')
 
-    # Création de l'espace de travail
-    if not os.path.exists(config['workingSpace']['directory']):
-        os.makedirs(config['workingSpace']['directory'])
+    return connection
+
+def disconnect_working_db(connection, logger):
+    """
+    Fonction de connexion à la BDD de travail
+
+    Parameters
+    ----------
+    connection: psycopg2.connection
+        connection à la bdd de travail
+    logger: logging.Logger
+    """
 
-    return config, resource, db_configs, connection, logger
+    connection.close()
+    logger.info("Connection to work database closed")
\ No newline at end of file
diff --git a/r2gg/_lua_builder.py b/r2gg/_lua_builder.py
index 398c846..5ad8db3 100644
--- a/r2gg/_lua_builder.py
+++ b/r2gg/_lua_builder.py
@@ -143,7 +143,7 @@ def _build_process_way(costs_config, output_cost):
             get_variables_strings.append(local_var_str)
             for key, value in variable["mapping"].items():
                 cond_str = "    if {}_tmp == \"{}\" then\n".format(variable["name"], key)
-                var_str  = "        local {0} = tonumber(\"{1}\") or \"{1}\"\n".format(variable["name"], value)
+                var_str  = "        {0} = tonumber(\"{1}\") or \"{1}\"\n".format(variable["name"], value)
                 var_str += "    end\n"
                 get_variables_strings.append(cond_str)
                 get_variables_strings.append(var_str)
diff --git a/r2gg/_main.py b/r2gg/_main.py
index be6405c..fa86d17 100644
--- a/r2gg/_main.py
+++ b/r2gg/_main.py
@@ -69,7 +69,7 @@ def sql_convert(config, resource, db_configs, connection, logger):
         # Plusieurs sources peuvent référencer le même mapping mais changer plus tard dans la génération
         found_base = False
         for ub in used_bases:
-            if ub == source['mapping']['storage']['baseId']:
+            if ub == source['mapping']['source']['baseId']:
                 found_base = True
         if found_base:
             logger.info("Mapping already done, create next source...")
@@ -79,10 +79,10 @@ def sql_convert(config, resource, db_configs, connection, logger):
 
         # Configuration de la bdd source
         source_db_config = db_configs[ source['mapping']['source']['baseId'] ]
+        used_bases.append(source['mapping']['source']['baseId'])
 
         # Configuration de la bdd de travail utilisée pour ce pivot
-        work_db_config = db_configs[ source['mapping']['storage']['baseId'] ]
-        used_bases.append(source['mapping']['storage']['baseId'])
+        work_db_config = db_configs[ config['workingSpace']['baseId'] ]
 
         # Récupération de la bbox
         bbox = [float(coord) for coord in source["bbox"].split(",")]
@@ -92,14 +92,16 @@ def sql_convert(config, resource, db_configs, connection, logger):
         xmax = bbox[2]
         ymax = bbox[3]
         logger.info("Create source on bbox: " + source["bbox"])
-        
+
         # Lancement du script SQL de conversion source --> pivot
         connection.autocommit = True
-        with open( source['mapping']['storage']['file'] ) as sql_script:
+        with open( source['mapping']['conversion']['file'] ) as sql_script:
             cur = connection.cursor()
             logger.info("Executing SQL conversion script")
-            # todo : prendre en compte le schéma qui est dans la conf de la génération
-            instructions = sqlparse.split(sql_script.read().format(user=work_db_config.get('user')))
+            instructions = sqlparse.split(sql_script.read().format(user=work_db_config.get('user'),
+                                                                   input_schema=source_db_config.get('schema'),
+                                                                   output_schema=work_db_config.get('schema')
+                                                                   ))
 
             # Exécution instruction par instruction
             for instruction in instructions:
@@ -118,8 +120,6 @@ def sql_convert(config, resource, db_configs, connection, logger):
                 et_instruction = time.time()
                 logger.info("Execution ended. Elapsed time : %s seconds." %(et_instruction - st_instruction))
 
-    connection.close()
-
     et_sql_conversion = time.time()
 
     logger.info("Conversion from BDD to pivot ended. Elapsed time : %s seconds." %(et_sql_conversion - st_sql_conversion))
@@ -143,7 +143,7 @@ def pgr_convert(config, resource, db_configs, connection, logger):
 
     if (resource['type'] not in ['pgr', 'smartpgr']):
         raise ValueError("Wrong resource type, should be 'pgr' or 'smartpgr'")
-    
+
     logger.info("Conversion from pivot to PGR")
     st_pivot_to_pgr = time.time()
 
@@ -165,19 +165,21 @@ def pgr_convert(config, resource, db_configs, connection, logger):
         connection_out = psycopg2.connect(connect_args)
 
         schema_out = out_db_config.get('schema')
-        
+
+        source_db_config = db_configs[source['mapping']['source']['baseId']]
+        input_schema = source_db_config.get('schema')
+
         cost_calculation_files_paths = {cost["compute"]["configuration"]["storage"]["file"] for cost in source["costs"]}
 
         for cost_calculation_file_path in cost_calculation_files_paths:
-            pivot_to_pgr(source, cost_calculation_file_path, connection, connection_out, schema_out, logger)
+            pivot_to_pgr(source, cost_calculation_file_path, connection, connection_out, schema_out, input_schema, logger)
         connection_out.close()
 
-    connection.close()
     et_pivot_to_pgr = time.time()
     logger.info("Conversion from pivot to PGR ended. Elapsed time : %s seconds." %(et_pivot_to_pgr - st_pivot_to_pgr))
 
 
-def osm_convert(config, resource, connection, logger):
+def osm_convert(config, resource, db_configs, connection, logger):
     """
     Fonction de conversion depuis la bdd pivot vers un fichier osm
 
@@ -187,6 +189,8 @@ def osm_convert(config, resource, connection, logger):
         dictionnaire correspondant à la configuration décrite dans le fichier passé en argument
     resource: dict
         dictionnaire correspondant à la resource décrite dans le fichier passé en argument
+    db_configs: dict
+        dictionnaire correspondant aux configurations des bdd
     connection: psycopg2.connection
         connection à la bdd de travail
     logger: logging.Logger
@@ -197,17 +201,17 @@ def osm_convert(config, resource, connection, logger):
     used_bases = {}
     work_dir_config = config['workingSpace']['directory']
 
-    # On vérifie le type de la ressource 
+    # On vérifie le type de la ressource
     if (resource['type'] not in ['osrm', 'valhalla']):
         raise ValueError("Wrong resource type, should be in ['osrm','valhalla']")
 
     # Les outils de conversion utilisés par Valhalla ne lisent que du osm.pbf
-    convert_osm_to_bpf = False
+    convert_osm_to_pbf = False
     if (resource['type'] == 'valhalla'):
-        convert_osm_to_bpf = True
+        convert_osm_to_pbf = True
 
-    # Comme chaque source de la ressource peut potentiellement nécessiter un pivot différent, 
-    # On fait une boucle sur les sources et on adpate en fonction du type 
+    # Comme chaque source de la ressource peut potentiellement nécessiter un pivot différent,
+    # On fait une boucle sur les sources et on adapte en fonction du type
     for source in resource['sources']:
 
         logger.info("Create osm file of source: " + source['id'])
@@ -221,13 +225,13 @@ def osm_convert(config, resource, connection, logger):
         found_base = False
         found_id = ''
         for sid,sub in used_bases.items():
-            if sub == source['mapping']['storage']['baseId']:
+            if sub == source['mapping']['source']['baseId']:
                 found_base = True
                 found_id = sid
 
         if found_base:
 
-            if convert_osm_to_bpf:
+            if convert_osm_to_pbf:
                 linked_file = os.path.join(work_dir_config, source['id'] + ".osm.pbf")
                 real_file = os.path.join(work_dir_config, found_id + ".osm.pbf")
             else:
@@ -244,14 +248,12 @@ def osm_convert(config, resource, connection, logger):
                     raise ValueError("SymLink is already pointing to another file")
                 else:
                     logger.info("SymLink already pointing to the good file")
-            
+
         else:
             logger.info("Mapping not already done")
-            pivot_to_osm(config, source, connection, logger, convert_osm_to_bpf)
-        
-        used_bases[ source['id'] ] = source['mapping']['storage']['baseId']
+            pivot_to_osm(config, source, db_configs, connection, logger, convert_osm_to_pbf)
 
-    connection.close()
+        used_bases[ source['id'] ] = source['mapping']['source']['baseId']
 
 def osrm_convert(config, resource, logger, build_lua_from_cost_config = True):
     """
@@ -364,7 +366,7 @@ def valhalla_convert(config, resource, logger, build_lua_from_cost_config = True
 
     i = 0
     for source in resource["sources"]:
-        
+
         logger.info("Source {} of {}...".format(i+1, len(resource["sources"])))
 
         logger.info('Looking for OSM PBF file')
@@ -462,7 +464,7 @@ def write_road2_config(config, resource, logger, convert_file_paths = True):
         elif source['type'] == "valhalla":
             source.pop("mapping", None)
             for cost in source["costs"]:
-                cost.pop("compute")
+                cost.pop("compute", None)
         elif source['type'] == "pgr":
             source.pop("mapping", None)
             bid_tmp = source["storage"]["base"]["baseId"]
@@ -474,7 +476,7 @@ def write_road2_config(config, resource, logger, convert_file_paths = True):
                     source["storage"]["base"].update({"schema":base["schema"]})
             source["storage"]["base"].pop("baseId", None)
             for cost in source["costs"]:
-                cost.pop("compute")
+                cost.pop("compute", None)
         else:
             continue
 
@@ -484,7 +486,7 @@ def write_road2_config(config, resource, logger, convert_file_paths = True):
             source_file.write(json_string)
 
         source_ids.append(source['id'])
-    
+
     # On passe à la ressource
     resource_file = os.path.join(config["outputs"]["configurations"]["resource"]["storage"]["directory"], resource['id'] + ".resource")
     logger.info("Writing resource file: " + resource_file)
diff --git a/r2gg/_pivot_to_osm.py b/r2gg/_pivot_to_osm.py
index 69d23ae..6124b59 100644
--- a/r2gg/_pivot_to_osm.py
+++ b/r2gg/_pivot_to_osm.py
@@ -1,3 +1,4 @@
+from datetime import date
 from math import ceil
 import os
 import time
@@ -10,7 +11,7 @@
 from r2gg._osm_to_pbf import osm_to_pbf
 
 
-def pivot_to_osm(config, source, connection, logger, output_is_pbf = False):
+def pivot_to_osm(config, source, db_configs, connection, logger, output_is_pbf = False):
     """
     Fonction de conversion depuis la bdd pivot vers le fichier osm puis pbf le cas échéant
 
@@ -19,6 +20,8 @@ def pivot_to_osm(config, source, connection, logger, output_is_pbf = False):
     config: dict
         dictionnaire correspondant à la configuration décrite dans le fichier passé en argument
     source: dict
+    db_configs: dict
+        dictionnaire correspondant aux configurations des bdd
     connection: psycopg2.connection
         connection à la bdd de travail
     logger: logging.Logger
@@ -28,20 +31,28 @@ def pivot_to_osm(config, source, connection, logger, output_is_pbf = False):
 
     # Récupération de la date d'extraction
     work_dir_config = config['workingSpace']['directory']
+
+    # Get extraction date from file or use current date
     date_file = os.path.join(work_dir_config, "r2gg.date")
-    f = open(date_file, "r")
-    extraction_date = f.read()
-    f.close()
+    if os.path.exists(date_file):
+        f = open(date_file, "r")
+        extraction_date = f.read()
+        f.close()
+    else:
+        extraction_date = date.today().strftime("%Y-%m-%d")
+
+    source_db_config = db_configs[source['mapping']['source']['baseId']]
+    input_schema = source_db_config.get('schema')
 
     cursor = connection.cursor(cursor_factory=DictCursor)
 
-    logger.info("SQL: select last_value from nodes_id_seq")
-    cursor.execute("select last_value from nodes_id_seq")
+    logger.info(f"SQL: select last_value from {input_schema}.nodes_id_seq")
+    cursor.execute(f"select last_value from {input_schema}.nodes_id_seq")
     vertexSequence = cursor.fetchone()[0]
     logger.info(vertexSequence)
 
-    logger.info("SQL: select last_value from edges_id_seq")
-    cursor.execute("select last_value from edges_id_seq")
+    logger.info(f"SQL: select last_value from {input_schema}.edges_id_seq")
+    cursor.execute(f"select last_value from {input_schema}.edges_id_seq")
     edgeSequence = cursor.fetchone()[0]
     logger.info(edgeSequence)
 
@@ -59,7 +70,7 @@ def pivot_to_osm(config, source, connection, logger, output_is_pbf = False):
             with xf.element("osm", attribs):
 
                 # Ecriture des nodes
-                sql_query = getQueryByTableAndBoundingBox('nodes', source['bbox'])
+                sql_query = getQueryByTableAndBoundingBox(f'{input_schema}.nodes', source['bbox'])
                 logger.info("SQL: {}".format(sql_query))
                 st_execute = time.time()
                 cursor.execute(sql_query)
@@ -80,7 +91,7 @@ def pivot_to_osm(config, source, connection, logger, output_is_pbf = False):
                 logger.info("Writing nodes ended. Elapsed time : %s seconds." %(et_execute - st_execute))
 
                 # Ecriture des ways
-                sql_query2 = getQueryByTableAndBoundingBox('edges', source['bbox'], ['*', 'inter_nodes(geom) as internodes'])
+                sql_query2 = getQueryByTableAndBoundingBox(f'{input_schema}.edges', source['bbox'], ['*', f'{input_schema}.inter_nodes(geom) as internodes'])
                 logger.info("SQL: {}".format(sql_query2))
                 st_execute = time.time()
                 cursor.execute(sql_query2)
@@ -108,7 +119,7 @@ def pivot_to_osm(config, source, connection, logger, output_is_pbf = False):
                 logger.info("Writing ways ended. Elapsed time : %s seconds." %(et_execute - st_execute))
 
                 # Ecriture des restrictions
-                sql_query3 = "select * from non_comm"
+                sql_query3 = f"select * from {input_schema}.non_comm"
                 logger.info("SQL: {}".format(sql_query3))
                 st_execute = time.time()
                 cursor.execute(sql_query3)
diff --git a/r2gg/_pivot_to_pgr.py b/r2gg/_pivot_to_pgr.py
index d1272d7..64934d6 100644
--- a/r2gg/_pivot_to_pgr.py
+++ b/r2gg/_pivot_to_pgr.py
@@ -8,7 +8,7 @@
 from r2gg._read_config import config_from_path
 from r2gg._sql_building import getQueryByTableAndBoundingBox
 
-def pivot_to_pgr(source, cost_calculation_file_path, connection_work, connection_out, schema, logger):
+def pivot_to_pgr(source, cost_calculation_file_path, connection_work, connection_out, schema, input_schema, logger):
     """
     Fonction de conversion depuis la bdd pivot vers la base pgr
 
@@ -23,6 +23,8 @@ def pivot_to_pgr(source, cost_calculation_file_path, connection_work, connection
         connection à la bdd pgrouting de sortie
     schema: str
         nom du schéma dans la base de sortie
+    input_schema: str
+        nom du schéma dans la base en entrée
     logger: logging.Logger
     """
 
@@ -107,7 +109,7 @@ def pivot_to_pgr(source, cost_calculation_file_path, connection_work, connection
     cursor_out.execute(create_non_comm)
 
     logger.info("Populating turn restrictions")
-    tr_query = "SELECT id_from, id_to FROM non_comm;"
+    tr_query = f"SELECT id_from, id_to FROM {input_schema}.non_comm;"
 
     logger.debug("SQL: {}".format(tr_query))
     st_execute = time.time()
@@ -167,7 +169,7 @@ def pivot_to_pgr(source, cost_calculation_file_path, connection_work, connection
     cursor_out.execute(create_nodes)
 
     logger.info("Populating vertices")
-    nd_query = "SELECT id, geom FROM nodes;"
+    nd_query = f"SELECT id, geom FROM {input_schema}.nodes;"
 
     logger.debug("SQL: {}".format(nd_query))
     st_execute = time.time()
@@ -263,7 +265,7 @@ def pivot_to_pgr(source, cost_calculation_file_path, connection_work, connection
     output_columns_names = [column.split(' ')[-1] for column in attribute_columns]
 
     # Ecriture des ways
-    sql_query = getQueryByTableAndBoundingBox('edges', source['bbox'], in_columns)
+    sql_query = getQueryByTableAndBoundingBox(f'{input_schema}.edges', source['bbox'], in_columns)
     logger.info("SQL: {}".format(sql_query))
     st_execute = time.time()
     cursor_in.execute(sql_query)
diff --git a/r2gg/_valhalla_lua_builder.py b/r2gg/_valhalla_lua_builder.py
index 7433e8d..d3eb727 100644
--- a/r2gg/_valhalla_lua_builder.py
+++ b/r2gg/_valhalla_lua_builder.py
@@ -252,24 +252,29 @@ def build_valhalla_lua(costs_config):
   kv["alt_name"] = kv["alt_name"]
   kv["official_name"] = kv["official_name"]
 
-  kv["max_speed"] = kv["{0}"]
+  local corrected_speed = kv["{0}"]
+  if (kv["urbain"] == "True") then
+    corrected_speed = tostring(3.6 * kv["length_m"] / ((3.6 / tonumber(corrected_speed)) * kv["length_m"] + 5))
+  end
+
+  kv["max_speed"] = corrected_speed
 
-  kv["advisory_speed"] = normalize_speed(kv["{0}"])
-  kv["average_speed"] = normalize_speed(kv["{0}"])
+  kv["advisory_speed"] = normalize_speed(corrected_speed)
+  kv["average_speed"] = normalize_speed(corrected_speed)
   if (tonumber(kv["direction"]) <= 0) then
-    kv["backward_speed"] = normalize_speed(kv["{0}"])
+    kv["backward_speed"] = normalize_speed(corrected_speed)
   else
     kv["backward_speed"] = normalize_speed("0")
   end
   if (tonumber(kv["direction"]) >= 0) then
-    kv["forward_speed"] = normalize_speed(kv["{0}"])
+    kv["forward_speed"] = normalize_speed(corrected_speed)
   else
     kv["forward_speed"] = normalize_speed("0")
   end
 
-  kv["default_speed"] = normalize_speed(kv["{0}"])
+  kv["default_speed"] = normalize_speed(corrected_speed)
 
-  if tonumber(kv["{0}"]) <= 0 then
+  if tonumber(corrected_speed) <= 0 then
     kv["auto_backward"] = "false"
     kv["auto_forward"] = "false"
   end
@@ -349,7 +354,7 @@ def build_valhalla_lua(costs_config):
   end
 
   kv["hazmat"] = nil
-  kv["maxspeed:hgv"] = normalize_speed(kv["{0}"])
+  kv["maxspeed:hgv"] = normalize_speed(corrected_speed)
 
   if (kv["hgv:national_network"] or kv["hgv:state_network"] or kv["hgv"] == "local" or kv["hgv"] == "designated") then
     kv["truck_route"] = "true"
@@ -510,7 +515,7 @@ def build_valhalla_lua(costs_config):
 end
 
 function rel_members_proc (keyvalues, keyvaluemembers, roles, membercount)
-  membersuperseeded = {{}}
+  membersuperseeded = {{0}}
   for i = 1, membercount do
     membersuperseeded[i] = 0
   end
diff --git a/r2gg/cli.py b/r2gg/cli.py
new file mode 100644
index 0000000..f663ef3
--- /dev/null
+++ b/r2gg/cli.py
@@ -0,0 +1,76 @@
+#! python3  # noqa: E265
+
+"""Main CLI entrypoint."""
+
+# Package
+from r2gg.__about__ import (
+    __author__,
+    __cli_usage__,
+    __summary__,
+    __title__,
+    __title_clean__,
+    __uri_homepage__,
+    __version__,
+)
+from r2gg._configure import configure, connect_working_db, disconnect_working_db
+from r2gg._main import sql_convert, pgr_convert, osm_convert, osrm_convert, valhalla_convert, write_road2_config
+
+# ############################################################################
+# ########## MAIN ################
+# ################################
+def sql2pivot():
+    config, resource, db_configs, logger = configure()
+    connection = connect_working_db(config, db_configs, logger)
+    sql_convert(config, resource, db_configs, connection, logger)
+    disconnect_working_db(connection, logger)
+
+def pivot2pgrouting():
+    config, resource, db_configs, logger = configure()
+    connection = connect_working_db(config, db_configs, logger)
+    pgr_convert(config, resource, db_configs, connection, logger)
+    disconnect_working_db(connection, logger)
+
+def pivot2osm():
+    config, resource, db_configs, logger = configure()
+    connection = connect_working_db(config, db_configs, logger)
+    osm_convert(config, resource, db_configs, connection, logger)
+    disconnect_working_db(connection, logger)
+
+def osm2osrm():
+    config, resource, _, logger = configure()
+    osrm_convert(config, resource, logger)
+
+def osm2valhalla():
+    config, resource, _, logger = configure()
+    valhalla_convert(config, resource, logger)
+
+def road2config():
+    config, resource, _, logger = configure()
+    write_road2_config(config, resource, logger)
+
+def main():
+    """Main CLI entrypoint.
+    """
+    config, resource, db_configs, logger = configure()
+    connection = connect_working_db(config, db_configs, logger)
+    sql_convert(config, resource, db_configs, connection, logger)
+    if (resource['type'] in ['pgr', 'smartpgr']):
+        config, resource, db_configs, connection, logger = configure()
+        pgr_convert(config, resource, db_configs, connection, logger)
+        disconnect_working_db(connection, logger)
+    elif (resource['type'] == 'osrm'):
+        config, resource, db_configs, connection, logger = configure()
+        osm_convert(config, resource, db_configs,  connection, logger)
+        disconnect_working_db(connection, logger)
+        osrm_convert(config, resource, logger)
+    elif (resource['type'] == 'valhalla'):
+        config, resource, db_configs, connection, logger = configure()
+        osm_convert(config, resource, db_configs, connection, logger, True)
+        valhalla_convert(config, resource, logger)
+    else:
+        raise ValueError("Wrong resource type, should be in ['pgr',osrm','valhalla','smartpgr']")
+    write_road2_config(config, resource, logger)
+
+# -- Stand alone execution
+if __name__ == "__main__":
+    main()  # required by unittest
diff --git a/r2gg/json-schema/cost_calculations.schema.json b/r2gg/json-schema/cost_calculations.schema.json
new file mode 100644
index 0000000..589868f
--- /dev/null
+++ b/r2gg/json-schema/cost_calculations.schema.json
@@ -0,0 +1,103 @@
+{
+  "$schema": "https://json-schema.org/draft/2020-12/schema",
+  "type": "object",
+  "required": [
+    "variables",
+    "outputs"
+  ],
+  "properties": {
+    "variables": {
+      "type": "array",
+      "items": {
+        "type": "object",
+        "required": [
+          "name",
+          "column_name",
+          "mapping"
+        ],
+        "properties": {
+          "name": {
+            "type": "string"
+          },
+          "mapping": {
+            "oneOf": [
+              {
+                "type": "string"
+              },
+              {
+                "type": "object"
+              }
+            ]
+          },
+          "column_name": {
+            "type": "string"
+          }
+        }
+      }
+    },
+    "outputs": {
+      "type": "array",
+      "items": {
+        "type": "object",
+        "required": [
+          "name",
+          "speed_value",
+          "direct_conditions",
+          "reverse_conditions",
+          "turn_restrictions",
+          "cost_type",
+          "operations"
+        ],
+        "properties": {
+          "name": {
+            "type": "string"
+          },
+          "cost_type": {
+            "type": "string"
+          },
+          "operations": {
+            "type": "array",
+            "items": {
+              "type": "array",
+              "items": [
+                {
+                  "type": "string",
+                  "enum" : ["add","substract","multiply","divide"]
+                },
+                {
+                  "oneOf": [
+                    {
+                      "type": "string",
+                    },
+                    {
+                      "type": "number"
+                    }
+                  ]
+                }
+              ]
+            }
+          },
+          "speed_value": {
+            "oneOf": [
+              {
+                "type": "string"
+              },
+              {
+                "type": "number"
+              }
+            ]
+          },
+          "direct_conditions": {
+            "type": "string"
+          },
+          "turn_restrictions": {
+            "type": "boolean"
+          },
+          "reverse_conditions": {
+            "type": "string"
+          }
+        }
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
index 7c8acc8..5603c37 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,5 +1,1 @@
-lxml==4.6.4
-psycopg2==2.9.1
-setuptools==45.2.0
-sqlparse==0.4.2
-osmium==3.2.0
+-r requirements/base.txt
diff --git a/requirements/base.txt b/requirements/base.txt
new file mode 100644
index 0000000..d5604f6
--- /dev/null
+++ b/requirements/base.txt
@@ -0,0 +1,4 @@
+lxml==4.6.4
+psycopg2==2.9.1
+sqlparse==0.4.2
+osmium==3.2.0
diff --git a/requirements/documentation.txt b/requirements/documentation.txt
new file mode 100644
index 0000000..fd82a0e
--- /dev/null
+++ b/requirements/documentation.txt
@@ -0,0 +1,8 @@
+# Documentation
+# -------------
+
+furo==2022.*
+myst-parser[linkify]>=0.14,<0.19
+sphinx-autobuild==2021.3.14
+sphinx-copybutton<1
+sphinxext-opengraph>=0.4,<1
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..d10e343
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,31 @@
+# -- Tests ----------------------------------------------
+[tool:pytest]
+addopts =
+    --junitxml=junit/test-results.xml
+    --cov-config=setup.cfg
+    --cov=r2gg
+    --cov-report=html
+    --cov-report=term
+    --cov-report=xml
+    --ignore=tests/_wip/
+junit_family = xunit2
+norecursedirs = .* build dev development dist docs CVS fixtures _darcs {arch} *.egg venv _wip
+python_files = test_*.py
+testpaths = tests
+
+[coverage:run]
+branch = True
+omit =
+    .venv/*
+    docs/*
+    *tests*
+
+[coverage:report]
+exclude_lines =
+    if self.debug:
+    pragma: no cover
+    raise NotImplementedError
+    if __name__ == .__main__.:
+
+ignore_errors = True
+show_missing = True
diff --git a/setup.py b/setup.py
index b8f7e78..b018e4a 100644
--- a/setup.py
+++ b/setup.py
@@ -1,16 +1,81 @@
-from setuptools import setup
-
-setup (
-    name = 'r2gg',
-    version = '1.2.3',
-    entry_points = {
-            'console_scripts': [
-                'r2gg-sql2pivot=r2gg:sql2pivot',
-                'r2gg-pivot2pgrouting=r2gg:pivot2pgrouting',
-                'r2gg-pivot2osm=r2gg:pivot2osm',
-                'r2gg-osm2osrm=r2gg:osm2osrm',
-                'r2gg-osm2valhalla=r2gg:osm2valhalla',
-                'r2gg-road2config=r2gg:road2config'
-            ]
-    }
+#! python3  # noqa: E265
+
+"""Setup script to package into a Python module."""
+
+# ############################################################################
+# ########## Libraries #############
+# ##################################
+
+# standard library
+from pathlib import Path
+
+# 3rd party
+from setuptools import find_packages, setup
+
+# package (to get version)
+from r2gg import __about__
+
+# ############################################################################
+# ########### Globals ##############
+# ##################################
+
+# The directory containing this file
+HERE = Path(__file__).parent
+
+requirements = []
+with open(HERE / "requirements/base.txt") as f:
+    requirements = [
+        line
+        for line in f.read().splitlines()
+        if not line.startswith(("#", "-")) and len(line)
+    ]
+
+# The text of the README file
+README = (HERE / "README.md").read_text()
+
+# ############################################################################
+# ########### Main #################
+# ##################################
+
+setup(
+    name=__about__.__package_name__,
+    author=__about__.__author__,
+    author_email=__about__.__email__,
+    description=__about__.__summary__,
+    long_description=README,
+    long_description_content_type="text/markdown",
+    keywords=__about__.__keywords__,
+    url=__about__.__uri__,
+    version=__about__.__version__,
+    classifiers=[
+        "Development Status :: 4 - Beta",
+        "Environment :: Console",
+        "Intended Audience :: Information Technology",
+        "License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
+        "Operating System :: OS Independent",
+        "Programming Language :: Python :: 3",
+        "Programming Language :: Python :: 3.10",
+        "Programming Language :: Python :: 3.11",
+        "Operating System :: OS Independent",
+        "Topic :: Scientific/Engineering :: GIS",
+    ],
+    # packaging
+    packages=find_packages(
+        exclude=["contrib", "docs", "*.tests", "*.tests.*", "tests.*", "tests", ".venv"]
+    ),
+    include_package_data=True,
+    install_requires=requirements,
+
+    # cli
+    entry_points={
+        "console_scripts": [
+            f"{__about__.__executable_name__} = r2gg.cli:main",
+            f"{__about__.__executable_name__}-sql2pivot = r2gg.cli:sql2pivot",
+            f"{__about__.__executable_name__}-pivot2pgrouting = r2gg.cli:pivot2pgrouting",
+            f"{__about__.__executable_name__}-pivot2osm = r2gg.cli:pivot2osm",
+            f"{__about__.__executable_name__}-osm2osrm = r2gg.cli:osm2osrm",
+            f"{__about__.__executable_name__}-osm2valhalla = r2gg.cli:osm2valhalla",
+            f"{__about__.__executable_name__}-road2config = r2gg.cli:road2config"
+        ]
+    },
 )
diff --git a/sql/bdtopo_v3.3.sql b/sql/bdtopo_v3.3.sql
new file mode 100644
index 0000000..1f001cf
--- /dev/null
+++ b/sql/bdtopo_v3.3.sql
@@ -0,0 +1,346 @@
+-- ####################################################
+-- IMPORT DE LA TABLE DES TRONCON DE ROUTE DEPUIS BDUNI
+-- ####################################################
+CREATE EXTENSION IF NOT EXISTS postgres_fdw;
+CREATE EXTENSION IF NOT EXISTS Postgis;
+
+DROP SERVER IF EXISTS bduni_server CASCADE;
+CREATE SERVER bduni_server
+  FOREIGN DATA WRAPPER postgres_fdw
+  OPTIONS (host %(bdhost)s, port %(bdport)s, dbname %(dbname)s);
+
+CREATE USER MAPPING FOR {user}
+  SERVER bduni_server
+  OPTIONS (user %(bduser)s, password %(bdpwd)s);
+
+GRANT USAGE ON FOREIGN SERVER bduni_server TO {user};
+
+CREATE SCHEMA IF NOT EXISTS {output_schema};
+
+DROP FOREIGN TABLE IF EXISTS {output_schema}.troncon_de_route CASCADE;
+DROP FOREIGN TABLE IF EXISTS {output_schema}.non_communication CASCADE;
+
+IMPORT FOREIGN SCHEMA {input_schema}  LIMIT TO (troncon_de_route, non_communication)
+FROM SERVER bduni_server
+INTO {output_schema};
+
+-- ####################################
+-- DEFINITION DU GRAPHE : NOEUDS / ARCS
+-- ####################################
+-- répétition du IF EXISTS pour ouvrir à l'éventualité de la mise à jour
+DROP TABLE IF EXISTS {output_schema}.nodes CASCADE ;
+CREATE TABLE IF NOT EXISTS {output_schema}.nodes (
+  id bigserial primary key,
+  lon double precision,
+  lat double precision,
+  geom geometry(Point,4326)
+);
+
+-- répétition du IF EXISTS pour ouvrir à l'éventualité de la mise à jour
+DROP SEQUENCE IF EXISTS {output_schema}.edges_id_seq;
+CREATE SEQUENCE IF NOT EXISTS {output_schema}.edges_id_seq;
+DROP TABLE IF EXISTS {output_schema}.edges;
+CREATE TABLE IF NOT EXISTS {output_schema}.edges (
+  id bigserial primary key,
+  source_id bigserial,
+  target_id bigserial,
+  x1 double precision,
+  y1 double precision,
+  x2 double precision,
+  y2 double precision,
+  length_m double precision,
+  direction integer,
+  geom geometry(Linestring,4326),
+  -- Attributs spécifiques à la bd uni
+  vitesse_moyenne_vl integer,
+  nature text,
+  cleabs text,
+  importance integer,
+  way_names text,
+  nom_1_gauche text,
+  nom_1_droite text,
+  cpx_numero text,
+  cpx_toponyme_route_nommee text,
+  sens_de_circulation text,
+  position_par_rapport_au_sol integer,
+  acces_vehicule_leger text,
+  largeur_de_chaussee double precision,
+  nombre_de_voies text,
+  insee_commune_gauche text,
+  insee_commune_droite text,
+  bande_cyclable text,
+  itineraire_vert boolean,
+  reserve_aux_bus text,
+  urbain boolean,
+  acces_pieton text,
+  nature_de_la_restriction text,
+  restriction_de_hauteur text,
+  restriction_de_poids_total text,
+  restriction_de_poids_par_essieu text,
+  restriction_de_largeur text,
+  restriction_de_longueur text,
+  matieres_dangereuses_interdites boolean,
+  cpx_gestionnaire text,
+  cpx_numero_route_europeenne text,
+  cpx_classement_administratif text
+);
+
+
+CREATE INDEX IF NOT EXISTS nodes_geom_gist ON {output_schema}.nodes USING GIST (geom);
+CREATE INDEX IF NOT EXISTS nodes_lon_lat_idx ON {output_schema}.nodes(lon,lat);
+CREATE INDEX IF NOT EXISTS edges_geom_gist ON {output_schema}.edges USING GIST (geom);
+
+-- ####################################
+-- UTILITAIRES DE REMPLISSAGE DU GRAPHE
+-- ####################################
+
+-- Renvoie le srid à partir du code territoire
+CREATE OR REPLACE FUNCTION {output_schema}.bduni_srid(code_territoire text) RETURNS int AS $$
+BEGIN
+  CASE
+    WHEN (code_territoire = 'FXX') THEN
+      RETURN 2154;
+    WHEN (code_territoire = 'GLP') THEN
+      RETURN 4559;
+    WHEN (code_territoire = 'MTQ') THEN
+      RETURN 4559;
+    WHEN (code_territoire = 'GUF') THEN
+      RETURN 2972;
+    WHEN (code_territoire = 'REU') THEN
+      RETURN 2975;
+    WHEN (code_territoire = 'SPM') THEN
+      RETURN 4467;
+    WHEN (code_territoire = 'MYT') THEN
+      RETURN 4471;
+    ELSE
+      RETURN NULL;
+  END CASE;
+END;
+$$ LANGUAGE plpgsql;
+
+-- Récupération d'un identifiant de sommet en fonction d'un point (égalité stricte)
+CREATE OR REPLACE FUNCTION {output_schema}.nodes_id( _geom geometry ) RETURNS bigint AS $$
+  SELECT id FROM {output_schema}.nodes WHERE lon = ST_X(_geom) AND lat = ST_Y(_geom);
+$$ LANGUAGE SQL ;
+
+-- Renvoie les points intermédiaires d'une linestring en format json
+CREATE OR REPLACE FUNCTION {output_schema}.inter_nodes(geom geometry(LineString, 4326)) RETURNS json[] AS $$
+  SELECT COALESCE(array_agg(row_to_json(subq)), '{{}}') FROM (
+    SELECT
+      ST_X((dp).geom) AS lon,
+      ST_Y((dp).geom) AS lat
+    FROM (
+      SELECT st_numpoints(geom) AS nump, ST_DumpPoints(geom) AS dp
+    ) AS foo
+    WHERE (dp).path[1] <@ int4range(2, nump)
+  ) subq ;
+$$ LANGUAGE SQL;
+
+-- populate.sql
+-- On doit copier au préalable troncon_de_route pour figer les tronçons car elle est mise à jour en continue
+
+CREATE TEMP TABLE IF NOT EXISTS bduni_non_com_tmp AS
+SELECT * FROM {output_schema}.non_communication;
+
+
+-- ############################
+-- REMPLISSAGE DE BDUNI_TRONCON
+-- ############################
+-- Ajout des tronçons de routes (jointure avec routes numérotées et nommées)
+CREATE TEMP TABLE IF NOT EXISTS bduni_troncon AS
+  SELECT DISTINCT ON (cleabs) * FROM (
+    SELECT
+      -- GCVS (système d'historique)
+      t.cleabs as cleabs,
+      -- t.gcms_detruit AS detruit,
+      -- t.gcms_territoire as territoire,
+
+      -- BD TOPO
+      t.etat_de_l_objet as etat,
+      t.nature as nature,
+      NULLIF(t.importance,'')::int as importance,
+      t.sens_de_circulation as sens_de_circulation,
+      (CASE
+      WHEN t.vitesse_moyenne_vl=1 THEN 0
+      ELSE t.vitesse_moyenne_vl::integer
+      END) as vitesse_moyenne_vl,
+
+      -- Pour l'attribut name
+      -- TODO: nom_collaboratif_gauche
+      t.nom_1_gauche as nom_1_gauche,
+      -- TODO: nom_collaboratif_droite
+      t.nom_1_droite as nom_1_droite,
+      t.cpx_numero as cpx_numero,
+      t.cpx_toponyme_route_nommee as cpx_toponyme,
+
+      (CASE
+      WHEN t.position_par_rapport_au_sol='Gué ou radier' THEN 0
+      ELSE t.position_par_rapport_au_sol::integer
+      END) as position_par_rapport_au_sol,
+      t.acces_vehicule_leger as acces_vehicule_leger,
+
+      t.largeur_de_chaussee as largeur_de_chaussee,
+
+      -- Champs demandés par la DP
+      t.itineraire_vert as itineraire_vert,
+      t.nombre_de_voies as nombre_de_voies,
+      t.insee_commune_gauche as insee_commune_gauche,
+      t.insee_commune_droite as insee_commune_droite,
+      -- TODO: remove
+      t.bande_cyclable as bande_cyclable,
+      t.reserve_aux_bus as reserve_aux_bus,
+      t.urbain as urbain,
+      t.acces_pieton as acces_pieton,
+      t.nature_de_la_restriction as nature_de_la_restriction,
+      t.restriction_de_hauteur as restriction_de_hauteur,
+      t.restriction_de_poids_total as restriction_de_poids_total,
+      t.restriction_de_poids_par_essieu as restriction_de_poids_par_essieu,
+      t.restriction_de_largeur as restriction_de_largeur,
+      t.restriction_de_longueur as restriction_de_longueur,
+      t.matieres_dangereuses_interdites as matieres_dangereuses_interdites,
+      t.cpx_gestionnaire as cpx_gestionnaire,
+      t.cpx_numero_route_europeenne as cpx_numero_route_europeenne,
+      t.cpx_classement_administratif as cpx_classement_administratif,
+
+      -- géométrie du troncon
+      ST_Force2D(ST_Transform(t.geom, 4326)) as geom
+      -- ST_Force2D(ST_Transform(ST_SetSrid(t.geometrie, {output_schema}.bduni_srid(t.gcms_territoire)), 4326)) as geom
+
+
+    FROM (
+      -- decomposition liens_vers_route_nommee en lien_vers_route_nommee (split et duplication des lignes)
+      SELECT * FROM {output_schema}.troncon_de_route
+      -- SELECT t1.*, regexp_split_to_table( t1.liens_vers_route_nommee,'/') as lien_vers_route_nommee FROM troncon_de_route t1
+    ) t
+  ) s
+    WHERE etat LIKE 'En service'
+    AND geom && ST_MakeEnvelope(%(xmin)s,%(ymin)s,%(xmax)s,%(ymax)s, 4326 )
+    -- décommenter pour tester :
+    -- AND territoire='REU'
+;
+
+  -- ############################
+  -- REMPLISSAGE DE nodes
+  -- ############################
+-- Remplissage de nodes avec les sommets initiaux et finaux des tronçons
+-- (les points intermédiaires ne forment pas la topologie)
+WITH t AS (
+  SELECT ST_Force2D(ST_StartPoint(geom)) as geom FROM bduni_troncon
+    UNION
+  SELECT ST_Force2D(ST_EndPoint(geom)) as geom FROM bduni_troncon
+)
+INSERT INTO {output_schema}.nodes (lon,lat,geom)
+  SELECT ST_X(t.geom),ST_Y(t.geom),t.geom FROM t WHERE {output_schema}.nodes_id(t.geom) IS NULL
+;
+
+-- ############################
+-- REMPLISSAGE DE edges
+-- ############################
+
+INSERT INTO {output_schema}.edges
+  SELECT
+    nextval('{output_schema}.edges_id_seq') AS id,
+    {output_schema}.nodes_id(ST_StartPoint(geom)) as source_id,
+    {output_schema}.nodes_id(ST_EndPoint(geom)) as target_id,
+    ST_X(ST_StartPoint(geom)) as x1,
+    ST_Y(ST_StartPoint(geom)) as y1,
+    ST_X(ST_EndPoint(geom)) as x2,
+    ST_Y(ST_EndPoint(geom)) as y2,
+    ST_length(geography(ST_Transform(geom, 4326))) as length_m,
+    (CASE
+      WHEN sens_de_circulation='Sens direct' THEN 1
+      WHEN sens_de_circulation='Sens inverse' THEN -1
+      ELSE 0
+      END) as direction,
+    geom as geom,
+    -- Attributs spécifiques à la bd uni
+    vitesse_moyenne_vl as vitesse_moyenne_vl,
+    nature as nature,
+    cleabs as cleabs,
+    importance as importance,
+    CONCAT('{{"nom_1_gauche": "', nom_1_gauche, '", "nom_1_droite": "', nom_1_droite, '", "cpx_numero": "', cpx_numero, '", "cpx_toponyme": "', cpx_toponyme, '"}}') as way_names,
+    nom_1_gauche as nom_1_gauche,
+    nom_1_droite as nom_1_droite,
+    cpx_numero as cpx_numero,
+    cpx_toponyme as cpx_toponyme_route_nommee,
+    sens_de_circulation as sens_de_circulation,
+    position_par_rapport_au_sol as position_par_rapport_au_sol,
+    acces_vehicule_leger as acces_vehicule_leger,
+    largeur_de_chaussee as largeur_de_chaussee,
+    nombre_de_voies as nombre_de_voies,
+    insee_commune_gauche as insee_commune_gauche,
+    insee_commune_droite as insee_commune_droite,
+    bande_cyclable as bande_cyclable,
+    itineraire_vert as itineraire_vert,
+    reserve_aux_bus as reserve_aux_bus,
+    urbain as urbain,
+    acces_pieton as acces_pieton,
+    nature_de_la_restriction as nature_de_la_restriction,
+    restriction_de_hauteur as restriction_de_hauteur,
+    restriction_de_poids_total as restriction_de_poids_total,
+    restriction_de_poids_par_essieu as restriction_de_poids_par_essieu,
+    restriction_de_largeur as restriction_de_largeur,
+    restriction_de_longueur as restriction_de_longueur,
+    matieres_dangereuses_interdites as matieres_dangereuses_interdites,
+    cpx_gestionnaire as cpx_gestionnaire,
+    cpx_numero_route_europeenne as cpx_numero_route_europeenne,
+    cpx_classement_administratif as cpx_classement_administratif
+  FROM bduni_troncon
+;
+
+-- ############################
+-- REMPLISSAGE DE bduni_non_com
+-- ############################
+
+-- On ne conserve que les non communications sur la zone de calcul
+DROP TABLE IF EXISTS {output_schema}.non_comm;
+CREATE TABLE IF NOT EXISTS {output_schema}.non_comm AS
+SELECT * FROM (
+  SELECT
+    cleabs,
+    lien_vers_troncon_entree,
+    -- liens_vers_troncon_sortie
+    regexp_split_to_table(bduni_non_com_tmp.liens_vers_troncon_sortie, E'/') AS lien_vers_troncon_sortie
+  FROM bduni_non_com_tmp
+  WHERE lien_vers_troncon_entree IN (SELECT cleabs from {output_schema}.edges)
+  -- WHERE lien_vers_troncon_entree IN (SELECT cleabs from {output_schema}.edges) AND NOT gcms_detruit
+) AS non_comm_split
+WHERE non_comm_split.lien_vers_troncon_sortie IN (SELECT cleabs from {output_schema}.edges);
+
+-- Remplissage des ids d'edge dans la table des non communications
+ALTER TABLE {output_schema}.non_comm ADD COLUMN IF NOT EXISTS id_from bigint;
+ALTER TABLE {output_schema}.non_comm ADD COLUMN IF NOT EXISTS id_to bigint;
+
+UPDATE {output_schema}.non_comm AS b SET id_from = e.id
+FROM {output_schema}.edges as e
+WHERE e.cleabs = b.lien_vers_troncon_entree
+;
+
+UPDATE {output_schema}.non_comm AS b SET id_to = e.id
+FROM {output_schema}.edges as e
+WHERE e.cleabs = b.lien_vers_troncon_sortie
+;
+
+-- Récupération du point commun entre deux troncons
+CREATE OR REPLACE FUNCTION {output_schema}.common_point(id_from bigint, id_to bigint) RETURNS bigint AS $$
+  SELECT
+  CASE
+    WHEN a.source_id=b.source_id THEN b.source_id
+    WHEN a.source_id=b.target_id THEN b.target_id
+    WHEN a.target_id=b.source_id THEN b.source_id
+    WHEN a.target_id=b.target_id THEN b.target_id
+    ELSE -1
+  END
+  FROM {output_schema}.edges as a, {output_schema}.edges as b
+  WHERE a.id = id_from
+  AND b.id = id_to;
+$$ LANGUAGE SQL ;
+
+ALTER TABLE {output_schema}.non_comm ADD COLUMN IF NOT EXISTS common_vertex_id bigint;
+UPDATE {output_schema}.non_comm SET common_vertex_id = {output_schema}.common_point(non_comm.id_from, non_comm.id_to);
+
+DROP FOREIGN TABLE IF EXISTS {output_schema}.troncon_de_route CASCADE;
+DROP FOREIGN TABLE IF EXISTS {output_schema}.non_communication CASCADE;
+
+END TRANSACTION;
+VACUUM ANALYZE;
diff --git a/sql/bduni_convert.sql b/sql/bduni_convert.sql
index e2f61be..e75bda0 100644
--- a/sql/bduni_convert.sql
+++ b/sql/bduni_convert.sql
@@ -13,18 +13,22 @@ CREATE USER MAPPING FOR {user}
 
 GRANT USAGE ON FOREIGN SERVER bduni_server TO {user};
 
-DROP FOREIGN TABLE IF EXISTS troncon_de_route CASCADE;
-DROP FOREIGN TABLE IF EXISTS non_communication CASCADE;
-IMPORT FOREIGN SCHEMA public LIMIT TO (troncon_de_route, non_communication)
+
+CREATE SCHEMA IF NOT EXISTS {output_schema};
+
+DROP FOREIGN TABLE IF EXISTS {output_schema}.troncon_de_route CASCADE;
+DROP FOREIGN TABLE IF EXISTS {output_schema}.non_communication CASCADE;
+
+IMPORT FOREIGN SCHEMA {input_schema} LIMIT TO (troncon_de_route, non_communication)
 FROM SERVER bduni_server
-INTO public;
+INTO {output_schema};
 
 -- ####################################
 -- DEFINITION DU GRAPHE : NOEUDS / ARCS
 -- ####################################
 -- répétition du IF EXISTS pour ouvrir à l'éventualité de la mise à jour
-DROP TABLE IF EXISTS nodes CASCADE ;
-CREATE TABLE IF NOT EXISTS nodes (
+DROP TABLE IF EXISTS {output_schema}.nodes CASCADE ;
+CREATE TABLE IF NOT EXISTS {output_schema}.nodes (
   id bigserial primary key,
   lon double precision,
   lat double precision,
@@ -32,10 +36,10 @@ CREATE TABLE IF NOT EXISTS nodes (
 );
 
 -- répétition du IF EXISTS pour ouvrir à l'éventualité de la mise à jour
-DROP SEQUENCE IF EXISTS edges_id_seq;
-CREATE SEQUENCE IF NOT EXISTS edges_id_seq;
-DROP TABLE IF EXISTS edges;
-CREATE TABLE IF NOT EXISTS edges (
+DROP SEQUENCE IF EXISTS {output_schema}.edges_id_seq;
+CREATE SEQUENCE IF NOT EXISTS {output_schema}.edges_id_seq;
+DROP TABLE IF EXISTS {output_schema}.edges;
+CREATE TABLE IF NOT EXISTS {output_schema}.edges (
   id bigserial primary key,
   source_id bigserial,
   target_id bigserial,
@@ -81,16 +85,16 @@ CREATE TABLE IF NOT EXISTS edges (
 );
 
 
-CREATE INDEX IF NOT EXISTS nodes_geom_gist ON nodes USING GIST (geom);
-CREATE INDEX IF NOT EXISTS nodes_lon_lat_idx ON nodes(lon,lat);
-CREATE INDEX IF NOT EXISTS edges_geom_gist ON edges USING GIST (geom);
+CREATE INDEX IF NOT EXISTS nodes_geom_gist ON {output_schema}.nodes USING GIST (geom);
+CREATE INDEX IF NOT EXISTS nodes_lon_lat_idx ON {output_schema}.nodes(lon,lat);
+CREATE INDEX IF NOT EXISTS edges_geom_gist ON {output_schema}.edges USING GIST (geom);
 
 -- ####################################
 -- UTILITAIRES DE REMPLISSAGE DU GRAPHE
 -- ####################################
 
 -- Renvoie le srid à partir du code territoire
-CREATE OR REPLACE FUNCTION bduni_srid(code_territoire text) RETURNS int AS $$
+CREATE OR REPLACE FUNCTION {output_schema}.bduni_srid(code_territoire text) RETURNS int AS $$
 BEGIN
   CASE
     WHEN (code_territoire = 'FXX') THEN
@@ -114,12 +118,12 @@ END;
 $$ LANGUAGE plpgsql;
 
 -- Récupération d'un identifiant de sommet en fonction d'un point (égalité stricte)
-CREATE OR REPLACE FUNCTION nodes_id( _geom geometry ) RETURNS bigint AS $$
-  SELECT id FROM nodes WHERE lon = ST_X(_geom) AND lat = ST_Y(_geom);
+CREATE OR REPLACE FUNCTION {output_schema}.nodes_id( _geom geometry ) RETURNS bigint AS $$
+  SELECT id FROM {output_schema}.nodes WHERE lon = ST_X(_geom) AND lat = ST_Y(_geom);
 $$ LANGUAGE SQL ;
 
 -- Renvoie les points intermédiaires d'une linestring en format json
-CREATE OR REPLACE FUNCTION inter_nodes(geom geometry(LineString, 4326)) RETURNS json[] AS $$
+CREATE OR REPLACE FUNCTION {output_schema}.inter_nodes(geom geometry(LineString, 4326)) RETURNS json[] AS $$
   SELECT COALESCE(array_agg(row_to_json(subq)), '{{}}') FROM (
     SELECT
       ST_X((dp).geom) AS lon,
@@ -135,7 +139,7 @@ $$ LANGUAGE SQL;
 -- On doit copier au préalable troncon_de_route pour figer les tronçons car elle est mise à jour en continue
 
 CREATE TEMP TABLE bduni_non_com_tmp AS
-SELECT * FROM non_communication;
+SELECT * FROM {output_schema}.non_communication;
 
 
 -- ############################
@@ -198,11 +202,11 @@ CREATE TEMP TABLE IF NOT EXISTS bduni_troncon AS
       t.cpx_classement_administratif as cpx_classement_administratif,
 
       -- géométrie du troncon
-      ST_Force2D(ST_Transform(ST_SetSrid(t.geometrie, bduni_srid(t.gcms_territoire)), 4326)) as geom
+      ST_Force2D(ST_Transform(ST_SetSrid(t.geometrie, {output_schema}.bduni_srid(t.gcms_territoire)), 4326)) as geom
 
     FROM (
       -- decomposition liens_vers_route_nommee en lien_vers_route_nommee (split et duplication des lignes)
-      SELECT * FROM troncon_de_route
+      SELECT * FROM {output_schema}.troncon_de_route
       -- SELECT t1.*, regexp_split_to_table( t1.liens_vers_route_nommee,'/') as lien_vers_route_nommee FROM troncon_de_route t1
     ) t
   ) s
@@ -222,19 +226,19 @@ WITH t AS (
     UNION
   SELECT ST_Force2D(ST_EndPoint(geom)) as geom FROM bduni_troncon
 )
-INSERT INTO nodes (lon,lat,geom)
-  SELECT ST_X(t.geom),ST_Y(t.geom),t.geom FROM t WHERE nodes_id(t.geom) IS NULL
+INSERT INTO {output_schema}.nodes (lon,lat,geom)
+  SELECT ST_X(t.geom),ST_Y(t.geom),t.geom FROM t WHERE {output_schema}.nodes_id(t.geom) IS NULL
 ;
 
 -- ############################
 -- REMPLISSAGE DE edges
 -- ############################
 
-INSERT INTO edges
+INSERT INTO {output_schema}.edges
   SELECT
-    nextval('edges_id_seq') AS id,
-    nodes_id(ST_StartPoint(geom)) as source_id,
-    nodes_id(ST_EndPoint(geom)) as target_id,
+    nextval('{output_schema}.edges_id_seq') AS id,
+    {output_schema}.nodes_id(ST_StartPoint(geom)) as source_id,
+    {output_schema}.nodes_id(ST_EndPoint(geom)) as target_id,
     ST_X(ST_StartPoint(geom)) as x1,
     ST_Y(ST_StartPoint(geom)) as y1,
     ST_X(ST_EndPoint(geom)) as x2,
@@ -286,8 +290,8 @@ INSERT INTO edges
 -- ############################
 
 -- On ne conserve que les non communications sur la zone de calcul
-DROP TABLE IF EXISTS non_comm;
-CREATE TABLE IF NOT EXISTS non_comm AS
+DROP TABLE IF EXISTS {output_schema}.non_comm;
+CREATE TABLE IF NOT EXISTS {output_schema}.non_comm AS
 SELECT * FROM (
   SELECT
     cleabs,
@@ -295,26 +299,26 @@ SELECT * FROM (
     -- liens_vers_troncon_sortie
     regexp_split_to_table(bduni_non_com_tmp.liens_vers_troncon_sortie, E'/') AS lien_vers_troncon_sortie
   FROM bduni_non_com_tmp
-  WHERE lien_vers_troncon_entree IN (SELECT cleabs from edges) AND NOT gcms_detruit
+  WHERE lien_vers_troncon_entree IN (SELECT cleabs from {output_schema}.edges) AND NOT gcms_detruit
 ) AS non_comm_split
-WHERE non_comm_split.lien_vers_troncon_sortie IN (SELECT cleabs from edges);
+WHERE non_comm_split.lien_vers_troncon_sortie IN (SELECT cleabs from {output_schema}.edges);
 
 -- Remplissage des ids d'edge dans la table des non communications
-ALTER TABLE non_comm ADD COLUMN IF NOT EXISTS id_from bigint;
-ALTER TABLE non_comm ADD COLUMN IF NOT EXISTS id_to bigint;
+ALTER TABLE {output_schema}.non_comm ADD COLUMN IF NOT EXISTS id_from bigint;
+ALTER TABLE {output_schema}.non_comm ADD COLUMN IF NOT EXISTS id_to bigint;
 
-UPDATE non_comm AS b SET id_from = e.id
-FROM edges as e
+UPDATE {output_schema}.non_comm AS b SET id_from = e.id
+FROM {output_schema}.edges as e
 WHERE e.cleabs = b.lien_vers_troncon_entree
 ;
 
-UPDATE non_comm AS b SET id_to = e.id
-FROM edges as e
+UPDATE {output_schema}.non_comm AS b SET id_to = e.id
+FROM {output_schema}.edges as e
 WHERE e.cleabs = b.lien_vers_troncon_sortie
 ;
 
 -- Récupération du point commun entre deux troncons
-CREATE OR REPLACE FUNCTION common_point(id_from bigint, id_to bigint) RETURNS bigint AS $$
+CREATE OR REPLACE FUNCTION {output_schema}.common_point(id_from bigint, id_to bigint) RETURNS bigint AS $$
   SELECT
   CASE
     WHEN a.source_id=b.source_id THEN b.source_id
@@ -323,13 +327,16 @@ CREATE OR REPLACE FUNCTION common_point(id_from bigint, id_to bigint) RETURNS bi
     WHEN a.target_id=b.target_id THEN b.target_id
     ELSE -1
   END
-  FROM edges as a, edges as b
+  FROM {output_schema}.edges as a, {output_schema}.edges as b
   WHERE a.id = id_from
   AND b.id = id_to;
 $$ LANGUAGE SQL ;
 
-ALTER TABLE non_comm ADD COLUMN IF NOT EXISTS common_vertex_id bigint;
-UPDATE non_comm SET common_vertex_id = common_point(non_comm.id_from, non_comm.id_to);
+ALTER TABLE {output_schema}.non_comm ADD COLUMN IF NOT EXISTS common_vertex_id bigint;
+UPDATE {output_schema}.non_comm SET common_vertex_id = {output_schema}.common_point(non_comm.id_from, non_comm.id_to);
+
+DROP FOREIGN TABLE IF EXISTS {output_schema}.troncon_de_route CASCADE;
+DROP FOREIGN TABLE IF EXISTS {output_schema}.non_communication CASCADE;
 
 END TRANSACTION;
 VACUUM ANALYZE;


Test patch:
diff --git a/.github/workflows/test_pypi_publish.yml b/.github/workflows/test_pypi_publish.yml
new file mode 100644
index 0000000..ef43224
--- /dev/null
+++ b/.github/workflows/test_pypi_publish.yml
@@ -0,0 +1,46 @@
+name: Publish Python 🐍 distributions 📦 to TestPyPI
+
+on: 
+  # Runs on pushes targeting the default branch
+  push:
+    branches: ["develop"]
+  pull_request:
+    branches: [ "develop" ]
+
+jobs:
+  build-n-publish:
+    name: Build and publish Python 🐍 distributions 📦 to TestPyPI
+    runs-on: ubuntu-latest
+    
+    steps:
+      - uses: actions/checkout@master
+
+      - name: Set up Python 3.10
+        uses: actions/setup-python@v3
+        with:
+          python-version: "3.10"
+
+      - name: Install pypa/build
+        run: >-
+          python -m
+          pip install
+          build
+          --user
+
+      - name: Build a binary wheel and a source tarball
+        run: >-
+          python -m
+          build
+          --sdist
+          --wheel
+          --outdir dist/
+          .
+
+      - name: Publish distribution 📦 to Test PyPI
+        if: github.event_name != 'pull_request'
+        uses: pypa/gh-action-pypi-publish@release/v1
+        with:
+          verbose: true
+          skip_existing: true
+          password: ${{ secrets.TEST_PYPI_TOKEN }}
+          repository_url: https://test.pypi.org/legacy/
diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml
new file mode 100644
index 0000000..10439ad
--- /dev/null
+++ b/.github/workflows/unit-test.yml
@@ -0,0 +1,57 @@
+
+name: Unit tests
+
+on:
+  pull_request:
+    paths:
+    - ".github/workflows/unit-test.yml"
+    - "**/*.py"
+
+permissions:
+  contents: read
+  pull-requests: write
+
+env:
+  POSTGRES_VERSION: "15"
+  POSTGIS_VERSION: "3.0"
+  POSTGRES_DB: ign
+  POSTGRES_USER: ign
+  POSTGRES_PASSWORD: ign
+  POSTGRES_HOST: "172.17.0.1"
+
+jobs:
+  test:
+    name: Run unit tests
+    runs-on: ubuntu-latest
+    
+    container: 'ghcr.io/ignf/route-graph-generator:latest'
+
+    services:
+      postgis:
+        image: postgis/postgis # unable to handle var in image name. Was: "postgis/postgis:${POSTGRES_VERSION}-${POSTGIS_VERSION}-alpine"
+        env:
+          POSTGRES_DB: ign # mandatory duplicate
+          POSTGRES_USER: ign # mandatory duplicate
+          POSTGRES_PASSWORD: ign # mandatory duplicate
+        ports:
+          # Maps tcp port 5555 on service container to the host
+          - 5555:5432
+
+    steps:
+
+      - uses: actions/checkout@v3
+
+      - name: Install test dependencies
+        run: |
+            pip install -r requirements/testing.txt
+
+      - name: Run test
+        run: |
+          python -m pytest
+
+      - name: Get Coverage
+        uses: orgoro/coverage@v3
+        with:
+          coverageFile: coverage.xml
+          token: ${{ secrets.GITHUB_TOKEN }}
+
diff --git a/docs/development/testing.md b/docs/development/testing.md
new file mode 100644
index 0000000..4486bc3
--- /dev/null
+++ b/docs/development/testing.md
@@ -0,0 +1,33 @@
+# Tests
+
+## Prérequis de l'environnement de test
+
+- Docker >= 20.10
+- Construction de l'image 
+
+La construction de l'image est lancée avec une commande :  
+
+```sh
+docker build -t r2gg-debian -f docker/debian/Dockerfile .
+```
+
+## Initialisation de la base de données de tests
+
+```sh
+```
+docker-compose -f tests/dev/docker-compose.dev.yml up -d
+```
+
+Mot de passe de l'utilisateur en base : `ign`
+
+## Exécution des tests dans l'image docker
+
+```sh
+docker run -it -v $(pwd):/r2gg r2gg-debian bash
+```
+
+```sh
+cd /r2gg
+pip install -U -r requirements/testing.txt
+pytest
+```
diff --git a/requirements/testing.txt b/requirements/testing.txt
new file mode 100644
index 0000000..b90c448
--- /dev/null
+++ b/requirements/testing.txt
@@ -0,0 +1,3 @@
+# Testing dependencies
+# --------------------
+pytest-cov>=4,<5
\ No newline at end of file
diff --git a/tests/.gitignore b/tests/.gitignore
new file mode 100644
index 0000000..bee8a64
--- /dev/null
+++ b/tests/.gitignore
@@ -0,0 +1,1 @@
+__pycache__
diff --git a/tests/config/.gitignore b/tests/config/.gitignore
new file mode 100644
index 0000000..4525746
--- /dev/null
+++ b/tests/config/.gitignore
@@ -0,0 +1,2 @@
+updated_sql2pivot.json
+updated_pivot2osm.json
\ No newline at end of file
diff --git a/tests/config/bdtopo_base.json b/tests/config/bdtopo_base.json
new file mode 100644
index 0000000..01c04b2
--- /dev/null
+++ b/tests/config/bdtopo_base.json
@@ -0,0 +1,1 @@
+{"host": "172.17.0.1", "database": "ign", "user": "ign", "password": "ign", "port": "5555"}
\ No newline at end of file
diff --git a/tests/config/pivot2osm.json b/tests/config/pivot2osm.json
new file mode 100644
index 0000000..e3b85ad
--- /dev/null
+++ b/tests/config/pivot2osm.json
@@ -0,0 +1,37 @@
+{
+  "generation": {
+    "general":{
+      "id": "pivot2osm",
+      "logs": {"configFile": "/home/docker/config/sample_log_config.json"},
+      "overwrite": true,
+      "operation": "creation"
+    },
+    "bases": [
+      {
+        "id": "input",
+        "type": "bdd",
+        "configFile": "{src_dir}/tests/config/pivot_base.json",
+        "schema": "output"
+      }
+    ],
+    "workingSpace": {
+      "directory": "/home/docker/data/generation/",
+      "baseId": "input"
+    },
+    "resource": {
+      "id": "pivot-osm",
+      "type": "osrm",
+      "sources": [
+        {
+          "id": "pivot-osm",
+          "type": "osrm",
+          "bbox": "-180,-90,180, 90",
+          "mapping":
+          {
+            "source": {"baseId": "input"}
+          }
+        }
+      ]
+    }
+  }
+}
\ No newline at end of file
diff --git a/tests/config/pivot_base.json b/tests/config/pivot_base.json
new file mode 100644
index 0000000..2b92781
--- /dev/null
+++ b/tests/config/pivot_base.json
@@ -0,0 +1,1 @@
+{"host": "172.17.0.1", "database": "pivot", "user": "ign", "password": "ign", "port": "5555"}
\ No newline at end of file
diff --git a/tests/config/sql2pivot.json b/tests/config/sql2pivot.json
new file mode 100644
index 0000000..f769626
--- /dev/null
+++ b/tests/config/sql2pivot.json
@@ -0,0 +1,43 @@
+{
+  "generation": {
+    "general":{
+      "id": "sql2pivot",
+      "logs": {"configFile": "/home/docker/config/sample_log_config.json"},
+      "overwrite": true,
+      "operation": "creation"
+    },
+    "bases": [
+      {
+        "id": "bdtopo",
+        "type": "bdd",
+        "configFile": "{src_dir}/tests/config/bdtopo_base.json",
+        "schema": "input"
+      },
+      {
+        "id": "pivot",
+        "type": "bdd",
+        "configFile": "{src_dir}/tests/config/pivot_base.json",
+        "schema": "output"
+      }
+    ],
+    "workingSpace": {
+      "directory": "/home/docker/data/generation/",
+      "baseId": "pivot"
+    },
+    "resource": {
+      "id": "bdtopo_conversion",
+      "sources": [
+        {
+          "id": "output_source",
+          "type": "pgr",
+          "bbox": "-180,-90,180, 90",
+          "mapping":
+          {"source": {"baseId": "bdtopo"},
+            "conversion":
+            {"file": "{src_dir}/sql/bdtopo_v3.3.sql"}
+          }
+        }
+      ]
+    }
+  }
+}
\ No newline at end of file
diff --git a/tests/dev/docker-compose.dev.yml b/tests/dev/docker-compose.dev.yml
new file mode 100644
index 0000000..a407269
--- /dev/null
+++ b/tests/dev/docker-compose.dev.yml
@@ -0,0 +1,11 @@
+version: "3"
+services:
+  r2gg-db-postgis:
+    image: postgis/postgis:15-3.3-alpine
+    environment:
+      POSTGRES_DB: ign
+      POSTGRES_PASSWORD: ign
+      POSTGRES_USER: ign
+      POSTGRES_INITDB_ARGS: "--data-checksums"
+    ports:
+      - 5555:5432
diff --git a/tests/test_cli.py b/tests/test_cli.py
new file mode 100644
index 0000000..1e170b7
--- /dev/null
+++ b/tests/test_cli.py
@@ -0,0 +1,132 @@
+import argparse
+import json
+import os
+from pathlib import Path
+from urllib import request
+
+# 3rd party
+import pytest
+from unittest.mock import patch
+
+from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
+
+from r2gg import cli
+
+import psycopg2 as psycopg
+
+cur_dir = Path(__file__).parent.absolute()
+
+# ############################################################################
+# ########## Classes #############
+# ################################
+HOST = os.environ.get("POSTGRES_HOST", "172.17.0.1")
+PORT = os.environ.get("PORT", 5555)
+DBNAME = os.environ.get("POSTGRES_DB", "ign")
+USER = os.environ.get("POSTGRES_USER", "ign")
+PASS = os.environ.get("POSTGRES_PASSWORD", "ign")
+
+# Schemas are defined in input configuration .json files
+INPUT_SCHEMA = "input"
+OUTPUT_SCHEMA = "output"
+
+TRONCON_ROUTE_URL = "https://storage.gra.cloud.ovh.net/v1/AUTH_366279ce616242ebb14161b7991a8461/road2/troncon_route_marseille10.sql"
+NON_COMMUNICATION_URL = "https://storage.gra.cloud.ovh.net/v1/AUTH_366279ce616242ebb14161b7991a8461/road2/non_communication_marseille10.sql"
+
+@pytest.fixture
+def init_database(tmp_path) -> None:
+    """Init database for test."""
+
+    con = psycopg.connect(host=HOST, dbname=DBNAME, user=USER, password=PASS, port=PORT)
+    con.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT)
+    con.cursor().execute(f"CREATE SCHEMA IF NOT EXISTS {INPUT_SCHEMA}")
+    con.cursor().execute(f"CREATE DATABASE pivot")
+    con.commit()
+    con.close()
+
+    # Insert test data
+    con = psycopg.connect(host=HOST, dbname=DBNAME, user=USER, password=PASS, port=PORT)
+    cur = con.cursor()
+    cur.execute(f"SET search_path TO {INPUT_SCHEMA}")
+
+    request.urlretrieve(TRONCON_ROUTE_URL, tmp_path / "troncon_route_marseille10.sql")
+    request.urlretrieve(NON_COMMUNICATION_URL, tmp_path / "non_communication_marseille10.sql")
+
+    with open(str(tmp_path / "troncon_route_marseille10.sql"), mode="r") as sql_script:
+        cur.execute(sql_script.read())
+    with open(str(tmp_path / "non_communication_marseille10.sql"), mode="r") as sql_script:
+        cur.execute(sql_script.read())
+
+    con.commit()
+    con.close()
+
+    # Add extensions to pivot
+    con = psycopg.connect(host=HOST, dbname="pivot", user=USER, password=PASS, port=PORT)
+    con.cursor().execute(f"CREATE SCHEMA IF NOT EXISTS {OUTPUT_SCHEMA}")
+    con.cursor().execute("CREATE EXTENSION IF NOT EXISTS postgres_fdw")
+    con.cursor().execute("CREATE EXTENSION IF NOT EXISTS Postgis")
+    con.commit()
+    con.close()
+    yield
+
+    con = psycopg.connect(host=HOST, dbname=DBNAME, user=USER, password=PASS, port=PORT)
+    con.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT)
+    con.cursor().execute("DROP DATABASE pivot")
+    con.cursor().execute(f"DROP TABLE {INPUT_SCHEMA}.non_communication")
+    con.cursor().execute(f"DROP TABLE {INPUT_SCHEMA}.troncon_de_route")
+    con.commit()
+    con.close()
+
+
+def update_src_dir_json(file_path: Path, output_file_path: Path):
+    """Update .json file to replace {src_dir} by current source directory
+
+    Parameters
+    ----------
+    file_path (Path) database .json file path
+    """
+    with open(file_path, mode="r") as f:
+        content = f.read().replace("{src_dir}", str(Path(cur_dir / "..").resolve()))
+
+    with open(output_file_path, mode="w") as f:
+        f.write(content)
+
+
+def sql2pivot():
+    """Simple run of cli for pivot base creation."""
+    # Update input json file to indicate current source directory
+    update_src_dir_json(cur_dir / "config" / "sql2pivot.json", cur_dir / "config" / "updated_sql2pivot.json")
+
+    # mock ArgumentParser for configuration file
+    with patch("argparse.ArgumentParser.parse_args") as parse_arg_mock:
+        parse_arg_mock.return_value = argparse.Namespace(
+            config_file_path=str(cur_dir / "config" / "updated_sql2pivot.json"))
+        # Run conversion
+        cli.sql2pivot()
+
+
+def test_sql2pivot(init_database):
+    """Test simple run of cli for pivot base creation."""
+    sql2pivot()
+
+
+def pivot2osm():
+    """Simple run of cli for osm file creation from pivot database."""
+    # Update input json file to indicate current source directory
+    update_src_dir_json(cur_dir / "config" / "pivot2osm.json", cur_dir / "config" / "updated_pivot2osm.json")
+
+    # mock ArgumentParser for configuration file
+    with patch("argparse.ArgumentParser.parse_args") as parse_arg_mock:
+        parse_arg_mock.return_value = argparse.Namespace(
+            config_file_path=str(cur_dir / "config" / "updated_pivot2osm.json"))
+        # Run conversion
+        cli.pivot2osm()
+
+        assert os.path.exists("/home/docker/data/generation/pivot-osm.osm")
+
+
+def test_pivot2osm(init_database):
+    """Test simple run of cli for osm file creation from pivot database."""
+
+    sql2pivot()
+    pivot2osm()
+