Skip to main content

How to bootstrap a new integration package

This guide walks through the process of publishing a new LangChain integration package to PyPi.

Integration packages are just Python packages that can be installed with pip install <your-package>, which contain classes that are compatible with LangChain's core interfaces.

In this guide, we will be using Poetry for dependency management and packaging, and you're welcome to use any other tools you prefer.

Prerequisites

Boostrapping a new Python package with Poetry

First, install Poetry:

pip install poetry

Next, come up with a name for your package. For this guide, we'll use langchain-parrot-link. You can confirm that the name is available on PyPi by searching for it on the PyPi website.

Next, create your new Python package with Poetry, and navigate into the new directory with cd:

poetry new langchain-parrot-link
cd langchain-parrot-link

Add main dependencies using Poetry, which will add them to your pyproject.toml file:

poetry add langchain-core

We will also add some test dependencies in a separate poetry dependency group. If you are not using Poetry, we recommend adding these in a way that won't package them with your published package, or just installing them separately when you run tests.

langchain-tests will provide the standard tests we will use later. We recommended pinning these to the latest version:

Note: Replace <latest_version> with the latest version of langchain-tests below.

poetry add --group test pytest pytest-socket pytest-asyncio langchain-tests==<latest_version>

And finally, have poetry set up a virtual environment with your dependencies, as well as your integration package:

poetry install --with test

You're now ready to start writing your integration package!

See our component-specific guides for detail on implementing and testing each component.

Push your package to a public Github repository

This is only required if you want to publish your integration in the LangChain documentation.

  1. Create a new repository on GitHub.
  2. Push your code to the repository.
  3. Confirm that your repository is viewable by the public (e.g. in a private browsing window, where you're not logged into Github).

Next Steps

Now that you've bootstrapped your package, you can move on to implementing and testing your integration.


Was this page helpful?