{"id":16420273,"url":"https://github.com/rpkilby/tox-factor","last_synced_at":"2025-06-11T16:38:20.427Z","repository":{"id":57476729,"uuid":"175318618","full_name":"rpkilby/tox-factor","owner":"rpkilby","description":"Run a subset of tox test envs, based on factor matching.","archived":false,"fork":false,"pushed_at":"2024-01-07T11:03:48.000Z","size":28,"stargazers_count":12,"open_issues_count":6,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-08T00:05:33.427Z","etag":null,"topics":["python","testing","tox"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rpkilby.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-13T00:44:36.000Z","updated_at":"2025-05-29T11:14:03.000Z","dependencies_parsed_at":"2024-06-21T04:10:19.001Z","dependency_job_id":null,"html_url":"https://github.com/rpkilby/tox-factor","commit_stats":{"total_commits":37,"total_committers":2,"mean_commits":18.5,"dds":"0.027027027027026973","last_synced_commit":"bb36b281c8719af23c21ce78528f864bcdbd2e3e"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/rpkilby/tox-factor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rpkilby%2Ftox-factor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rpkilby%2Ftox-factor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rpkilby%2Ftox-factor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rpkilby%2Ftox-factor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rpkilby","download_url":"https://codeload.github.com/rpkilby/tox-factor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rpkilby%2Ftox-factor/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259299125,"owners_count":22836477,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","testing","tox"],"created_at":"2024-10-11T07:27:28.258Z","updated_at":"2025-06-11T16:38:20.406Z","avatar_url":"https://github.com/rpkilby.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tox-factor\n\n[![CircleCI](https://circleci.com/gh/rpkilby/tox-factor.svg?style=shield)](https://circleci.com/gh/rpkilby/tox-factor)\n[![Appveyor](https://ci.appveyor.com/api/projects/status/8yqgrr22dct9rxxg?svg=true)](https://ci.appveyor.com/project/rpkilby/tox-factor)\n[![codecov](https://codecov.io/gh/rpkilby/tox-factor/branch/master/graph/badge.svg)](https://codecov.io/gh/rpkilby/tox-factor)\n[![version](https://img.shields.io/pypi/v/tox-factor.svg)](https://pypi.python.org/pypi/tox-factor)\n[![python](https://img.shields.io/pypi/pyversions/tox-factor.svg)](https://pypi.org/project/tox-factor/)\n[![license](https://img.shields.io/pypi/l/tox-factor.svg)](https://pypi.python.org/pypi/tox-factor)\n\n## What is tox-factor?\n\ntox-factor enables running a subset of tox test envs, based on factor matching.\n\n\n## Okay, but what does that *actually* mean?\n\nTake the following tox config:\n\n```ini\n[tox]\nenvlist =\n    py{35,36,37}-django{20,21,22}-{redis,memcached}\n```\n\nThe above defines 18 test envs, based on three factor groups - the python\nversion, the django version, and a caching backend. While the above is powerful,\ntox does not provide a way to run builds based on a subset of those factors.\nFor example, the call to run all Python 3.7 builds would be:\n\n```shell\n$ tox -e py37-django20-redis,py37-django20-memcached,py37-django21-redis,py37-django21-memcached,py37-django22-redis,py37-django22-memcached\n```\n\ntox-factor functions similarly to the `-e \u003cenv name\u003e` argument, except it runs\nall envs that match the given factor. The six `py37` builds could be ran with:\n\n```shell\n$ tox -f py37\n```\n\nIn addition to ease of use when running tox locally, this is useful for some CI\nsetups. For example, two common tox CI patterns are to either:\n\n- Define a CI job for each tox test env. e.g.,\n\n    `tox -e py37-django20-redis`\n\n- Define a CI job for a common environment that runs multiple test envs. e.g.,\n\n    `tox -e py37-django20-redis,py37-django20-memcached,...`\n\nFor the latter case, this plugin eases maintenance of CI, as it could be\nshortened to `tox -f py37`. Additionally, take the following update to the above\ntox config:\n\n```ini\n[tox]\nenvlist =\n    py{35,36,37}-django{20,21,22}-{redis,memcached}\n    py{36,37,38}-django{30}-{redis,memcached}\n```\n\nBy using tox-factor, it wouldn't be necessary to update the Python 3.7 build, as\nthe new `py37-django30-*` env would be matched automatically.\n\n\n\n## Verifying the matched test envs\n\nIf you want to verify which test envs are actually ran, combine the factor\nmatching with the `-l` flag. This will display all test envs that match. e.g.,\n\n```shell\n$ tox -f py37 -l\npy37-django20-redis\npy37-django20-memcached\npy37-django21-redis\npy37-django21-memcached\npy37-django22-redis\npy37-django22-memcached\n```\n\n\n## Usage details\n\nThe factor option accepts a comma-separated list (similar to the `-e` option).\n```shell\n$ tox -f py27,py37 -l\npy27-django111\npy37-django21\n```\n\nAlternatively, factors can be provided via the `TOXFACTOR` environment variable:\n```shell\n$ TOXFACTOR=py27,py37 tox -l\npy27-django111\npy37-django21\n```\n\nFactors can also match non-generative env names. For example, given the\nfollowing tox config:\n\n```ini\n[tox]\nenvlist =\n    py{35,36,37}-django20\n\n[testenv:list]\n```\n\nThen the following would match:\n\n```shell\n$ tox -f py37,lint -l\npy37-django20\nlint\n```\n\nFactors are always superseded by a given `toxenv`. For example, tox-factor would\nnoop in the following cases:\n\n```shell\n$ tox -f py37 -e py35-django21 -l\npy35-django21\n\n$ TOXENV=py35-django21 tox -f py37 -l\npy35-django21\n```\n\nFactors do not support partial matching. `tox -f py3` would not match `py37`.\nHowever, factors may match disparate dash-separated parts. Given the following:\n```ini\n[tox]\nenvlist =\n    py{35,36,37}-django{20,21,22}-{redis,memcached}\n```\n\nThen `tox -f py37-redis` would match:\n```\npy37-django20-redis\npy37-django21-redis\npy37-django22-redis\n```\n\n\n## Release Process\n\n- Update changelog\n- Update package version in setup.py\n- Create git tag for version\n- Upload release to PyPI test server\n- Upload release to official PyPI server\n\n```shell\n$ pip install -U pip setuptools wheel twine\n$ rm -rf dist/ build/\n$ python setup.py sdist bdist_wheel\n$ twine upload -r test dist/*\n$ twine upload dist/*\n```\n\n\n## Thanks\n\nThis code is largely based off the work done by @ryanhiebert in [tox-travis][1].\nWithout his efforts, it would have taken significantly more time to write and\ntest this package.\n\n## License\n\nSee: [LICENSE][2]\n\n[1]: https://github.com/tox-dev/tox-travis\n[2]: https://github.com/rpkilby/tox-factor/blob/master/LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frpkilby%2Ftox-factor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frpkilby%2Ftox-factor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frpkilby%2Ftox-factor/lists"}