Skip to content

Commit eea79fc

Browse files
authored
chore: centralize twine configuration logic and remove dependency on pypirc (#297)
1 parent b91e44b commit eea79fc

File tree

1 file changed

+27
-8
lines changed

1 file changed

+27
-8
lines changed

tox.ini

+27-8
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ passenv =
4545
# Pass through AWS credentials
4646
AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN \
4747
# Pass through AWS profile name (useful for local testing)
48-
AWS_PROFILE
48+
AWS_PROFILE \
49+
# Pass through custom pip config file settings
50+
PIP_CONFIG_FILE
4951
sitepackages = False
5052
deps = -rtest/requirements.txt
5153
commands =
@@ -332,22 +334,39 @@ deps =
332334
commands =
333335
python setup.py sdist bdist_wheel
334336

335-
[testenv:test-release]
337+
[testenv:release-base]
336338
basepython = python3
337339
skip_install = true
338340
deps =
339341
{[testenv:build]deps}
340342
twine
343+
passenv =
344+
{[testenv]passenv} \
345+
TWINE_USERNAME \
346+
TWINE_PASSWORD \
347+
TWINE_REPOSITORY_URL
341348
commands =
342349
{[testenv:build]commands}
343-
twine upload --skip-existing --repository testpypi dist/*
350+
twine upload --skip-existing {toxinidir}/dist/*
351+
352+
[testenv:test-release]
353+
basepython = python3
354+
skip_install = true
355+
deps = {[testenv:release-base]deps}
356+
passenv =
357+
{[testenv:release-base]passenv}
358+
setenv =
359+
TWINE_REPOSITORY_URL = https://test.pypi.org/legacy/
360+
commands = {[testenv:release-base]commands}
344361

345362
[testenv:release]
346363
basepython = python3
347364
skip_install = true
348-
deps =
349-
{[testenv:build]deps}
350-
twine
365+
deps = {[testenv:release-base]deps}
366+
passenv =
367+
{[testenv:release-base]passenv}
368+
whitelist_externals = unset
351369
commands =
352-
{[testenv:build]commands}
353-
twine upload --skip-existing --repository pypi dist/*
370+
# Unsetting the TWINE_REPOSITORY_URL defaults twine to using production PyPI
371+
unset TWINE_REPOSITORY_URL
372+
{[testenv:release-base]commands}

0 commit comments

Comments
 (0)