Skip to main content

Utilities for editing tox.ini

Project description

codemod-tox

Handles parsing and modifying some basic tox.ini configuration strings.

# ToxEnvlist.parse("py{37,38}, style")
envlist = py{37,38}, style

# ToxEnv.parse("foo")
[toxenv:foo]

# ToxConditional.parse("-rrequirements.txt\nflask: flask>0")
deps = -rrequirements.txt
       flask: flask>0

You can then do basic modifications on them, or expand by iterating.

>>> str(ToxEnv.parse("py37") | "py38")
"py3{7,8}"
>>> (ToxEnv.parse("py37") | "py38").startswith("py")
True
>>> list(ToxEnv.parse("py37") | "py38")
["py37", "py38"]
>>> str(ToxEnvlist.parse("py37, style").transform_matching(
...     (lambda x: x.startswith("py3")),
...     (lambda y: y | "py38"),
... ))
"py3{7,8}, style"

Version Compat

Usage of this library should work back to 3.7, but development (and mypy compatibility) only on 3.10-3.12. Linting requires 3.12 for full fidelity.

Versioning

This library follows meanver which basically means semver along with a promise to rename when the major version changes.

License

codemod-tox is copyright Tim Hatch, and licensed under the MIT license. See the LICENSE file for details.

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

codemod_tox-0.5.0.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

codemod_tox-0.5.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file codemod_tox-0.5.0.tar.gz.

File metadata

  • Download URL: codemod_tox-0.5.0.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for codemod_tox-0.5.0.tar.gz
Algorithm Hash digest
SHA256 6372a3092fb44d0d3f3e3c95a263b79b3735fb0107b9a03bb84e82a4990b320a
MD5 9d4b821dcf2b3440e7255889022a71ab
BLAKE2b-256 2fae90d1bbd79af3eb30b4eaf1bd0dd13a29343f761b47a3dd80b22e50f71a65

See more details on using hashes here.

Provenance

The following attestation bundles were made for codemod_tox-0.5.0.tar.gz:

Publisher: build.yml on advice-animal/codemod-tox

Attestations:

File details

Details for the file codemod_tox-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: codemod_tox-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for codemod_tox-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 56f6d48e28b2fd9ec1ddd30202260a294cf7dfe113b0ad742424f85af2765d21
MD5 c49d93758f7c99d8ba48accf1cc3e860
BLAKE2b-256 7ab3b88299a22b641a937bae8f48aef5b16d139d10ef902af8359378b1f9a6d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for codemod_tox-0.5.0-py3-none-any.whl:

Publisher: build.yml on advice-animal/codemod-tox

Attestations:

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