kinu-garage / docker_vcs

Tool to support building Container/Images using VCS
Apache License 2.0
2 stars 0 forks source link

Re-distribution of the package is cumbersome (i.e. distribute by an installer) #13

Open 130s opened 1 year ago

130s commented 1 year ago

I'm ok to start from making a pip installer.

CoS

WIP https://github.com/kinu-garage/docker_vcstool/pull/17

130s commented 1 year ago

https://realpython.com/python-wheels/#making-sure-your-wheels-spin-right suggests testing a wheel on https://test.pypi.org, but the command fails.

log ``` # twine upload --verbose --repository-url https://test.pypi.org/legacy/ docker_vcs_tools-0.1.0-py3-none-any.whl Uploading distributions to https://test.pypi.org/legacy/ INFO docker_vcs_tools-0.1.0-py3-none-any.whl (14.5 KB) INFO Querying keyring for username Enter your username: noodle_bind INFO Querying keyring for password WARNING Error getting password from keyring Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/twine/auth.py", line 74, in get_password_from_keyring return cast(str, keyring.get_password(system, username)) File "/usr/local/lib/python3.9/site-packages/keyring/core.py", line 56, in get_password return get_keyring().get_password(service_name, username) File "/usr/local/lib/python3.9/site-packages/keyring/backends/fail.py", line 28, in get_password raise NoKeyringError(msg) keyring.errors.NoKeyringError: No recommended backend was available. Install a recommended 3rd party backend package; or, install the keyrings.alt package if you want to use the non-recommended backends. See https://pypi.org/project/keyring for details. Enter your password: INFO username: noodle_bind INFO password: Uploading docker_vcs_tools-0.1.0-py3-none-any.whl 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 18.7/18.7 kB • 00:01 • 7.8 MB/s INFO Response from https://test.pypi.org/legacy/: 403 Invalid or non-existent authentication information. See https://test.pypi.org/help/#invalid-auth for more information. INFO 403 Invalid or non-existent authentication information. See https://test.pypi.org/help/#invalid-auth for more information.

403 Invalid or non-existent authentication information. See https://test.pypi.org/help/#invalid-auth for more information.

Access was denied to this resource.

Invalid or non-existent authentication information. See https://test.pypi.org/help/#invalid-auth for more information. ERROR HTTPError: 403 Forbidden from https://test.pypi.org/legacy/ Invalid or non-existent authentication information. See https://test.pypi.org/help/#invalid-auth for more information. # twine upload --verbose --repository-url https://test.pypi.org/legacy/ docker_vcs_tools-0.1.0-py3-none-any.whl ```

Turned out that test.pypi.org does NOT share the user accounts from pypi.org, so I made an accounton test.pypi.org, verified email address.

Now finally obtained an actual review of my wheel. Nice! ``` # twine upload --verbose --repository-url https://test.pypi.org/legacy/ docker_vcs_tools-0.1.0-py3-none-any.whl Uploading distributions to https://test.pypi.org/legacy/ INFO docker_vcs_tools-0.1.0-py3-none-any.whl (14.5 KB) INFO Querying keyring for username Enter your username: noodle_bind INFO Querying keyring for password WARNING Error getting password from keyring Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/twine/auth.py", line 74, in get_password_from_keyring return cast(str, keyring.get_password(system, username)) File "/usr/local/lib/python3.9/site-packages/keyring/core.py", line 56, in get_password return get_keyring().get_password(service_name, username) File "/usr/local/lib/python3.9/site-packages/keyring/backends/fail.py", line 28, in get_password raise NoKeyringError(msg) keyring.errors.NoKeyringError: No recommended backend was available. Install a recommended 3rd party backend package; or, install the keyrings.alt package if you want to use the non-recommended backends. See https://pypi.org/project/keyring for details. Enter your password: INFO username: noodle_bind INFO password: Uploading docker_vcs_tools-0.1.0-py3-none-any.whl 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 18.7/18.7 kB • 00:00 • 9.4 MB/s INFO Response from https://test.pypi.org/legacy/: 400 Invalid value for classifiers. Error: Classifier 'License :: OSI Approved :: Apache2 License' is not a valid classifier. INFO 400 Invalid value for classifiers. Error: Classifier 'License :: OSI Approved :: Apache2 License' is not a valid classifier.

400 Invalid value for classifiers. Error: Classifier 'License :: OSI Approved :: Apache2 License' is not a valid classifier.

The server could not comply with the request since it is either malformed or otherwise incorrect.

Invalid value for classifiers. Error: Classifier 'License :: OSI Approved :: Apache2 License' is not a valid classifier. ERROR HTTPError: 400 Bad Request from https://test.pypi.org/legacy/ Invalid value for classifiers. Error: Classifier 'License :: OSI Approved :: Apache2 License' is not a valid classifier. ```
130s commented 1 year ago

Set up MFA and created $HOME/.pypirc but twine still fails to upload.

http error code 401 ``` # twine upload --verbose --repository-url https://test.pypi.org/legacy/ docker_vcs_tools-0.1.0-py3-none-any.whl Uploading distributions to https://test.pypi.org/legacy/ INFO docker_vcs_tools-0.1.0-py3-none-any.whl (13.6 KB) INFO Querying keyring for username Enter your username: noodle_bind INFO Querying keyring for password WARNING Error getting password from keyring Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/twine/auth.py", line 74, in get_password_from_keyring return cast(str, keyring.get_password(system, username)) File "/usr/local/lib/python3.9/site-packages/keyring/core.py", line 56, in get_password return get_keyring().get_password(service_name, username) File "/usr/local/lib/python3.9/site-packages/keyring/backends/fail.py", line 28, in get_password raise NoKeyringError(msg) keyring.errors.NoKeyringError: No recommended backend was available. Install a recommended 3rd party backend package; or, install the keyrings.alt package if you want to use the non-recommended backends. See https://pypi.org/project/keyring for details. Enter your password: INFO username: noodle_bind INFO password: Uploading docker_vcs_tools-0.1.0-py3-none-any.whl 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 17.6/17.6 kB • 00:00 • 6.5 MB/s INFO Response from https://test.pypi.org/legacy/: 401 User noodle_bind has two factor auth enabled, an API Token or Trusted Publisher must be used to upload in place of password. INFO 401 User noodle_bind has two factor auth enabled, an API Token or Trusted Publisher must be used to upload in place of password.

401 User noodle_bind has two factor auth enabled, an API Token or Trusted Publisher must be used to upload in place of password.

This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.

User noodle_bind has two factor auth enabled, an API Token or Trusted Publisher must be used to upload in place of password. ERROR HTTPError: 401 Unauthorized from https://test.pypi.org/legacy/ User noodle_bind has two factor auth enabled, an API Token or Trusted Publisher must be used to upload in place of password. ```

Turned out in .pypirc I defined the target repo as testpypi but in CLI I used --repository-url with URL.

[testpypi]
repository = https://test.pypi.org/legacy/
username = __token__
password = (HIDDEN)

Swapping to twine upload --verbose --repository testpypi seems to have worked finally.

Yay ``` # twine upload --verbose --repository testpypi docker_vcs_tools-0.1.0-py3-none-any.whl INFO Using configuration from /root/.pypirc Uploading distributions to https://test.pypi.org/legacy/ INFO docker_vcs_tools-0.1.0-py3-none-any.whl (13.6 KB) INFO username set from config file INFO password set from config file INFO username: __token__ INFO password: Uploading docker_vcs_tools-0.1.0-py3-none-any.whl 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 17.6/17.6 kB • 00:00 • 279.9 kB/s INFO Response from https://test.pypi.org/legacy/: 200 OK View at: https://test.pypi.org/project/docker-vcs-tools/0.1.0/ ```