Deploy Everyday Jojo's Life and Internet

A Recipe for Poetry and CircleCI

Last week I wrote a Python library using Poetry to manage its dependencies and for publishing it to PyPI. So far, the experience has been fantastic.


Poetry helps you declare, manage and install dependencies of Python projects, ensuring you have the right stack everywhere.

Poetry is so cool! It does a lot of things, including:

  • Manages Python dependencies really well, using the new standardized pyproject.toml.
  • Separates dependencies and dev dependencies.
  • Deals with the virtual environment for you.
  • Has one (one!) command to build and publish the package to PyPI.

After Poetry was up and running, I needed to hook it up with a Continuous Integration & Continuos Delivery tool to run our builds and publish the lib to PyPI. Enters CircleCI.


CircleCI is a CI/CD platform. It runs certain workflows in a certain environment when a certain event happens. Very specific, right?

Let me give you two examples:

  • Whenever I open a PR at GitHub, I want to checkout the new code and run the tests.
  • Whenever I create a new release at GitHub, I’d like to run the step defined before and publish it to a package repository.

This is what CircleCI can do for you! On top of that, the tool is free for open source projects ✨

All the nitty gritty from the examples above are configured in a .circleci/config.yml file. There, you can specify which kind of environment you want to have (Python?, Node?), what commands you want to execute (install dependencies? run tests?) and when they should be execute (new PR? new release?).

The catch of my adventure was to figure it out how Poetry and CircleCI could be good friends ❤️

The Recipe

First of all, no change was needed in the Poetry configuration file – just make sure you have the libraries used in the CircleCI jobs: flake8 and coveralls. The file below is the .circleci/config.yml.

Second, it took me a while to figure out the whole cache thing, but everything seems to be working nicely now ?

Finally, here is how you can make this friendship thrive!

I hope this article helped you to get into Poetry with CircleCI! If you have any feedback, please leave them in the comments ?

Share this on