2

I want to use twine to upload a project build to test.pypi.org. I am following the README for the basic use case from the twine GitHub page. I have installed the latest version of twine:

$ twine --version
twine version 1.5.0 (pkginfo: 1.2.1, requests: 2.9.1, setuptools: 20.7.0)`

But when I attempt to upload my project built, I get the following error:

$ twine upload --repository-url https://test.pypi.org/legacy/ dist/*
usage: twine upload [-h] [-r REPOSITORY] [-s] [--sign-with SIGN_WITH]
                [-i IDENTITY] [-u USERNAME] [-p PASSWORD] [-c COMMENT]
                dist [dist ...]
twine upload: error: unrecognized arguments: --repository-url

This is the exact line of code referenced on the Python Packaging Tutorial and the Twine README, and --repository-url should be a valid flag. Is this an error with the argument passed to the flag instead of the flag itself, and if so what is it exactly that I need to fix?

My setup.py file for the project:

import setuptools

with open('README.md', 'r') as fh:
    long_description = fh.read()

setuptools.setup(
    name='MyPackageName',
    version='0.1.0',
    author='J. Chamness',
    author_email='myEmail@gmail.com',
    description='MyDescription',
    long_description=long_description,
    long_description_content_type='text/markdown',
    url='https://test.pypi.org/legacy/',
    packages=setuptools.find_packages(),
    classifiers=(
        'Programming Language :: Python :: 3',
        'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
        'Operating System :: OS Independent',
    ),
)
James
  • 39
  • 2
  • 4

1 Answers1

3

You are using an old version of twine (1.5.0). As @phd observes, --repository-url was added to twine at version 1.8. Upgrade to the latest version to get this functionality:

pip install --upgrade twine

snakecharmerb
  • 47,570
  • 11
  • 100
  • 153
  • `--repository-url` was added to twine at version 1.8: https://github.com/pypa/twine/blob/550bedb051ff10f259fe91ac0753358d4c767a89/docs/changelog.rst – phd Jul 01 '18 at 21:00