---
title: "Use custom Python modules from a Git repository"
description: "In some cases, you will want to use your own and already existing Python code"
url: https://docs.ovhcloud.com/en/guides/public-cloud/data-platform/developers-python-sdk-git
lang: en
lastUpdated: 2026-09-14
---
> For AI agents: the complete documentation index is available at https://docs.ovhcloud.com/en/llms.txt, the full documentation bundle is available at https://docs.ovhcloud.com/en/llms-full.txt.

# Use custom Python modules from a Git repository

## Objective

In some cases, you will want to use your own and already existing Python code.

In order to import your custom Python modules and use it in a [Custom action](https://docs.ovhcloud.com/en/guides/public-cloud/data-platform/dpe-actions-custom.md), you may refer to an external Git repository that will be pulled before each build of your job.

Here are the steps in order to use an external Git repository as a Python module:

1. Adapt your module so that its compatible with `pip install`

- see [setuptools documentation](https://packaging.python.org/guides/distributing-packages-using-setuptools/)

2. Your Python module must be hosted on an accessible host, if repository is private, you need to get an `access token`.
   For instance, in [GitHub](https://github.com), you must generate a **personal access token**
   (Other providers may have similar procedures)

- [how to set tokens](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token)
- [set your personal token in GitHub](https://github.com/settings/tokens)

3. Check that downloading of the package works well with your token

- Zip Archive: `https://<access_token>@github.com/<myorg>/<myProject>/archive/<ref>.zip`
- Git: `git+https://<access_token>@github.com/<myorg>/<myProject>.git`
- Git with a tag name or commit hash: `git+https://<access_token>@github.com/<myorg>/<myProject>.git@<tag>`
- Git with automatic latest release: `git+https://<access_token>@github.com/<myorg>/<myProject>.git@latest`

4. Check that `pip install` works with your URL on your local computer

```bash
pip install <URL>
```

5. In your project, in a custom action, add the dependencies in the **Advanced Mode** in `forepaas.json`:

- with a HTTPS Zip archive

```json
      {
        "dependencies": {
          "python": {
            "https://<access_token>@github.com/<myorg>/<myProject>/archive/<ref>.zip": null
          }
        }
      }
```

- with a Git+HTTPS repository

```json
      {
        "dependencies": {
          "python": {
            "git+https://<access_token>@github.com/<myorg>/<myProject>.git": null
          }
        }
      }
```

- with a Git+HTTPS repository, including a `tag` name or a `commit hash`

```json
      {
        "dependencies": {
          "python": {
            "git+https://<access_token>@github.com/<myorg>/<myProject>.git@<tag>": null
          }
        }
      }
```

- with a Git+HTTPS repository, automatically using the latest release

```json
      {
        "dependencies": {
          "python": {
            "git+https://<access_token>@github.com/<myorg>/<myProject>.git@latest": null
          }
        }
      }
```

:::info
**Auto-resolving the latest release:** Using `@latest` at the end of a `git+` dependency URL instructs the platform to automatically fetch and substitute the most recent release tag before installing. This removes the need to update each action's dependency manually when a new version of your module is published, click **Force Build** to pick up the new release. Note that the latest release is not detected automatically at runtime, a manual **Force Build** is always required.
:::

:::warning
Pinning a specific `tag` or `commit hash` gives you precise control over which version is used at execution time and is recommended for production workloads.
:::

6. In your custom action python code, you can now import and use it!

```python
import mypackage
```

## Go further

If you need training or technical assistance to implement our solutions, contact your sales representative or click on [this link](https://www.ovhcloud.com/en-gb/professional-services/) to get a quote and ask our Professional Services experts for a custom analysis of your project.

Ask questions, give your feedback and interact directly with the team building the Data Platform on the dedicated [Discord channel](https://discord.gg/ovhcloud).

If you need support with your OVHcloud services, create a request in our [Help Centre](https://help.ovhcloud.com/csm?id=csm_get_help).

Join our [community of users](https://community.ovhcloud.com/).
