Skip to main content

A plugin for tox that utilizes PDM as the package manager and installer

Project description

tox-pdm

A plugin for tox that utilizes PDM as the package manager and installer.

Github Actions PyPI pre-commit Code style: black Tox Versions

With this plugin, you can migrate your project to PDM while retaining the ability to test against multiple versions.

Installation

$ pip install tox-pdm

Or,

$ pdm add -d tox-pdm

Or if you installed tox via pipx, you can inject the plugin by:

$ pipx inject tox tox-pdm

Example tox.ini

The following simple example installs dev and test dependencies into the venv created by Tox and uses pytest to execute the tests, on both Python 3.7 and 3.8.

[tox]
envlist = py37,py38
isolated_build = True  ; This is required for a pyproject.toml based project.

[testenv]
groups =  ; Dependency groups in pyproject.toml
    dev
    test
deps =      ; Additional dependencies, it will be installed into the library path via normal pip method
    flake8
commands =
    pytest test/

Here is another one installing the test dependencies and executing the test PDM script

[tox]
envlist = py3{8,9,10}
isolated_build = True  ; This is required for a pyproject.toml based project.

[testenv]
groups = test
commands = test

A real-world example can be found at this repository's tox.ini and GitHub Action workflow.

Some best practices:

  1. pdm executable must be exposed in PATH, if it is not the case, give the absolute path to tox by tox --pdm <path_to_pdm>.
  2. Make sure you have generated pdm.lock before running the test, it will greatly accelerate the testing.
  3. If you don't set skip_install = true, the current package will be built and installed into the testing environment together with the dependencies from pyproject.toml.
  4. Reuse your PDM scripts to avoid duplication

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

tox-pdm-0.6.1.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

tox_pdm-0.6.1-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file tox-pdm-0.6.1.tar.gz.

File metadata

  • Download URL: tox-pdm-0.6.1.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for tox-pdm-0.6.1.tar.gz
Algorithm Hash digest
SHA256 952ea67f2ec891f11eb00749f63fc0f980384435ca782c448d154390f9f42f5e
MD5 6ad09719f4cb152e252ba647b87798c3
BLAKE2b-256 5742c437d69c3b884c58027999e524c91716ac355048284be771d810d80ceed1

See more details on using hashes here.

Provenance

File details

Details for the file tox_pdm-0.6.1-py3-none-any.whl.

File metadata

  • Download URL: tox_pdm-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for tox_pdm-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9e3cf83b7b55c3e33aaee0e65cf341739581ff4604a4178f0ef7dbab73a0bb35
MD5 8a303a9ddf2d4cd04a0b9cd562c04bab
BLAKE2b-256 dd2e9c694f9775e3bd6e9eadf6c38fdc9f2e55d2ecbc7a4bba30eecf2a4b7f91

See more details on using hashes here.

Provenance

Supported by

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