{"id":15568646,"url":"https://github.com/jayvdb/tox-backticks","last_synced_at":"2025-08-01T00:37:36.278Z","repository":{"id":34894669,"uuid":"187745640","full_name":"jayvdb/tox-backticks","owner":"jayvdb","description":"tox-backticks allows use of backticks within setenv to run commands to populate environment variables that can then be accessed using {env:var}","archived":false,"fork":false,"pushed_at":"2022-02-22T23:30:13.000Z","size":15,"stargazers_count":5,"open_issues_count":13,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-26T11:54:26.590Z","etag":null,"topics":["backticks","bash","environment-variables","shell","tox","tox-plugin"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/tox-backticks/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jayvdb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-21T02:17:04.000Z","updated_at":"2023-11-07T12:51:36.000Z","dependencies_parsed_at":"2022-08-08T02:15:41.218Z","dependency_job_id":null,"html_url":"https://github.com/jayvdb/tox-backticks","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/jayvdb/tox-backticks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jayvdb%2Ftox-backticks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jayvdb%2Ftox-backticks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jayvdb%2Ftox-backticks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jayvdb%2Ftox-backticks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jayvdb","download_url":"https://codeload.github.com/jayvdb/tox-backticks/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jayvdb%2Ftox-backticks/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268147501,"owners_count":24203280,"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","status":"online","status_checked_at":"2025-07-31T02:00:08.723Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["backticks","bash","environment-variables","shell","tox","tox-plugin"],"created_at":"2024-10-02T17:20:14.544Z","updated_at":"2025-08-01T00:37:36.249Z","avatar_url":"https://github.com/jayvdb.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tox-backticks\n\ntox-backticks allows use of backticks within `setenv` to run commands\nto populate environment variables that can then be accessed using `{env:var}`.\n\n```ini\n[testenv:simple]\nsetenv =\n  FOO=`python -c 'import sys; sys.stdout.write(\"foo\")'`\ncommands =\n  python -c 'assert \"{env:FOO}\" == \"foo\"'\n```\n\nCommands within the backticks follow the standard tox rules, where\nit must be an executable installed into the venv, or be an executable\npermitted using `whitelist_externals`.\n\nTo reduce the impact on the tox syntax, the backticks must enclose the\nentire setenv line.  Due to this choice, this plugin will only break\nexisting tox usage where a user wanted an environment variable which\nstarted and ended with a literal backtick, deemed rather unlikely\nand judged to be foolish anyway.  If that is truely needed, the following\napproach allows literal backticks at start and end.\n\n[testenv:literal_ignored]\nsetenv =\n  BACKTICK=`\n  INNERBACKTICK=``{env:BACKTICK}\ncommands =\n  python -c 'assert \"{env:INNERBACKTICKS}\" == \"```\"'\n\nTo use backticks for a part of a variable, use multiple setenv.\nThe order of setenv is irrelevant.\n\n```ini\n[testenv:nested_reversed]\nsetenv =\n  BAR=`{env:FOO} -c 'import sys; sys.stdout.write(\"foo\")'`\n  FOO=`python -c 'import sys; sys.stdout.write(\"python\")'`\ncommands =\n  python -c 'assert \"{env:BAR}\" == \"foo\"'\n```\n\nTox will report an error if multiple setenv are recursively defined,\npreventing the correct order from being established.\n\nSee [`tests/tox.ini`](tests/tox.ini) for samples.\n\n## Contributing\n\nPlease do not create an issue requesting using backticks within `commands`.\nWhile it can result in a neater `tox.ini`, the same effect can be achieved\nusing `setenv` and testenv that depend on other testenv.\n\nIf you can find a way to correctly intercept and process backticks between\neach command execution of a testenv with multiple commands, I will be keen\nto merge a patch as long as the new functionality is disabled by default.\ni.e. the backticks in the second command must be able to use state created\nby the first command, otherwise backticks in commands is useless.\n\nThe next problem with backticks within `commands` is that literal backticks\nwithin in the commands, which is why it must be off by default, at least\ninitially.  One non-intrusive semantics is to allow commands of form\n```bash\nexport VAR=`do_stuff`\n```\nThat line is useless in tox, as it wouldnt have any effect,\nand is easily parsable.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjayvdb%2Ftox-backticks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjayvdb%2Ftox-backticks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjayvdb%2Ftox-backticks/lists"}