anonymous visit counting for clients without JavaScript
Skip to content

Python packages development using Pipenv

I have been using Pipenv for Python applications since 2018 quite successfully. However, when developing Python packages, things can get trickier. This is a quick note on how I resolve this situation.

Technical Details#

When starting the development of a Python package, we can setup our Python environment using pipenv:

pipenv install --dev --python 3.8

Let's add the now standard configuration file. Let's say our new package is using requests as a runtime dependency and pytest as a test dependency:

from setuptools import setup

    description="A great Python package",
    author="Romain Clement",
    license="Apache License, Version 2.0",
    extras_require={"test": ["pytest"]},

We can now modify our Pipfile to instruct to use the current package as a dev dependency:

url = ""
verify_ssl = true
name = "pypi"


my-package = {editable = true, path = ".", extras = ["test"]}

python_version = "3.8"

And update your environment with pipenv install -d: it will automatically install all the requirements specified in on besides the ones in Pipfile.

This setup allows the DRY pattern: specify package requirements in, specify development environment and requirements in Pipfile (Python version, code coverage, linting, formatter). As simple as that!

I have recently used this pattern when starting the development of datasette-dashboards, a plugin to generate data dashboards in datasette.