Skip to main content

Dependency management via Pipfile

Project description

setuptools-pipfile

Dependency management via Pipfile

Travis (.org) PyPI Python

Overview

In basic mode setuptools-pipfile does the following:

  • Populates install_requires from the packages table.
  • Populates tests_require from the dev-packages table.
  • Populates dependency_links from the source tables if needed by dependencies.

Advanced configuration can be used to control:

  • The path to the Pipfile.
  • Variable interpolation.
  • Activate and control populating extras_require.
  • Control populating python_requires.

To understand why this isn't enabled by default see Advanced Usage.

Basic Usage

Add setuptools-pipfile to setup_requires and use_pipfile=True in your setup.py.

This assumes that the Pipfile is in the same file directory as setup.py.

If the Pipfile is located elsewhere you can set use_pipfile to a path relative to setup.py.

Advanced Usage

These are features that aren't currently provided by pipenv but hope they will be in the future.

To enable advanced mode simply provide a dict of options to use_pipfile.

Pipfile Path

To change the path in advanced mode simply set the path key

setup(use_pipfile={'path': 'src/Pipfile'})

Environment Variable Interpolation

If this pipenv feature is required for some reason it can reenabled by setting the interpolate key.

setup(use_pipfile={'interpolate': True})

Populate Python Requires

Pipfile currently locks to a specific minor version. This is copied to Pipfile.lock. A better behaviour would be to allow defining a range of permissible versions. Then upon running pipenv install a concreate version is locked into Pipfile.lock.

To enable this in the future set the pythons key to True.

To change the key to lookup set the pythons key to an alternate format string.

setup(use_pipfile={'pythons': '{0[requires][python_versions]}'})

Populate Extras

This is currently not supported by Pipfile but if it does it will likely be supported in one of two ways.

Style One

The first and more likely style looks like so:

[extra.socks]
PySocks = {version = ">=1.5.6, !1.5.7"}
win_inet_pton = {sys_platform = "win32", python_version = "2.7"}

To use the default setup for style one:

setup(use_pipfile={'extras': True})

To change the prefix for the table to something like [option.socks] use:

setup(use_pipfile={'extras': {'table': 'option'}})

Style Two

The second style is based on poetry syntax.

[[extra]]
name = "socks"

[extra.packages]
PySocks = {version = ">=1.5.6, !1.5.7"}
win_inet_pton = {sys_platform = "win32", python_version = "2.7"}

To use the default setup for style two:

setup(use_pipfile={'extras': {'style': 2}})

Like style one use the table field to change the table prefix.

setup(use_pipfile={'extras': {'style': 2, 'table': 'option'}})

Use the subtable field to change the suffix used to describe the packages.

setup(use_pipfile={'extras': {'style': 2, 'subtable': 'requires'}})

To change the packaging suffix to something like [extras.require] use:

setup(use_pipfile={'extras': {'style': 2, 'table': 'extras', 'subtable': 'require'}})

Finally to change the key used to identify the extra group use:

setup(use_pipfile={'extras': {'style': 2, 'key': 'title'}})

This would result in:

[[extra]]
title = "socks"

Future State

While there is no current plan to develop this further, the future is always changing. If pipenv and the Pipfile implements a different way to do something this will change with it. That being said any breaking changes will be accompanied by a major version increment.

To ensure future compatibility either:

  • make sure dependency on this package has an upper bounds on the major version
  • or explicitly set all configuration options.

For example to enable extras style 1 and hard set all the current defaults

setup(
    use_pipfile={
        'path': 'Pipfile',
        'interpolate': False,
        'pythons': False,
        'extras': {
            'style': 1,
            'table': 'extra'
        }
    }
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

setuptools-pipfile-0.3.1.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

setuptools_pipfile-0.3.1-py2.py3-none-any.whl (6.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file setuptools-pipfile-0.3.1.tar.gz.

File metadata

  • Download URL: setuptools-pipfile-0.3.1.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.0

File hashes

Hashes for setuptools-pipfile-0.3.1.tar.gz
Algorithm Hash digest
SHA256 0c6897e97b37e524b4ddcd0c5d5506c7780787908a009dad6e945cc9ba027a3a
MD5 8b78f4556996dff6f6749c3d1207a446
BLAKE2b-256 d77707350b220b6854239cfff557b56260ea06c0a1a56164c666504c0981f94a

See more details on using hashes here.

File details

Details for the file setuptools_pipfile-0.3.1-py2.py3-none-any.whl.

File metadata

  • Download URL: setuptools_pipfile-0.3.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.0

File hashes

Hashes for setuptools_pipfile-0.3.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bb6f8e6f33094e5bac96a4bee2a7bd944166d743a825cca2bb02021c914aaee2
MD5 240162df772d065d82decac7c831ee01
BLAKE2b-256 0d19322853a26fb479d4237fb6ff210e7aa0ec4b71ecceb6c3d00c8d8a0795da

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page