Skip to content

Instantly share code, notes, and snippets.

@Strangemother
Last active November 18, 2022 00:43
Show Gist options
  • Save Strangemother/0685ec75e5e8cbae36e2028a9b8d1c8a to your computer and use it in GitHub Desktop.
Save Strangemother/0685ec75e5e8cbae36e2028a9b8d1c8a to your computer and use it in GitHub Desktop.

Revisions

  1. Strangemother revised this gist Nov 18, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion pypi push.bash
    Original file line number Diff line number Diff line change
    @@ -22,7 +22,7 @@ INFO Using configuration from C:\Users\username\.pypirc
    ERROR InvalidConfiguration: Missing 'testpypi' section from C:/Users/username/.pypirc.
    More info: https://packaging.python.org/specifications/pypirc/

    # For no reason I deleted the _home_ path - It worked!
    # Ignoring the _home_ version, I copied the same file into the local directory.
    (env-django-4-0) C:\Users\username\projects\my-package\my-package>py -m twine upload --verbose --repository testpypi dist/* --config-file=".pypirc"
    INFO Using configuration from C:\Users\username\projects\my-package\my-package\.pypirc
    Uploading distributions to https://test.pypi.org/legacy/
  2. Strangemother created this gist Nov 18, 2022.
    45 changes: 45 additions & 0 deletions pypi push.bash
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,45 @@
    # my C:\Users\username\.pypirc *absolutely exists* and has the correct entry from here:
    # https://packaging.python.org/en/latest/guides/using-testpypi/#setting-up-testpypi-in-pypirc
    (env-django-4-0) >cat C:\Users\username\.pypirc
    [distutils]
    index-servers=pypi

    [testpypi]
    repository = https://test.pypi.org/legacy/
    username=__token__
    password=pypi-bigstring

    # although it printed the correct path, the file was not found. I suspected home issue: ~
    (env-django-4-0) C:\Users\username\projects\my-package\my-package>py -m twine upload --verbose --repository testpypi dist/*
    INFO Using configuration from C:\Users\username\.pypirc
    ERROR InvalidConfiguration: Missing 'testpypi' section from ~/.pypirc.
    More info: https://packaging.python.org/specifications/pypirc/

    # This article (thanks Xiang ZHU) https://copdips.com/2019/07/troubleshooting-python-twine-cannot-upload-package-on-windows.html
    # put me on the right track - But it didn't work - Clearly a package bug.
    (env-django-4-0) C:\Users\username\projects\my-package\my-package>py -m twine upload --verbose --repository testpypi dist/* --config-file="C:/Users/username/.pypirc"
    INFO Using configuration from C:\Users\username\.pypirc
    ERROR InvalidConfiguration: Missing 'testpypi' section from C:/Users/username/.pypirc.
    More info: https://packaging.python.org/specifications/pypirc/

    # For no reason I deleted the _home_ path - It worked!
    (env-django-4-0) C:\Users\username\projects\my-package\my-package>py -m twine upload --verbose --repository testpypi dist/* --config-file=".pypirc"
    INFO Using configuration from C:\Users\username\projects\my-package\my-package\.pypirc
    Uploading distributions to https://test.pypi.org/legacy/
    INFO dist\django_trim-0.1-py3-none-any.whl (55.0 KB)
    INFO dist\my-package-0.1.tar.gz (42.3 KB)
    INFO username set from config file
    INFO password set from config file
    INFO username: __token__
    INFO password: <hidden>
    Uploading django_trim-0.1-py3-none-any.whl
    100% ---------------------------------------- 59.7/59.7 kB • 00:00 • ?
    INFO Response from https://test.pypi.org/legacy/:
    200 OK
    Uploading my-package-0.1.tar.gz
    100% ---------------------------------------- 46.7/46.7 kB • 00:00 • ?
    INFO Response from https://test.pypi.org/legacy/:
    200 OK

    View at:
    https://test.pypi.org/project/my-package/0.1/