twine-1.10.0/0000755000175100017510000000000013250050564014033 5ustar sumanahsumanah00000000000000twine-1.10.0/docs/0000755000175100017510000000000013250050564014763 5ustar sumanahsumanah00000000000000twine-1.10.0/docs/_static/0000755000175100017510000000000013250050564016411 5ustar sumanahsumanah00000000000000twine-1.10.0/docs/_static/.empty0000644000175100017510000000005413232165234017550 0ustar sumanahsumanah00000000000000Empty file to force the creation of _static twine-1.10.0/docs/make.bat0000644000175100017510000001174613232165234016402 0ustar sumanahsumanah00000000000000@ECHO OFF REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) set BUILDDIR=_build set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . set I18NSPHINXOPTS=%SPHINXOPTS% . if NOT "%PAPER%" == "" ( set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% ) if "%1" == "" goto help if "%1" == "help" ( :help echo.Please use `make ^` where ^ is one of echo. html to make standalone HTML files echo. dirhtml to make HTML files named index.html in directories echo. singlehtml to make a single large HTML file echo. pickle to make pickle files echo. json to make JSON files echo. htmlhelp to make HTML files and a HTML help project echo. qthelp to make HTML files and a qthelp project echo. devhelp to make HTML files and a Devhelp project echo. epub to make an epub echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter echo. text to make text files echo. man to make manual pages echo. texinfo to make Texinfo files echo. gettext to make PO message catalogs echo. changes to make an overview over all changed/added/deprecated items echo. linkcheck to check all external links for integrity echo. doctest to run all doctests embedded in the documentation if enabled goto end ) if "%1" == "clean" ( for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i del /q /s %BUILDDIR%\* goto end ) if "%1" == "html" ( %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/html. goto end ) if "%1" == "dirhtml" ( %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. goto end ) if "%1" == "singlehtml" ( %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. goto end ) if "%1" == "pickle" ( %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can process the pickle files. goto end ) if "%1" == "json" ( %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can process the JSON files. goto end ) if "%1" == "htmlhelp" ( %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can run HTML Help Workshop with the ^ .hhp project file in %BUILDDIR%/htmlhelp. goto end ) if "%1" == "qthelp" ( %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can run "qcollectiongenerator" with the ^ .qhcp project file in %BUILDDIR%/qthelp, like this: echo.^> qcollectiongenerator %BUILDDIR%\qthelp\twine.qhcp echo.To view the help file: echo.^> assistant -collectionFile %BUILDDIR%\qthelp\twine.ghc goto end ) if "%1" == "devhelp" ( %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp if errorlevel 1 exit /b 1 echo. echo.Build finished. goto end ) if "%1" == "epub" ( %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub if errorlevel 1 exit /b 1 echo. echo.Build finished. The epub file is in %BUILDDIR%/epub. goto end ) if "%1" == "latex" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex if errorlevel 1 exit /b 1 echo. echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. goto end ) if "%1" == "text" ( %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text if errorlevel 1 exit /b 1 echo. echo.Build finished. The text files are in %BUILDDIR%/text. goto end ) if "%1" == "man" ( %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man if errorlevel 1 exit /b 1 echo. echo.Build finished. The manual pages are in %BUILDDIR%/man. goto end ) if "%1" == "texinfo" ( %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo if errorlevel 1 exit /b 1 echo. echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. goto end ) if "%1" == "gettext" ( %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale if errorlevel 1 exit /b 1 echo. echo.Build finished. The message catalogs are in %BUILDDIR%/locale. goto end ) if "%1" == "changes" ( %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes if errorlevel 1 exit /b 1 echo. echo.The overview file is in %BUILDDIR%/changes. goto end ) if "%1" == "linkcheck" ( %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck if errorlevel 1 exit /b 1 echo. echo.Link check complete; look for any errors in the above output ^ or in %BUILDDIR%/linkcheck/output.txt. goto end ) if "%1" == "doctest" ( %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest if errorlevel 1 exit /b 1 echo. echo.Testing of doctests in the sources finished, look at the ^ results in %BUILDDIR%/doctest/output.txt. goto end ) :end twine-1.10.0/docs/contributing.rst0000644000175100017510000001117713250046555020240 0ustar sumanahsumanah00000000000000Contributing ============ We are happy you have decided to contribute to ``twine``. Please see `the GitHub repository`_ for code and more documentation, and the `official Python Packaging User Guide`_ for user documentation. You can also join ``#pypa`` or ``#pypa-dev`` `on Freenode`_, or the `pypa-dev mailing list`_, to ask questions or get involved. Getting started --------------- We recommend you use a development environment. Using a ``virtualenv`` keeps your development environment isolated, so that ``twine`` and its dependencies do not interfere with packages already installed on your machine. You can use `virtualenv`_ or `pipenv`_ to isolate your development environment. Clone the twine repository from GitHub, and then make and activate your virtual environment, using Python 3.6 as the Python version in the virtual environment. Example: .. code-block:: console mkvirtualenv -p /usr/bin/python3.6 twine Then, run the following command: .. code-block:: console pip install -e /path/to/your/local/twine Now, in your virtual environment, ``twine`` is pointing at your local copy, so when you have made changes, you can easily see their effect. Building the documentation ^^^^^^^^^^^^^^^^^^^^^^^^^^ Additions and edits to twine's documentation are welcome and appreciated. We use ``tox`` to build docs. Activate your virtual environment, then install ``tox``. .. code-block:: console pip install tox If you are using ``pipenv`` to manage your virtual environment, you may need the `tox-pipenv`_ plugin so that tox can use pipenv environments instead of virtualenvs. To build the docs locally using ``tox``, activate your virtual environment, then run: .. code-block:: console tox -e docs The HTML of the docs will be visible in :file:`twine/docs/_build/`. When you have made your changes to the docs, please lint them before making a pull request. To run the linter from the root directory: .. code-block:: console doc8 docs Testing ^^^^^^^ Tests with twine are run using `tox`_, and tested against the following Python versions: 2.7, 3.4, 3,5, and 3.6. To run these tests locally, you will need to have these versions of Python installed on your machine. Either use ``tox`` to build against all supported Python versions (if you have them installed) or use ``tox -e py{version}`` to test against a specific version, e.g., ``tox -e py27`` or ``tox -e py34``. Also, always run ``tox -e pep8`` before submitting a pull request. Submitting changes ^^^^^^^^^^^^^^^^^^ 1. Fork `the GitHub repository`_. 2. Make a branch off of ``master`` and commit your changes to it. 3. Run the tests with ``tox`` and lint any docs changes with ``doc8``. 4. Ensure that your name is added to the end of the :file:`AUTHORS` file using the format ``Name (url)``, where the ``(url)`` portion is optional. 5. Submit a Pull Request to the ``master`` branch on GitHub. Architectural overview ---------------------- Twine is a command-line tool for interacting with PyPI securely over HTTPS. Its command line arguments are parsed in :file:`twine/cli.py`. Currently, twine has two principal functions: uploading new packages and registering new `projects`_. The code for registering new projects is in :file:`twine/commands/register.py`, and the code for uploading is in :file:`twine/commands/upload.py`. The file :file:`twine/package.py` contains a single class, ``PackageFile``, which hashes the project files and extracts their metadata. The file :file:`twine/repository.py` contains the ``Repository`` class, whose methods control the URL the package is uploaded to (which the user can specify either as a default, in the :file:`.pypirc` file, or pass on the command line), and the methods that upload the package securely to a URL. Future development ------------------ See our `open issues`_. In the future, ``pip`` and ``twine`` may merge into a single tool; see `ongoing discussion `_. .. _`official Python Packaging User Guide`: https://packaging.python.org/tutorials/distributing-packages/ .. _`the GitHub repository`: https://github.com/pypa/twine .. _`on Freenode`: https://webchat.freenode.net/?channels=%23pypa-dev,pypa .. _`pypa-dev mailing list`: https://groups.google.com/forum/#!forum/pypa-dev .. _`virtualenv`: https://virtualenv.pypa.io/en/stable/installation/ .. _`pipenv`: https://pipenv.readthedocs.io/en/latest/ .. _`tox`: https://tox.readthedocs.io/en/latest/ .. _`tox-pipenv`: https://pypi.python.org/pypi/tox-pipenv .. _`plugin`: https://github.com/bitprophet/releases .. _`projects`: https://packaging.python.org/glossary/#term-project .. _`open issues`: https://github.com/pypa/twine/issues twine-1.10.0/docs/conf.py0000644000175100017510000002072613250046074016272 0ustar sumanahsumanah00000000000000# -*- coding: utf-8 -*- # # twine documentation build configuration file, created by # sphinx-quickstart on Tue Aug 13 11:51:54 2013. # # This file is execfile()d with the current directory set to its containing # dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. # import sys # import os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # sys.path.insert(0, os.path.abspath('.')) # sys.path.insert(0, os.path.abspath(os.pardir)) import twine # -- General configuration ---------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. needs_sphinx = '1.7.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ "sphinx.ext.autodoc", "sphinx.ext.doctest", "sphinx.ext.intersphinx", "sphinx.ext.coverage", "sphinx.ext.viewcode", "releases", ] # 'releases' (changelog) settings releases_issue_uri = "https://github.com/pypa/twine/issues/%s" releases_release_uri = "https://github.com/pypa/twine/tree/%s" releases_debug = False # Change to True to see debug output # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] # The suffix of source filenames. source_suffix = ".rst" # The encoding of source files. # source_encoding = 'utf-8-sig' # The master toctree document. master_doc = "index" # General information about the project. project = "twine" copyright = "2018, Donald Stufft and individual contributors" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = ".".join(twine.__version__.split(".")[:2]) # The full version, including alpha/beta/rc tags. release = twine.__version__ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: # today = '' # Else, today_fmt is used as the format for a strftime call. # today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ["_build"] # The reST default role (used for this markup: `text`) to use for all documents # default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. # add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). # add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. # show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = "sphinx" # A list of ignored prefixes for module index sorting. # modindex_common_prefix = [] # -- Options for HTML output -------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = "sphinx_rtd_theme" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. # html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. # html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". # html_title = None # A shorter title for the navigation bar. Default is the same as html_title. # html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. # html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. # html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ["_static"] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. # html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. # html_use_smartypants = True # Custom sidebar templates, maps document names to template names. # html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. # html_additional_pages = {} # If false, no module index is generated. # html_domain_indices = True # If false, no index is generated. # html_use_index = True # If true, the index is split into individual pages for each letter. # html_split_index = False # If true, links to the reST sources are added to the pages. # html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. # html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. # html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. # html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). # html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = "twinedoc" # -- Options for LaTeX output ------------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). # 'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). # 'pointsize': '10pt', # Additional stuff for the LaTeX preamble. # 'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]) latex_documents = [ ( "index", "twine.tex", "Twine Documentation", "Donald Stufft and individual contributors", "manual", ), ] # The name of an image file (relative to this directory) to place at the top of # the title page. # latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. # latex_use_parts = False # If true, show page references after internal links. # latex_show_pagerefs = False # If true, show URL addresses after external links. # latex_show_urls = False # Documents to append as an appendix to all manuals. # latex_appendices = [] # If false, no module index is generated. # latex_domain_indices = True # -- Options for manual page output ------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ( "index", "twine", "twine Documentation", ["Donald Stufft", "Individual contributors"], 1, ), ] # If true, show URL addresses after external links. # man_show_urls = False # -- Options for Texinfo output ----------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ( "index", "twine", "twine Documentation", "Donald Stufft and individual contributors", "twine", "One line description of project.", "Miscellaneous", ), ] # Documents to append as an appendix to all manuals. # texinfo_appendices = [] # If false, no module index is generated. # texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. # texinfo_show_urls = 'footnote' # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = {"http://docs.python.org/": None} twine-1.10.0/docs/index.rst0000644000175100017510000000124313245631243016627 0ustar sumanahsumanah00000000000000.. twine documentation master file, originally created by sphinx-quickstart on Tue Aug 13 11:51:54 2013. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. Welcome to twine's documentation! ================================= .. contents:: Table of Contents :local: Twine user documentation ------------------------ .. include:: ../README.rst :start-after: rtd-inclusion-marker-do-not-remove .. toctree:: :caption: Further documentation :maxdepth: 3 contributing changelog Python Packaging User Guide * :ref:`search` twine-1.10.0/docs/Makefile0000644000175100017510000001267013232165234016432 0ustar sumanahsumanah00000000000000# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = _build # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " singlehtml to make a single large HTML file" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " devhelp to make HTML files and a Devhelp project" @echo " epub to make an epub" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " latexpdf to make LaTeX files and run them through pdflatex" @echo " text to make text files" @echo " man to make manual pages" @echo " texinfo to make Texinfo files" @echo " info to make Texinfo files and run them through makeinfo" @echo " gettext to make PO message catalogs" @echo " changes to make an overview of all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: -rm -rf $(BUILDDIR)/* html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." singlehtml: $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." pickle: $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/twine.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/twine.qhc" devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" @echo "# mkdir -p $$HOME/.local/share/devhelp/twine" @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/twine" @echo "# devhelp" epub: $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make' in that directory to run these through (pdf)latex" \ "(use \`make latexpdf' here to do that automatically)." latexpdf: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through pdflatex..." $(MAKE) -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." text: $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @echo @echo "Build finished. The text files are in $(BUILDDIR)/text." man: $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." texinfo: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." @echo "Run \`make' in that directory to run these through makeinfo" \ "(use \`make info' here to do that automatically)." info: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo "Running Texinfo files through makeinfo..." make -C $(BUILDDIR)/texinfo info @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." gettext: $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale @echo @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." twine-1.10.0/docs/changelog.rst0000644000175100017510000001620213250050143017436 0ustar sumanahsumanah00000000000000:orphan: ========= Changelog ========= * :release:`1.10.0 <2018-03-07>` * :bug:`315 major` Degrade gracefully when keyring is unavailable * :feature:`304` Reorganize & improve user & developer documentation. * :feature:`46` Link to changelog from ``README`` * :feature:`295` Add doc building instructions * :feature:`296` Add architecture overview to docs * :feature:`303` Revise docs predicting future of ``twine`` * :bug:`298 major` Fix syntax highlighting in ``README`` * :bug:`299 major` Fix changelog formatting * :bug:`200 major` Remove obsolete registration guidance * :bug:`286 major` Fix Travis CI and test configuration * :feature:`257` Declare support for Python 3.6 * :bug:`297 major` Fix Read the Docs, tox, Travis configuration * :bug:`268 major` Print progress to ``stdout``, not ``stderr`` * :bug:`265 major` Fix ``--repository[-url]`` help text * :feature:`256` Improve progressbar * :release:`1.9.1 <2017-05-27>` * :bug:`-` Blacklist known bad versions of Requests. See also :bug:`253` * :release:`1.9.0 <2017-05-22>` * :support:`-` Twine will now resolve passwords using the `keyring `_ if available. Module can be required with the ``keyring`` extra. * :support:`-` Twine will use ``hashlib.blake2b`` on Python 3.6+ instead of using pyblake2 for Blake2 hashes 256 bit hashes. * :support:`-` Twine sends less information about the user's system in the User-Agent string. See also :bug:`229` * :support:`-` Fix ``--skip-existing`` when used to upload a package for the first time. See also :bug:`220` * :support:`-` Fix precedence of ``--repository-url`` over ``--repository``. See also :bug:`206` * :release:`1.8.1 <2016-08-09>` * :support:`-` Check if a package exists if the URL is one of: * ``https://pypi.python.org/pypi/`` * ``https://upload.pypi.org/`` * ``https://upload.pypi.io/`` This helps people with ``https://upload.pypi.io`` still in their :file:`.pypirc` file. * :release:`1.8.0 <2016-08-08>` * :feature:`201` Switch from upload.pypi.io to upload.pypi.org. * :feature:`144` Retrieve configuration from the environment as a default. * Repository URL will default to ``TWINE_REPOSITORY`` * Username will default to ``TWINE_USERNAME`` * Password will default to ``TWINE_PASSWORD`` * :feature:`166` Allow the Repository URL to be provided on the command-line (``--repository-url``) or via an environment variable (``TWINE_REPOSITORY_URL``). * :support:`-` Generate SHA256 digest for all packages by default. * :feature:`171` Generate Blake2b 256 digests for packages *if* ``pyblake2`` is installed. Users can use ``python -m pip install twine[with-blake2]`` to have ``pyblake2`` installed with Twine. * :support:`-` Stop testing on Python 2.6. 2.6 support will be "best effort" until 2.0.0 * :support:`-` Warn users if they receive a 500 error when uploading to ``*pypi.python.org`` * :release:`1.7.4 <2016-07-09>` * :bug:`-` Correct a packaging error. * :release:`1.7.3 <2016-07-08>` * :bug:`195` Fix uploads to instances of pypiserver using ``--skip-existing``. We were not properly checking the return status code on the response after attempting an upload. * :support:`-` Do not generate traffic to Legacy PyPI unless we're uploading to it or uploading to Warehouse (e.g., pypi.io). This avoids the attempt to upload a package to the index if we can find it on Legacy PyPI already. * :release:`1.7.2 <2016-07-05>` * :bug:`189`, :bug:`191` Fix issue where we were checking the existence of packages even if the user didn't specify ``--skip-existing``. * :release:`1.7.1 <2016-07-05>` * :bug:`187` Clint was not specified in the wheel metadata as a dependency. * :release:`1.7.0 <2016-07-04>` * :feature:`142` Support ``--cert`` and ``--client-cert`` command-line flags and config file options for feature parity with pip. This allows users to verify connections to servers other than PyPI (e.g., local package repositories) with different certificates. * :feature:`152` Add progress bar to uploads. * :feature:`162` Allow ``--skip-existing`` to work for 409 status codes. * :feature:`167` Implement retries when the CDN in front of PyPI gives us a 5xx error. * :feature:`177` Switch Twine to upload to pypi.io instead of pypi.python.org. * :bug:`186 major` Allow passwords to have ``%``\ s in them. * :release:`1.6.5 <2015-12-16>` * :bug:`155` Bump requests-toolbelt version to ensure we avoid ConnectionErrors * :release:`1.6.4 <2015-10-27>` * :bug:`145` Paths with hyphens in them break the Wheel regular expression. * :bug:`146` Exception while accessing the ``respository`` key (sic) when raising a redirect exception. * :release:`1.6.3 <2015-10-05>` * :bug:`137`, :bug:`140` Uploading signatures was broken due to the pull request that added large file support via ``requests-toolbelt``. This caused a 500 error on PyPI and prevented package and signature upload in twine 1.6.0 * :release:`1.6.2 <2015-09-28>` * :bug:`132` Upload signatures with packages appropriately As part of the refactor for the 1.6.0 release, we were using the wrong name to find the signature file. This also uncovered a bug where if you're using twine in a situation where ``*`` is not expanded by your shell, we might also miss uploading signatures to PyPI. Both were fixed as part of this. * :release:`1.6.1 <2015-09-18>` * :bug:`130` Fix signing support for uploads * :release:`1.6.0 <2015-09-14>` * :feature:`106` Upload wheels first to PyPI * :feature:`104` Large file support via the ``requests-toolbelt`` * :bug:`92 major` Raise an exception on redirects * :feature:`97` Allow the user to specify the location of their :file:`.pypirc` * :feature:`115` Add the ``--skip-existing`` flag to ``twine upload`` to allow users to skip releases that already exist on PyPI. * :bug:`114 major` Warnings triggered by pkginfo searching for ``PKG-INFO`` files should no longer be user visible. * :bug:`116 major` Work around problems with Windows when using ``getpass.getpass`` * :bug:`111 major` Provide more helpful messages if :file:`.pypirc` is out of date. * :feature:`8` Support registering new packages with ``twine register`` * :release:`1.5.0 <2015-03-10>` * :bug:`85 major` Display information about the version of setuptools installed * :bug:`61 major` Support deprecated pypirc file format * :feature:`29` Support commands not named "gpg" for signing * :support:`-` Add lower-limit to requests dependency * :release:`1.4.0 <2014-12-12>` * :bug:`28 major` Prevent ResourceWarning from being shown * :bug:`34 major` List registered commands in help text * :bug:`32 major` Use ``pkg_resources`` to load registered commands * :bug:`47 major` Fix issue uploading packages with ``_``\ s in the name * :bug:`26 major` Add support for uploading Windows installers * :bug:`65 major` Expand globs and check for existence of dists to upload * :feature:`13` Parse :file:`~/.pypirc` ourselves and use ``subprocess`` instead of the ``distutils.spawn`` module. * :feature:`6` Switch to a git style dispatching for the commands to enable simpler commands and programmatic invocation. * :release:`1.3.0 <2014-03-31>` * :feature:`-` Additional functionality. * :release:`1.2.2 <2013-10-03>` * :feature:`0` Basic functionality. twine-1.10.0/README.rst0000644000175100017510000002340213246237164015533 0ustar sumanahsumanah00000000000000twine ===== .. rtd-inclusion-marker-do-not-remove Twine is `a utility`_ for `publishing`_ packages on `PyPI`_. Currently it only supports registering `projects`_ and uploading `distributions`_. Why Should I Use This? ---------------------- The goal of ``twine`` is to improve PyPI interaction by improving security and testability. The biggest reason to use ``twine`` is that it securely authenticates you to PyPI over HTTPS using a verified connection, while ``python setup.py upload`` `only recently stopped using HTTP `_ in Python 2.7.9+ and Python 3.2+. This means anytime you use ``python setup.py upload`` with an older Python version, you expose your username and password to being easily sniffed. Twine uses only verified TLS to upload to PyPI, protecting your credentials from theft. Secondly, it allows you to precreate your distribution files. ``python setup.py upload`` only allows you to upload something that you've created in the same command invocation. This means that you cannot test the exact file you're going to upload to PyPI to ensure that it works before uploading it. Finally, it allows you to pre-sign your files and pass the ``.asc`` files into the command line invocation (``twine upload twine-1.0.1.tar.gz twine-1.0.1.tar.gz.asc``). This enables you to be assured that you're typing your ``gpg`` passphrase into ``gpg`` itself and not anything else, since *you* will be the one directly executing ``gpg --detach-sign -a ``. Features -------- - Verified HTTPS connections - Uploading doesn't require executing ``setup.py`` - Uploading files that have already been created, allowing testing of distributions before release - Supports uploading any packaging format (including wheels) Installation ------------ .. code-block:: console $ pip install twine Usage ----- 1. Create some distributions in the normal way: .. code-block:: console $ python setup.py sdist bdist_wheel 2. Upload with ``twine``: .. code-block:: console $ twine upload dist/* 3. Done! More documentation on using ``twine`` to upload packages to PyPI is in the `Python Packaging User Guide`_. Options ^^^^^^^ .. code-block:: console $ twine upload -h usage: twine upload [-h] [-r REPOSITORY] [--repository-url REPOSITORY_URL] [-s] [--sign-with SIGN_WITH] [-i IDENTITY] [-u USERNAME] [-p PASSWORD] [-c COMMENT] [--config-file CONFIG_FILE] [--skip-existing] [--cert path] [--client-cert path] dist [dist ...] positional arguments: dist The distribution files to upload to the repository, may additionally contain a .asc file to include an existing signature with the file upload optional arguments: -h, --help show this help message and exit -r REPOSITORY, --repository REPOSITORY The repository to upload the package to. Can be a section in the config file or a full URL to the repository (default: pypi). (Can also be set via TWINE_REPOSITORY environment variable) --repository-url REPOSITORY_URL The repository URL to upload the package to. This can be specified with --repository because it will be used if there is no configuration for the value passed to --repository. (Can also be set via TWINE_REPOSITORY_URL environment variable.) -s, --sign Sign files to upload using gpg --sign-with SIGN_WITH GPG program used to sign uploads (default: gpg) -i IDENTITY, --identity IDENTITY GPG identity used to sign files -u USERNAME, --username USERNAME The username to authenticate to the repository as (can also be set via TWINE_USERNAME environment variable) -p PASSWORD, --password PASSWORD The password to authenticate to the repository with (can also be set via TWINE_PASSWORD environment variable) -c COMMENT, --comment COMMENT The comment to include with the distribution file --config-file CONFIG_FILE The .pypirc config file to use --skip-existing Continue uploading files if one already exists. (Only valid when uploading to PyPI. Other implementations may not support this.) --cert path Path to alternate CA bundle (can also be set via TWINE_CERT environment variable) --client-cert path Path to SSL client certificate, a single file containing the private key and the certificate in PEM format Twine also includes a ``register`` command. .. WARNING:: ``register`` is `no longer necessary if you are uploading to pypi.org `_. As such, it is `no longer supported `_ in `Warehouse`_ (the new PyPI software running on pypi.org). However, you may need this if you are using a different package index. For completeness, its usage: .. code-block:: console $ twine register -h usage: twine register [-h] [-r REPOSITORY] [--repository-url REPOSITORY_URL] [-u USERNAME] [-p PASSWORD] [-c COMMENT] [--config-file CONFIG_FILE] [--cert path] [--client-cert path] package positional arguments: package File from which we read the package metadata optional arguments: -h, --help show this help message and exit -r REPOSITORY, --repository REPOSITORY The repository to register the package to. Can be a section in the config file or a full URL to the repository (default: pypi). (Can also be set via TWINE_REPOSITORY environment variable) --repository-url REPOSITORY_URL The repository URL to upload the package to. This can be specified with --repository because it will be used if there is no configuration for the value passed to --repository. (Can also be set via TWINE_REPOSITORY_URL environment variable.) -u USERNAME, --username USERNAME The username to authenticate to the repository as (can also be set via TWINE_USERNAME environment variable) -p PASSWORD, --password PASSWORD The password to authenticate to the repository with (can also be set via TWINE_PASSWORD environment variable) -c COMMENT, --comment COMMENT The comment to include with the distribution file --config-file CONFIG_FILE The .pypirc config file to use --cert path Path to alternate CA bundle (can also be set via TWINE_CERT environment variable) --client-cert path Path to SSL client certificate, a single file containing the private key and the certificate in PEM format Environment Variables ^^^^^^^^^^^^^^^^^^^^^ Twine also supports configuration via environment variables. Options passed on the command line will take precedence over options set via environment variables. Definition via environment variable is helpful in environments where it is not convenient to create a `.pypirc` file, such as a CI/build server, for example. * ``TWINE_USERNAME`` - the username to use for authentication to the repository * ``TWINE_PASSWORD`` - the password to use for authentication to the repository * ``TWINE_REPOSITORY`` - the repository configuration, either defined as a section in `.pypirc` or provided as a full URL * ``TWINE_REPOSITORY_URL`` - the repository URL to use * ``TWINE_CERT`` - custom CA certificate to use for repositories with self-signed or untrusted certificates Resources --------- * `IRC `_ (``#pypa`` - irc.freenode.net) * `GitHub repository `_ * User and developer `documentation`_ * `Python Packaging User Guide`_ Contributing ------------ See our `developer documentation`_ for how to get started, an architectural overview, and our future development plans. Code of Conduct --------------- Everyone interacting in the ``twine`` project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the `PyPA Code of Conduct`_. .. _`a utility`: https://pypi.org/project/twine/ .. _`publishing`: https://packaging.python.org/tutorials/distributing-packages/ .. _`PyPI`: https://pypi.org .. _`Python Packaging User Guide`: https://packaging.python.org/tutorials/distributing-packages/ .. _`documentation`: http://twine.readthedocs.io/ .. _`developer documentation`: https://twine.readthedocs.io/en/latest/contributing.html .. _`projects`: https://packaging.python.org/glossary/#term-project .. _`distributions`: https://packaging.python.org/glossary/#term-distribution-package .. _`PyPA Code of Conduct`: https://www.pypa.io/en/latest/code-of-conduct/ .. _`Warehouse`: https://github.com/pypa/warehouse twine-1.10.0/LICENSE0000644000175100017510000002273613232165234015053 0ustar sumanahsumanah00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. twine-1.10.0/twine/0000755000175100017510000000000013250050564015161 5ustar sumanahsumanah00000000000000twine-1.10.0/twine/wininst.py0000644000175100017510000000313013232165234017224 0ustar sumanahsumanah00000000000000from __future__ import absolute_import, division, print_function from __future__ import unicode_literals import os import re import zipfile from pkginfo.distribution import Distribution wininst_file_re = re.compile(r".*py(?P\d+\.\d+)\.exe$") class WinInst(Distribution): def __init__(self, filename, metadata_version=None): self.filename = filename self.metadata_version = metadata_version self.extractMetadata() @property def py_version(self): m = wininst_file_re.match(self.filename) if m is None: return "any" else: return m.group("pyver") def read(self): fqn = os.path.abspath(os.path.normpath(self.filename)) if not os.path.exists(fqn): raise ValueError('No such file: %s' % fqn) if fqn.endswith('.exe'): archive = zipfile.ZipFile(fqn) names = archive.namelist() def read_file(name): return archive.read(name) else: raise ValueError('Not a known archive format: %s' % fqn) try: tuples = [x.split('/') for x in names if x.endswith(".egg-info") or x.endswith("PKG-INFO")] schwarz = sorted([(len(x), x) for x in tuples]) for path in [x[1] for x in schwarz]: candidate = '/'.join(path) data = read_file(candidate) if b'Metadata-Version' in data: return data finally: archive.close() raise ValueError('No PKG-INFO/.egg-info in archive: %s' % fqn) twine-1.10.0/twine/repository.py0000644000175100017510000001601613246342641017763 0ustar sumanahsumanah00000000000000# Copyright 2015 Ian Cordasco # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import, unicode_literals, print_function import sys from tqdm import tqdm import requests from requests import adapters from requests import codes from requests.packages.urllib3 import util from requests_toolbelt.multipart import ( MultipartEncoder, MultipartEncoderMonitor ) from requests_toolbelt.utils import user_agent import twine KEYWORDS_TO_NOT_FLATTEN = set(["gpg_signature", "content"]) LEGACY_PYPI = 'https://pypi.python.org/' WAREHOUSE = 'https://upload.pypi.org/' OLD_WAREHOUSE = 'https://upload.pypi.io/' class ProgressBar(tqdm): def update_to(self, n): """Update the bar in the way compatible with requests-toolbelt. This is identical to tqdm.update, except ``n`` will be the current value - not the delta as tqdm expects. """ self.update(n - self.n) # will also do self.n = n class Repository(object): def __init__(self, repository_url, username, password): self.url = repository_url self.session = requests.session() self.session.auth = (username, password) self.session.headers['User-Agent'] = self._make_user_agent_string() for scheme in ('http://', 'https://'): self.session.mount(scheme, self._make_adapter_with_retries()) self._releases_json_data = {} @staticmethod def _make_adapter_with_retries(): retry = util.Retry( connect=5, total=10, method_whitelist=['GET'], status_forcelist=[500, 501, 502, 503], ) return adapters.HTTPAdapter(max_retries=retry) @staticmethod def _make_user_agent_string(): from twine import cli dependencies = cli.list_dependencies_and_versions() return user_agent.UserAgentBuilder( 'twine', twine.__version__, ).include_extras( dependencies ).include_implementation().build() def close(self): self.session.close() @staticmethod def _convert_data_to_list_of_tuples(data): data_to_send = [] for key, value in data.items(): if (key in KEYWORDS_TO_NOT_FLATTEN or not isinstance(value, (list, tuple))): data_to_send.append((key, value)) else: for item in value: data_to_send.append((key, item)) return data_to_send def set_certificate_authority(self, cacert): if cacert: self.session.verify = cacert def set_client_certificate(self, clientcert): if clientcert: self.session.cert = clientcert def register(self, package): data = package.metadata_dictionary() data.update({ ":action": "submit", "protocol_version": "1", }) print("Registering {0}".format(package.basefilename)) data_to_send = self._convert_data_to_list_of_tuples(data) encoder = MultipartEncoder(data_to_send) resp = self.session.post( self.url, data=encoder, allow_redirects=False, headers={'Content-Type': encoder.content_type}, ) # Bug 28. Try to silence a ResourceWarning by releasing the socket. resp.close() return resp def _upload(self, package): data = package.metadata_dictionary() data.update({ # action ":action": "file_upload", "protocol_version": "1", }) data_to_send = self._convert_data_to_list_of_tuples(data) print("Uploading {0}".format(package.basefilename)) with open(package.filename, "rb") as fp: data_to_send.append(( "content", (package.basefilename, fp, "application/octet-stream"), )) encoder = MultipartEncoder(data_to_send) with ProgressBar(total=encoder.len, unit='B', unit_scale=True, unit_divisor=1024, miniters=1, file=sys.stdout) as bar: monitor = MultipartEncoderMonitor( encoder, lambda monitor: bar.update_to(monitor.bytes_read) ) resp = self.session.post( self.url, data=monitor, allow_redirects=False, headers={'Content-Type': monitor.content_type}, ) return resp def upload(self, package, max_redirects=5): number_of_redirects = 0 while number_of_redirects < max_redirects: resp = self._upload(package) if resp.status_code == codes.OK: return resp if 500 <= resp.status_code < 600: number_of_redirects += 1 print('Received "{status_code}: {reason}" Package upload ' 'appears to have failed. Retry {retry} of 5'.format( status_code=resp.status_code, reason=resp.reason, retry=number_of_redirects, )) else: return resp return resp def package_is_uploaded(self, package, bypass_cache=False): # NOTE(sigmavirus24): Not all indices are PyPI and pypi.io doesn't # have a similar interface for finding the package versions. if not self.url.startswith((LEGACY_PYPI, WAREHOUSE, OLD_WAREHOUSE)): return False safe_name = package.safe_name releases = None if not bypass_cache: releases = self._releases_json_data.get(safe_name) if releases is None: url = '{url}pypi/{package}/json'.format(package=safe_name, url=LEGACY_PYPI) headers = {'Accept': 'application/json'} response = self.session.get(url, headers=headers) if response.status_code == 200: releases = response.json()['releases'] else: releases = {} self._releases_json_data[safe_name] = releases packages = releases.get(package.metadata.version, []) for uploaded_package in packages: if uploaded_package['filename'] == package.basefilename: return True return False def verify_package_integrity(self, package): # TODO(sigmavirus24): Add a way for users to download the package and # check it's hash against what it has locally. pass twine-1.10.0/twine/_installed.py0000644000175100017510000000440713232166005017654 0ustar sumanahsumanah00000000000000# Copyright 2013 Tres Seaver # Copyright 2015 Ian Cordasco # This code was originally licensed under the Python Software Foudation # License by Tres Seaver. In order to facilitate finding the metadata of # installed packages, part of the most current implementation of the # pkginfo.Installed class is reproduced here with bug fixes from # https://bugs.launchpad.net/pkginfo/+bug/1437570. import glob import os import sys import warnings import pkginfo class Installed(pkginfo.Installed): def read(self): opj = os.path.join if self.package is not None: package = self.package.__package__ if package is None: package = self.package.__name__ egg_pattern = '%s*.egg-info' % package dist_pattern = '%s*.dist-info' % package file = getattr(self.package, '__file__', None) if file is not None: candidates = [] def _add_candidate(where): candidates.extend(glob.glob(where)) for entry in sys.path: if file.startswith(entry): _add_candidate(opj(entry, 'METADATA')) # egg? _add_candidate(opj(entry, 'EGG-INFO')) # egg? # dist-installed? _add_candidate(opj(entry, egg_pattern)) _add_candidate(opj(entry, dist_pattern)) dir, name = os.path.split(self.package.__file__) _add_candidate(opj(dir, egg_pattern)) _add_candidate(opj(dir, dist_pattern)) _add_candidate(opj(dir, '..', egg_pattern)) _add_candidate(opj(dir, '..', dist_pattern)) for candidate in candidates: if os.path.isdir(candidate): path = opj(candidate, 'PKG-INFO') if not os.path.exists(path): path = opj(candidate, 'METADATA') else: path = candidate if os.path.exists(path): with open(path) as f: return f.read() warnings.warn('No PKG-INFO or METADATA found for package: %s' % self.package_name) twine-1.10.0/twine/package.py0000644000175100017510000001351513232166062017134 0ustar sumanahsumanah00000000000000# Copyright 2015 Ian Cordasco # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import, unicode_literals, print_function import hashlib import io import os import subprocess import pkginfo import pkg_resources try: from hashlib import blake2b except ImportError: try: from pyblake2 import blake2b except ImportError: blake2b = None from twine.wheel import Wheel from twine.wininst import WinInst DIST_TYPES = { "bdist_wheel": Wheel, "bdist_wininst": WinInst, "bdist_egg": pkginfo.BDist, "sdist": pkginfo.SDist, } DIST_EXTENSIONS = { ".whl": "bdist_wheel", ".exe": "bdist_wininst", ".egg": "bdist_egg", ".tar.bz2": "sdist", ".tar.gz": "sdist", ".zip": "sdist", } class PackageFile(object): def __init__(self, filename, comment, metadata, python_version, filetype): self.filename = filename self.basefilename = os.path.basename(filename) self.comment = comment self.metadata = metadata self.python_version = python_version self.filetype = filetype self.safe_name = pkg_resources.safe_name(metadata.name) self.signed_filename = self.filename + '.asc' self.signed_basefilename = self.basefilename + '.asc' self.gpg_signature = None blake2_256_hash = None if blake2b is not None: blake2_256_hash = blake2b(digest_size=256 // 8) # NOTE(sigmavirus24): We may or may not be able to use blake2 so let's # either use the methods or lambdas to do nothing. blake_update = getattr(blake2_256_hash, 'update', lambda *args: None) blake_hexdigest = getattr(blake2_256_hash, 'hexdigest', lambda: None) md5_hash = hashlib.md5() sha2_hash = hashlib.sha256() with open(filename, "rb") as fp: for content in iter(lambda: fp.read(io.DEFAULT_BUFFER_SIZE), b''): md5_hash.update(content) sha2_hash.update(content) blake_update(content) self.md5_digest = md5_hash.hexdigest() self.sha2_digest = sha2_hash.hexdigest() self.blake2_256_digest = blake_hexdigest() @classmethod def from_filename(cls, filename, comment): # Extract the metadata from the package for ext, dtype in DIST_EXTENSIONS.items(): if filename.endswith(ext): meta = DIST_TYPES[dtype](filename) break else: raise ValueError( "Unknown distribution format: '%s'" % os.path.basename(filename) ) if dtype == "bdist_egg": pkgd = pkg_resources.Distribution.from_filename(filename) py_version = pkgd.py_version elif dtype == "bdist_wheel": py_version = meta.py_version elif dtype == "bdist_wininst": py_version = meta.py_version else: py_version = None return cls(filename, comment, meta, py_version, dtype) def metadata_dictionary(self): meta = self.metadata data = { # identify release "name": self.safe_name, "version": meta.version, # file content "filetype": self.filetype, "pyversion": self.python_version, # additional meta-data "metadata_version": meta.metadata_version, "summary": meta.summary, "home_page": meta.home_page, "author": meta.author, "author_email": meta.author_email, "maintainer": meta.maintainer, "maintainer_email": meta.maintainer_email, "license": meta.license, "description": meta.description, "keywords": meta.keywords, "platform": meta.platforms, "classifiers": meta.classifiers, "download_url": meta.download_url, "supported_platform": meta.supported_platforms, "comment": self.comment, "md5_digest": self.md5_digest, "sha256_digest": self.sha2_digest, "blake2_256_digest": self.blake2_256_digest, # PEP 314 "provides": meta.provides, "requires": meta.requires, "obsoletes": meta.obsoletes, # Metadata 1.2 "project_urls": meta.project_urls, "provides_dist": meta.provides_dist, "obsoletes_dist": meta.obsoletes_dist, "requires_dist": meta.requires_dist, "requires_external": meta.requires_external, "requires_python": meta.requires_python, } if self.gpg_signature is not None: data['gpg_signature'] = self.gpg_signature return data def add_gpg_signature(self, signature_filepath, signature_filename): if self.gpg_signature is not None: raise ValueError('GPG Signature can only be added once') with open(signature_filepath, "rb") as gpg: self.gpg_signature = (signature_filename, gpg.read()) def sign(self, sign_with, identity): print("Signing {0}".format(self.basefilename)) gpg_args = (sign_with, "--detach-sign") if identity: gpg_args += ("--local-user", identity) gpg_args += ("-a", self.filename) subprocess.check_call(gpg_args) self.add_gpg_signature(self.signed_filename, self.signed_basefilename) twine-1.10.0/twine/wheel.py0000644000175100017510000000577613232166062016657 0ustar sumanahsumanah00000000000000# Copyright 2013 Donald Stufft # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import, division, print_function from __future__ import unicode_literals import os import re import zipfile try: from StringIO import StringIO except ImportError: from _io import StringIO from pkginfo import distribution from pkginfo.distribution import Distribution # Monkeypatch Metadata 2.0 support distribution.HEADER_ATTRS_2_0 = distribution.HEADER_ATTRS_1_2 distribution.HEADER_ATTRS.update({"2.0": distribution.HEADER_ATTRS_2_0}) wheel_file_re = re.compile( r"""^(?P(?P.+?)(-(?P\d.+?))?) ((-(?P\d.*?))?-(?P.+?)-(?P.+?)-(?P.+?) \.whl|\.dist-info)$""", re.VERBOSE) def try_decode(s): if isinstance(s, bytes): return s.decode('utf8') return s class Wheel(Distribution): def __init__(self, filename, metadata_version=None): self.filename = filename self.basefilename = os.path.basename(self.filename) self.metadata_version = metadata_version self.extractMetadata() @property def py_version(self): wheel_info = wheel_file_re.match(self.basefilename) return wheel_info.group("pyver") @staticmethod def find_candidate_metadata_files(names): """Filter files that may be METADATA files.""" tuples = [ x.split('/') for x in map(try_decode, names) if 'METADATA' in x ] return [x[1] for x in sorted([(len(x), x) for x in tuples])] def read(self): fqn = os.path.abspath(os.path.normpath(self.filename)) if not os.path.exists(fqn): raise ValueError('No such file: %s' % fqn) if fqn.endswith('.whl'): archive = zipfile.ZipFile(fqn) names = archive.namelist() def read_file(name): return archive.read(name) else: raise ValueError('Not a known archive format: %s' % fqn) try: for path in self.find_candidate_metadata_files(names): candidate = '/'.join(path) data = read_file(candidate) if b'Metadata-Version' in data: return data finally: archive.close() raise ValueError('No METADATA in archive: %s' % fqn) def parse(self, data): super(Wheel, self).parse(data) fp = StringIO(distribution.must_decode(data)) msg = distribution.parse(fp) self.description = msg.get_payload() twine-1.10.0/twine/cli.py0000644000175100017510000000414713232166062016311 0ustar sumanahsumanah00000000000000# Copyright 2013 Donald Stufft # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import, division, print_function from __future__ import unicode_literals import argparse import pkg_resources import setuptools import tqdm import requests import requests_toolbelt import pkginfo import twine from twine._installed import Installed def _registered_commands(group='twine.registered_commands'): registered_commands = pkg_resources.iter_entry_points(group=group) return dict((c.name, c) for c in registered_commands) def list_dependencies_and_versions(): return [ ('pkginfo', Installed(pkginfo).version), ('requests', requests.__version__), ('setuptools', setuptools.__version__), ('requests-toolbelt', requests_toolbelt.__version__), ('tqdm', tqdm.__version__), ] def dep_versions(): return ', '.join( '{0}: {1}'.format(*dependency) for dependency in list_dependencies_and_versions() ) def dispatch(argv): registered_commands = _registered_commands() parser = argparse.ArgumentParser(prog="twine") parser.add_argument( "--version", action="version", version="%(prog)s version {0} ({1})".format(twine.__version__, dep_versions()), ) parser.add_argument( "command", choices=registered_commands.keys(), ) parser.add_argument( "args", help=argparse.SUPPRESS, nargs=argparse.REMAINDER, ) args = parser.parse_args(argv) main = registered_commands[args.command].load() main(args.args) twine-1.10.0/twine/exceptions.py0000644000175100017510000000214613232165234017720 0ustar sumanahsumanah00000000000000# Copyright 2015 Ian Cordasco # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. class RedirectDetected(Exception): """A redirect was detected that the user needs to resolve. In some cases, requests refuses to issue a new POST request after a redirect. In order to prevent a confusing user experience, we raise this exception to allow users to know the index they're uploading to is redirecting them. """ pass class PackageNotFound(Exception): """A package file was provided that could not be found on the file system. This is only used when attempting to register a package. """ pass twine-1.10.0/twine/utils.py0000644000175100017510000001725013250046230016673 0ustar sumanahsumanah00000000000000# Copyright 2013 Donald Stufft # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import, division, print_function from __future__ import unicode_literals import os import os.path import functools import getpass import sys import argparse import warnings try: import configparser except ImportError: # pragma: no cover import ConfigParser as configparser try: from urlparse import urlparse, urlunparse except ImportError: from urllib.parse import urlparse, urlunparse # Shim for raw_input in python3 if sys.version_info > (3,): input_func = input else: input_func = raw_input DEFAULT_REPOSITORY = "https://upload.pypi.org/legacy/" TEST_REPOSITORY = "https://test.pypi.org/legacy/" def get_config(path="~/.pypirc"): # Expand user strings in the path path = os.path.expanduser(path) if not os.path.isfile(path): return {"pypi": {"repository": DEFAULT_REPOSITORY, "username": None, "password": None }, "pypitest": {"repository": TEST_REPOSITORY, "username": None, "password": None }, } # Parse the rc file parser = configparser.RawConfigParser() parser.read(path) # Get a list of repositories from the config file if (parser.has_section("distutils") and parser.has_option("distutils", "index-servers")): repositories = parser.get("distutils", "index-servers").split() else: repositories = ["pypi"] config = {} defaults = {"username": None, "password": None} if parser.has_section("server-login"): for key in ["username", "password"]: if parser.has_option("server-login", key): defaults[key] = parser.get("server-login", key) for repository in repositories: # Skip this repository if it doesn't exist in the config file if not parser.has_section(repository): continue # Mandatory configuration and defaults config[repository] = { "repository": DEFAULT_REPOSITORY, "username": None, "password": None, } # Optional configuration values for key in [ "username", "repository", "password", "ca_cert", "client_cert", ]: if parser.has_option(repository, key): config[repository][key] = parser.get(repository, key) elif defaults.get(key): config[repository][key] = defaults[key] return config def get_repository_from_config(config_file, repository, repository_url=None): # Get our config from the .pypirc file if repository_url and "://" in repository_url: # assume that the repository is actually an URL and just sent # them a dummy with the repo set return { "repository": repository_url, "username": None, "password": None, } try: return get_config(config_file)[repository] except KeyError: msg = ( "Missing '{repo}' section from the configuration file\n" "or not a complete URL in --repository-url.\n" "Maybe you have a out-dated '{cfg}' format?\n" "more info: " "https://docs.python.org/distutils/packageindex.html#pypirc\n" ).format( repo=repository, cfg=config_file ) raise KeyError(msg) _HOSTNAMES = set(["pypi.python.org", "testpypi.python.org", "upload.pypi.org", "test.pypi.org"]) def normalize_repository_url(url): parsed = urlparse(url) if parsed.netloc in _HOSTNAMES: return urlunparse(("https",) + parsed[1:]) return urlunparse(parsed) def check_status_code(response): if (response.status_code == 500 and response.url.startswith(("https://pypi.python.org", "https://testpypi.python.org"))): print("It appears you're uploading to pypi.python.org (or testpypi) " "you've received a 500 error response. PyPI is being phased " "out for pypi.org. Try using https://upload.pypi.org/legacy/ " "(or https://test.pypi.org/legacy/) to upload your packages " "instead. These are the default URLs for Twine now.") response.raise_for_status() def get_userpass_value(cli_value, config, key, prompt_strategy=None): """Gets the username / password from config. Uses the following rules: 1. If it is specified on the cli (`cli_value`), use that. 2. If `config[key]` is specified, use that. 3. If `prompt_strategy`, prompt using `prompt_strategy`. 4. Otherwise return None :param cli_value: The value supplied from the command line or `None`. :type cli_value: unicode or `None` :param config: Config dictionary :type config: dict :param key: Key to find the config value. :type key: unicode :prompt_strategy: Argumentless function to return fallback value. :type prompt_strategy: function :returns: The value for the username / password :rtype: unicode """ if cli_value is not None: return cli_value elif config.get(key): return config[key] elif prompt_strategy: return prompt_strategy() else: return None def password_prompt(prompt_text): # Always expects unicode for our own sanity prompt = prompt_text # Workaround for https://github.com/pypa/twine/issues/116 if os.name == 'nt' and sys.version_info < (3, 0): prompt = prompt_text.encode('utf8') return getpass.getpass(prompt) def get_password_from_keyring(system, username): try: import keyring except ImportError: return try: return keyring.get_password(system, username) except Exception as exc: warnings.warn(str(exc)) def password_from_keyring_or_prompt(system, username): return ( get_password_from_keyring(system, username) or password_prompt('Enter your password: ') ) get_username = functools.partial( get_userpass_value, key='username', prompt_strategy=functools.partial(input_func, 'Enter your username: '), ) get_cacert = functools.partial( get_userpass_value, key='ca_cert', ) get_clientcert = functools.partial( get_userpass_value, key='client_cert', ) class EnvironmentDefault(argparse.Action): """Get values from environment variable.""" def __init__(self, env, required=True, default=None, **kwargs): default = os.environ.get(env, default) self.env = env if default: required = False super(EnvironmentDefault, self).__init__( default=default, required=required, **kwargs ) def __call__(self, parser, namespace, values, option_string=None): setattr(namespace, self.dest, values) def get_password(system, username, cli_value, config): return get_userpass_value( cli_value, config, key='password', prompt_strategy=functools.partial( password_from_keyring_or_prompt, system, username, ), ) twine-1.10.0/twine/__main__.py0000644000175100017510000000173513232166062017262 0ustar sumanahsumanah00000000000000#!/usr/bin/env python # Copyright 2013 Donald Stufft # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import, division, print_function from __future__ import unicode_literals import sys from twine.cli import dispatch def main(): try: return dispatch(sys.argv[1:]) except Exception as exc: return '{0}: {1}'.format( exc.__class__.__name__, exc.args[0], ) if __name__ == "__main__": sys.exit(main()) twine-1.10.0/twine/__init__.py0000644000175100017510000000222113250050143017260 0ustar sumanahsumanah00000000000000# Copyright 2018 Donald Stufft and individual contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import, division, print_function __all__ = ( "__title__", "__summary__", "__uri__", "__version__", "__author__", "__email__", "__license__", "__copyright__", ) __title__ = "twine" __summary__ = "Collection of utilities for publishing packages on PyPI" __uri__ = "http://twine.readthedocs.io/" __version__ = "1.10.0" __author__ = "Donald Stufft and individual contributors" __email__ = "donald@stufft.io" __license__ = "Apache License, Version 2.0" __copyright__ = "Copyright 2018 Donald Stufft and individual contributors" twine-1.10.0/twine/commands/0000755000175100017510000000000013250050564016762 5ustar sumanahsumanah00000000000000twine-1.10.0/twine/commands/register.py0000644000175100017510000001114013232166062021156 0ustar sumanahsumanah00000000000000# Copyright 2015 Ian Cordasco # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import, unicode_literals, print_function import argparse import os.path from twine import exceptions as exc from twine.package import PackageFile from twine.repository import Repository from twine import utils def register(package, repository, username, password, comment, config_file, cert, client_cert, repository_url): config = utils.get_repository_from_config( config_file, repository, repository_url, ) config["repository"] = utils.normalize_repository_url( config["repository"] ) print("Registering package to {0}".format(config["repository"])) username = utils.get_username(username, config) password = utils.get_password( config["repository"], username, password, config, ) ca_cert = utils.get_cacert(cert, config) client_cert = utils.get_clientcert(client_cert, config) repository = Repository(config["repository"], username, password) repository.set_certificate_authority(ca_cert) repository.set_client_certificate(client_cert) if not os.path.exists(package): raise exc.PackageNotFound( '"{0}" does not exist on the file system.'.format(package) ) resp = repository.register(PackageFile.from_filename(package, comment)) repository.close() if resp.is_redirect: raise exc.RedirectDetected( ('"{0}" attempted to redirect to "{1}" during registration.' ' Aborting...').format(config["repository"], resp.headers["location"])) resp.raise_for_status() def main(args): parser = argparse.ArgumentParser(prog="twine register") parser.add_argument( "-r", "--repository", action=utils.EnvironmentDefault, env="TWINE_REPOSITORY", default="pypi", help="The repository to register the package to. " "Should be a section in the config file (default: " "%(default)s). (Can also be set via %(env)s environment " "variable)", ) parser.add_argument( "--repository-url", action=utils.EnvironmentDefault, env="TWINE_REPOSITORY_URL", default=None, required=False, help="The repository URL to register the package to. " "This overrides --repository." "(Can also be set via %(env)s environment variable.)" ) parser.add_argument( "-u", "--username", action=utils.EnvironmentDefault, env="TWINE_USERNAME", required=False, help="The username to authenticate to the repository " "as (can also be set via %(env)s environment " "variable)", ) parser.add_argument( "-p", "--password", action=utils.EnvironmentDefault, env="TWINE_PASSWORD", required=False, help="The password to authenticate to the repository " "with (can also be set via %(env)s environment " "variable)", ) parser.add_argument( "-c", "--comment", help="The comment to include with the distribution file", ) parser.add_argument( "--config-file", default="~/.pypirc", help="The .pypirc config file to use", ) parser.add_argument( "--cert", action=utils.EnvironmentDefault, env="TWINE_CERT", default=None, required=False, metavar="path", help="Path to alternate CA bundle (can also be set via %(env)s " "environment variable)", ) parser.add_argument( "--client-cert", metavar="path", help="Path to SSL client certificate, a single file containing the " "private key and the certificate in PEM format", ) parser.add_argument( "package", metavar="package", help="File from which we read the package metadata", ) args = parser.parse_args(args) # Call the register function with the args from the command line register(**vars(args)) twine-1.10.0/twine/commands/upload.py0000644000175100017510000002206213232166062020623 0ustar sumanahsumanah00000000000000# Copyright 2013 Donald Stufft # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import, division, print_function from __future__ import unicode_literals import argparse import glob import os.path import sys import twine.exceptions as exc from twine.package import PackageFile from twine.repository import Repository, LEGACY_PYPI from twine import utils def group_wheel_files_first(files): if not any(fname for fname in files if fname.endswith(".whl")): # Return early if there's no wheel files return files files.sort(key=lambda x: -1 if x.endswith(".whl") else 0) return files def find_dists(dists): uploads = [] for filename in dists: if os.path.exists(filename): uploads.append(filename) continue # The filename didn't exist so it may be a glob files = glob.glob(filename) # If nothing matches, files is [] if not files: raise ValueError( "Cannot find file (or expand pattern): '%s'" % filename ) # Otherwise, files will be filenames that exist uploads.extend(files) return group_wheel_files_first(uploads) def skip_upload(response, skip_existing, package): filename = package.basefilename # NOTE(sigmavirus24): Old PyPI returns the first message while Warehouse # returns the latter. This papers over the differences. msg = ('A file named "{0}" already exists for'.format(filename), 'File already exists') # NOTE(sigmavirus24): PyPI presently returns a 400 status code with the # error message in the reason attribute. Other implementations return a # 409 status code. We only want to skip an upload if: # 1. The user has told us to skip existing packages (skip_existing is # True) AND # 2. a) The response status code is 409 OR # 2. b) The response status code is 400 AND it has a reason that matches # what we expect PyPI to return to us. return (skip_existing and (response.status_code == 409 or (response.status_code == 400 and response.reason.startswith(msg)))) def upload(dists, repository, sign, identity, username, password, comment, sign_with, config_file, skip_existing, cert, client_cert, repository_url): # Check that a nonsensical option wasn't given if not sign and identity: raise ValueError("sign must be given along with identity") dists = find_dists(dists) # Determine if the user has passed in pre-signed distributions signatures = dict( (os.path.basename(d), d) for d in dists if d.endswith(".asc") ) uploads = [i for i in dists if not i.endswith(".asc")] config = utils.get_repository_from_config( config_file, repository, repository_url, ) config["repository"] = utils.normalize_repository_url( config["repository"] ) print("Uploading distributions to {0}".format(config["repository"])) if config["repository"].startswith(LEGACY_PYPI): print( "Note: you are uploading to the old upload URL. It's recommended " "to use the new URL \"{0}\" or to leave the URL unspecified and " "allow twine to choose.".format(utils.DEFAULT_REPOSITORY)) username = utils.get_username(username, config) password = utils.get_password( config["repository"], username, password, config, ) ca_cert = utils.get_cacert(cert, config) client_cert = utils.get_clientcert(client_cert, config) repository = Repository(config["repository"], username, password) repository.set_certificate_authority(ca_cert) repository.set_client_certificate(client_cert) for filename in uploads: package = PackageFile.from_filename(filename, comment) skip_message = ( " Skipping {0} because it appears to already exist".format( package.basefilename) ) # Note: The skip_existing check *needs* to be first, because otherwise # we're going to generate extra HTTP requests against a hardcoded # URL for no reason. if skip_existing and repository.package_is_uploaded(package): print(skip_message) continue signed_name = package.signed_basefilename if signed_name in signatures: package.add_gpg_signature(signatures[signed_name], signed_name) elif sign: package.sign(sign_with, identity) resp = repository.upload(package) # Bug 92. If we get a redirect we should abort because something seems # funky. The behaviour is not well defined and redirects being issued # by PyPI should never happen in reality. This should catch malicious # redirects as well. if resp.is_redirect: raise exc.RedirectDetected( ('"{0}" attempted to redirect to "{1}" during upload.' ' Aborting...').format(config["repository"], resp.headers["location"])) if skip_upload(resp, skip_existing, package): print(skip_message) continue utils.check_status_code(resp) # Bug 28. Try to silence a ResourceWarning by clearing the connection # pool. repository.close() def main(args): parser = argparse.ArgumentParser(prog="twine upload") parser.add_argument( "-r", "--repository", action=utils.EnvironmentDefault, env="TWINE_REPOSITORY", default="pypi", help="The repository to upload the package to. " "Should be a section in the config file (default: " "%(default)s). (Can also be set via %(env)s environment " "variable)", ) parser.add_argument( "--repository-url", action=utils.EnvironmentDefault, env="TWINE_REPOSITORY_URL", default=None, required=False, help="The repository URL to upload the package to. " "This overrides --repository." "(Can also be set via %(env)s environment variable.)" ) parser.add_argument( "-s", "--sign", action="store_true", default=False, help="Sign files to upload using gpg", ) parser.add_argument( "--sign-with", default="gpg", help="GPG program used to sign uploads (default: %(default)s)", ) parser.add_argument( "-i", "--identity", help="GPG identity used to sign files", ) parser.add_argument( "-u", "--username", action=utils.EnvironmentDefault, env="TWINE_USERNAME", required=False, help="The username to authenticate to the repository " "as (can also be set via %(env)s environment " "variable)", ) parser.add_argument( "-p", "--password", action=utils.EnvironmentDefault, env="TWINE_PASSWORD", required=False, help="The password to authenticate to the repository " "with (can also be set via %(env)s environment " "variable)", ) parser.add_argument( "-c", "--comment", help="The comment to include with the distribution file", ) parser.add_argument( "--config-file", default="~/.pypirc", help="The .pypirc config file to use", ) parser.add_argument( "--skip-existing", default=False, action="store_true", help="Continue uploading files if one already exists. (Only valid " "when uploading to PyPI. Other implementations may not support " "this.)", ) parser.add_argument( "--cert", action=utils.EnvironmentDefault, env="TWINE_CERT", default=None, required=False, metavar="path", help="Path to alternate CA bundle (can also be set via %(env)s " "environment variable)", ) parser.add_argument( "--client-cert", metavar="path", help="Path to SSL client certificate, a single file containing the " "private key and the certificate in PEM format", ) parser.add_argument( "dists", nargs="+", metavar="dist", help="The distribution files to upload to the repository, may " "additionally contain a .asc file to include an existing " "signature with the file upload", ) args = parser.parse_args(args) # Call the upload function with the arguments from the command line upload(**vars(args)) if __name__ == "__main__": sys.exit(main()) twine-1.10.0/twine/commands/__init__.py0000644000175100017510000000124613232165234021077 0ustar sumanahsumanah00000000000000# Copyright 2013 Donald Stufft # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import, division, print_function from __future__ import unicode_literals twine-1.10.0/twine.egg-info/0000755000175100017510000000000013250050564016653 5ustar sumanahsumanah00000000000000twine-1.10.0/twine.egg-info/entry_points.txt0000644000175100017510000000023013250050563022143 0ustar sumanahsumanah00000000000000[console_scripts] twine = twine.__main__:main [twine.registered_commands] register = twine.commands.register:main upload = twine.commands.upload:main twine-1.10.0/twine.egg-info/SOURCES.txt0000644000175100017510000000137413250050563020543 0ustar sumanahsumanah00000000000000AUTHORS LICENSE MANIFEST.in README.rst setup.cfg setup.py docs/Makefile docs/changelog.rst docs/conf.py docs/contributing.rst docs/index.rst docs/make.bat docs/_static/.empty tests/helpers.py tests/test_cli.py tests/test_main.py tests/test_package.py tests/test_repository.py tests/test_upload.py tests/test_utils.py tests/test_wheel.py twine/__init__.py twine/__main__.py twine/_installed.py twine/cli.py twine/exceptions.py twine/package.py twine/repository.py twine/utils.py twine/wheel.py twine/wininst.py twine.egg-info/PKG-INFO twine.egg-info/SOURCES.txt twine.egg-info/dependency_links.txt twine.egg-info/entry_points.txt twine.egg-info/requires.txt twine.egg-info/top_level.txt twine/commands/__init__.py twine/commands/register.py twine/commands/upload.pytwine-1.10.0/twine.egg-info/dependency_links.txt0000644000175100017510000000000113250050563022720 0ustar sumanahsumanah00000000000000 twine-1.10.0/twine.egg-info/top_level.txt0000644000175100017510000000000613250050563021400 0ustar sumanahsumanah00000000000000twine twine-1.10.0/twine.egg-info/PKG-INFO0000644000175100017510000003207513250050563017756 0ustar sumanahsumanah00000000000000Metadata-Version: 1.2 Name: twine Version: 1.10.0 Summary: Collection of utilities for publishing packages on PyPI Home-page: http://twine.readthedocs.io/ Author: Donald Stufft and individual contributors Author-email: donald@stufft.io License: Apache License, Version 2.0 Project-URL: Packaging tutorial, https://packaging.python.org/tutorials/distributing-packages/ Project-URL: Twine source, https://github.com/pypa/twine/ Project-URL: Twine documentation, https://twine.readthedocs.io/en/latest/ Description-Content-Type: UNKNOWN Description: twine ===== .. rtd-inclusion-marker-do-not-remove Twine is `a utility`_ for `publishing`_ packages on `PyPI`_. Currently it only supports registering `projects`_ and uploading `distributions`_. Why Should I Use This? ---------------------- The goal of ``twine`` is to improve PyPI interaction by improving security and testability. The biggest reason to use ``twine`` is that it securely authenticates you to PyPI over HTTPS using a verified connection, while ``python setup.py upload`` `only recently stopped using HTTP `_ in Python 2.7.9+ and Python 3.2+. This means anytime you use ``python setup.py upload`` with an older Python version, you expose your username and password to being easily sniffed. Twine uses only verified TLS to upload to PyPI, protecting your credentials from theft. Secondly, it allows you to precreate your distribution files. ``python setup.py upload`` only allows you to upload something that you've created in the same command invocation. This means that you cannot test the exact file you're going to upload to PyPI to ensure that it works before uploading it. Finally, it allows you to pre-sign your files and pass the ``.asc`` files into the command line invocation (``twine upload twine-1.0.1.tar.gz twine-1.0.1.tar.gz.asc``). This enables you to be assured that you're typing your ``gpg`` passphrase into ``gpg`` itself and not anything else, since *you* will be the one directly executing ``gpg --detach-sign -a ``. Features -------- - Verified HTTPS connections - Uploading doesn't require executing ``setup.py`` - Uploading files that have already been created, allowing testing of distributions before release - Supports uploading any packaging format (including wheels) Installation ------------ .. code-block:: console $ pip install twine Usage ----- 1. Create some distributions in the normal way: .. code-block:: console $ python setup.py sdist bdist_wheel 2. Upload with ``twine``: .. code-block:: console $ twine upload dist/* 3. Done! More documentation on using ``twine`` to upload packages to PyPI is in the `Python Packaging User Guide`_. Options ^^^^^^^ .. code-block:: console $ twine upload -h usage: twine upload [-h] [-r REPOSITORY] [--repository-url REPOSITORY_URL] [-s] [--sign-with SIGN_WITH] [-i IDENTITY] [-u USERNAME] [-p PASSWORD] [-c COMMENT] [--config-file CONFIG_FILE] [--skip-existing] [--cert path] [--client-cert path] dist [dist ...] positional arguments: dist The distribution files to upload to the repository, may additionally contain a .asc file to include an existing signature with the file upload optional arguments: -h, --help show this help message and exit -r REPOSITORY, --repository REPOSITORY The repository to upload the package to. Can be a section in the config file or a full URL to the repository (default: pypi). (Can also be set via TWINE_REPOSITORY environment variable) --repository-url REPOSITORY_URL The repository URL to upload the package to. This can be specified with --repository because it will be used if there is no configuration for the value passed to --repository. (Can also be set via TWINE_REPOSITORY_URL environment variable.) -s, --sign Sign files to upload using gpg --sign-with SIGN_WITH GPG program used to sign uploads (default: gpg) -i IDENTITY, --identity IDENTITY GPG identity used to sign files -u USERNAME, --username USERNAME The username to authenticate to the repository as (can also be set via TWINE_USERNAME environment variable) -p PASSWORD, --password PASSWORD The password to authenticate to the repository with (can also be set via TWINE_PASSWORD environment variable) -c COMMENT, --comment COMMENT The comment to include with the distribution file --config-file CONFIG_FILE The .pypirc config file to use --skip-existing Continue uploading files if one already exists. (Only valid when uploading to PyPI. Other implementations may not support this.) --cert path Path to alternate CA bundle (can also be set via TWINE_CERT environment variable) --client-cert path Path to SSL client certificate, a single file containing the private key and the certificate in PEM format Twine also includes a ``register`` command. .. WARNING:: ``register`` is `no longer necessary if you are uploading to pypi.org `_. As such, it is `no longer supported `_ in `Warehouse`_ (the new PyPI software running on pypi.org). However, you may need this if you are using a different package index. For completeness, its usage: .. code-block:: console $ twine register -h usage: twine register [-h] [-r REPOSITORY] [--repository-url REPOSITORY_URL] [-u USERNAME] [-p PASSWORD] [-c COMMENT] [--config-file CONFIG_FILE] [--cert path] [--client-cert path] package positional arguments: package File from which we read the package metadata optional arguments: -h, --help show this help message and exit -r REPOSITORY, --repository REPOSITORY The repository to register the package to. Can be a section in the config file or a full URL to the repository (default: pypi). (Can also be set via TWINE_REPOSITORY environment variable) --repository-url REPOSITORY_URL The repository URL to upload the package to. This can be specified with --repository because it will be used if there is no configuration for the value passed to --repository. (Can also be set via TWINE_REPOSITORY_URL environment variable.) -u USERNAME, --username USERNAME The username to authenticate to the repository as (can also be set via TWINE_USERNAME environment variable) -p PASSWORD, --password PASSWORD The password to authenticate to the repository with (can also be set via TWINE_PASSWORD environment variable) -c COMMENT, --comment COMMENT The comment to include with the distribution file --config-file CONFIG_FILE The .pypirc config file to use --cert path Path to alternate CA bundle (can also be set via TWINE_CERT environment variable) --client-cert path Path to SSL client certificate, a single file containing the private key and the certificate in PEM format Environment Variables ^^^^^^^^^^^^^^^^^^^^^ Twine also supports configuration via environment variables. Options passed on the command line will take precedence over options set via environment variables. Definition via environment variable is helpful in environments where it is not convenient to create a `.pypirc` file, such as a CI/build server, for example. * ``TWINE_USERNAME`` - the username to use for authentication to the repository * ``TWINE_PASSWORD`` - the password to use for authentication to the repository * ``TWINE_REPOSITORY`` - the repository configuration, either defined as a section in `.pypirc` or provided as a full URL * ``TWINE_REPOSITORY_URL`` - the repository URL to use * ``TWINE_CERT`` - custom CA certificate to use for repositories with self-signed or untrusted certificates Resources --------- * `IRC `_ (``#pypa`` - irc.freenode.net) * `GitHub repository `_ * User and developer `documentation`_ * `Python Packaging User Guide`_ Contributing ------------ See our `developer documentation`_ for how to get started, an architectural overview, and our future development plans. Code of Conduct --------------- Everyone interacting in the ``twine`` project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the `PyPA Code of Conduct`_. .. _`a utility`: https://pypi.org/project/twine/ .. _`publishing`: https://packaging.python.org/tutorials/distributing-packages/ .. _`PyPI`: https://pypi.org .. _`Python Packaging User Guide`: https://packaging.python.org/tutorials/distributing-packages/ .. _`documentation`: http://twine.readthedocs.io/ .. _`developer documentation`: https://twine.readthedocs.io/en/latest/contributing.html .. _`projects`: https://packaging.python.org/glossary/#term-project .. _`distributions`: https://packaging.python.org/glossary/#term-distribution-package .. _`PyPA Code of Conduct`: https://www.pypa.io/en/latest/code-of-conduct/ .. _`Warehouse`: https://github.com/pypa/warehouse Platform: UNKNOWN Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Apache Software License Classifier: Natural Language :: English Classifier: Operating System :: MacOS :: MacOS X Classifier: Operating System :: POSIX Classifier: Operating System :: POSIX :: BSD Classifier: Operating System :: POSIX :: Linux Classifier: Operating System :: Microsoft :: Windows Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy twine-1.10.0/twine.egg-info/requires.txt0000644000175100017510000000021413250050563021247 0ustar sumanahsumanah00000000000000tqdm>=4.14 pkginfo>=1.0 requests!=2.15,!=2.16,>=2.5.0 requests-toolbelt>=0.8.0 setuptools>=0.7.0 [keyring] keyring [with-blake2] pyblake2 twine-1.10.0/setup.cfg0000644000175100017510000000057513250050564015663 0ustar sumanahsumanah00000000000000[wheel] universal = 1 [check-manifest] ignore = .travis.yml tox.ini [metadata] requires-dist = tqdm >= 4.14 requests >= 2.5.0, != 2.15, != 2.16 requests-toolbelt >= 0.8.0 pkginfo >= 1.0 setuptools >= 0.7.0 argparse; python_version == '2.6' pyblake2; extra == 'with-blake2' and python_version < '3.6' keyring; extra == 'keyring' [egg_info] tag_build = tag_date = 0 twine-1.10.0/MANIFEST.in0000644000175100017510000000034613232165234015575 0ustar sumanahsumanah00000000000000include LICENSE include README.rst include AUTHORS recursive-include tests *.py recursive-include docs *.bat recursive-include docs *.empty recursive-include docs *.py recursive-include docs *.rst recursive-include docs Makefile twine-1.10.0/tests/0000755000175100017510000000000013250050564015175 5ustar sumanahsumanah00000000000000twine-1.10.0/tests/test_package.py0000644000175100017510000000443513232166005020205 0ustar sumanahsumanah00000000000000# Copyright 2015 Ian Cordasco # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import unicode_literals from twine import package import pretend def test_sign_file(monkeypatch): replaced_check_call = pretend.call_recorder(lambda args: None) monkeypatch.setattr(package.subprocess, 'check_call', replaced_check_call) filename = 'tests/fixtures/deprecated-pypirc' pkg = package.PackageFile( filename=filename, comment=None, metadata=pretend.stub(name="deprecated-pypirc"), python_version=None, filetype=None ) try: pkg.sign('gpg2', None) except IOError: pass args = ('gpg2', '--detach-sign', '-a', filename) assert replaced_check_call.calls == [pretend.call(args)] def test_sign_file_with_identity(monkeypatch): replaced_check_call = pretend.call_recorder(lambda args: None) monkeypatch.setattr(package.subprocess, 'check_call', replaced_check_call) filename = 'tests/fixtures/deprecated-pypirc' pkg = package.PackageFile( filename=filename, comment=None, metadata=pretend.stub(name="deprecated-pypirc"), python_version=None, filetype=None ) try: pkg.sign('gpg', 'identity') except IOError: pass args = ('gpg', '--detach-sign', '--local-user', 'identity', '-a', filename) assert replaced_check_call.calls == [pretend.call(args)] def test_package_signed_name_is_correct(): filename = 'tests/fixtures/deprecated-pypirc' pkg = package.PackageFile( filename=filename, comment=None, metadata=pretend.stub(name="deprecated-pypirc"), python_version=None, filetype=None ) assert pkg.signed_basefilename == "deprecated-pypirc.asc" assert pkg.signed_filename == (filename + '.asc') twine-1.10.0/tests/test_wheel.py0000644000175100017510000000257513232166062017724 0ustar sumanahsumanah00000000000000# Copyright 2015 Ian Cordasco # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import unicode_literals from twine import wheel import pytest @pytest.fixture(params=[ 'tests/fixtures/twine-1.5.0-py2.py3-none-any.whl', 'tests/alt-fixtures/twine-1.5.0-py2.py3-none-any.whl' ]) def example_wheel(request): return wheel.Wheel(request.param) def test_version_parsing(example_wheel): assert example_wheel.py_version == 'py2.py3' def test_find_metadata_files(): names = [ b'package/lib/__init__.py', b'package/lib/version.py', b'package/METADATA.txt', b'package/METADATA.json', b'package/METADATA', ] expected = [ ['package', 'METADATA'], ['package', 'METADATA.json'], ['package', 'METADATA.txt'], ] candidates = wheel.Wheel.find_candidate_metadata_files(names) assert expected == candidates twine-1.10.0/tests/test_utils.py0000644000175100017510000001627513250046230017754 0ustar sumanahsumanah00000000000000# Copyright 2013 Donald Stufft # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import, division, print_function from __future__ import unicode_literals import sys import os.path import textwrap try: import builtins except ImportError: import __builtin__ as builtins import pytest from twine import utils import helpers def test_get_config(tmpdir): pypirc = os.path.join(str(tmpdir), ".pypirc") with open(pypirc, "w") as fp: fp.write(textwrap.dedent(""" [distutils] index-servers = pypi [pypi] username = testuser password = testpassword """)) assert utils.get_config(pypirc) == { "pypi": { "repository": utils.DEFAULT_REPOSITORY, "username": "testuser", "password": "testpassword", }, } def test_get_config_no_distutils(tmpdir): pypirc = os.path.join(str(tmpdir), ".pypirc") with open(pypirc, "w") as fp: fp.write(textwrap.dedent(""" [pypi] username = testuser password = testpassword """)) assert utils.get_config(pypirc) == { "pypi": { "repository": utils.DEFAULT_REPOSITORY, "username": "testuser", "password": "testpassword", }, } def test_get_config_no_section(tmpdir): pypirc = os.path.join(str(tmpdir), ".pypirc") with open(pypirc, "w") as fp: fp.write(textwrap.dedent(""" [distutils] index-servers = pypi foo [pypi] username = testuser password = testpassword """)) assert utils.get_config(pypirc) == { "pypi": { "repository": utils.DEFAULT_REPOSITORY, "username": "testuser", "password": "testpassword", }, } def test_get_config_missing(tmpdir): pypirc = os.path.join(str(tmpdir), ".pypirc") assert utils.get_config(pypirc) == { "pypi": { "repository": utils.DEFAULT_REPOSITORY, "username": None, "password": None, }, "pypitest": { "repository": utils.TEST_REPOSITORY, "username": None, "password": None }, } def test_get_repository_config_missing(tmpdir): pypirc = os.path.join(str(tmpdir), ".pypirc") repository_url = "https://notexisting.python.org/pypi" exp = { "repository": repository_url, "username": None, "password": None, } assert (utils.get_repository_from_config(pypirc, 'foo', repository_url) == exp) assert (utils.get_repository_from_config(pypirc, 'pypi', repository_url) == exp) exp = { "repository": utils.DEFAULT_REPOSITORY, "username": None, "password": None, } assert utils.get_repository_from_config(pypirc, "pypi") == exp def test_get_config_deprecated_pypirc(): tests_dir = os.path.dirname(os.path.abspath(__file__)) deprecated_pypirc_path = os.path.join(tests_dir, 'fixtures', 'deprecated-pypirc') assert utils.get_config(deprecated_pypirc_path) == { "pypi": { "repository": utils.DEFAULT_REPOSITORY, "username": 'testusername', "password": 'testpassword', }, } @pytest.mark.parametrize( ('cli_value', 'config', 'key', 'strategy', 'expected'), ( ('cli', {}, 'key', lambda: 'fallback', 'cli'), (None, {'key': 'value'}, 'key', lambda: 'fallback', 'value'), (None, {}, 'key', lambda: 'fallback', 'fallback'), ), ) def test_get_userpass_value(cli_value, config, key, strategy, expected): ret = utils.get_userpass_value(cli_value, config, key, strategy) assert ret == expected @pytest.mark.parametrize( ('env_name', 'default', 'environ', 'expected'), [ ('MY_PASSWORD', None, {}, None), ('MY_PASSWORD', None, {'MY_PASSWORD': 'foo'}, 'foo'), ('URL', 'https://example.org', {}, 'https://example.org'), ('URL', 'https://example.org', {'URL': 'https://pypi.org'}, 'https://pypi.org'), ], ) def test_default_to_environment_action(env_name, default, environ, expected): option_strings = ('-x', '--example') dest = 'example' with helpers.set_env(**environ): action = utils.EnvironmentDefault( env=env_name, default=default, option_strings=option_strings, dest=dest, ) assert action.env == env_name assert action.default == expected def test_get_password_keyring_overrides_prompt(monkeypatch): class MockKeyring: @staticmethod def get_password(system, user): return '{user}@{system} sekure pa55word'.format(**locals()) monkeypatch.setitem(sys.modules, 'keyring', MockKeyring) pw = utils.get_password('system', 'user', None, {}) assert pw == 'user@system sekure pa55word' def test_get_password_keyring_defers_to_prompt(monkeypatch): monkeypatch.setattr(utils, 'password_prompt', lambda prompt: 'entered pw') class MockKeyring: @staticmethod def get_password(system, user): return monkeypatch.setitem(sys.modules, 'keyring', MockKeyring) pw = utils.get_password('system', 'user', None, {}) assert pw == 'entered pw' @pytest.fixture def keyring_missing(monkeypatch): """ Simulate that 'import keyring' raises an ImportError """ real_import = builtins.__import__ def my_import(name, *args, **kwargs): if name == 'keyring': raise ImportError return real_import(name, *args, **kwargs) monkeypatch.setattr(builtins, '__import__', my_import) @pytest.fixture def entered_password(monkeypatch): monkeypatch.setattr(utils, 'password_prompt', lambda prompt: 'entered pw') def test_get_password_keyring_missing_prompts( entered_password, keyring_missing): assert utils.get_password('system', 'user', None, {}) == 'entered pw' @pytest.fixture def keyring_no_backends(monkeypatch): """ Simulate that keyring has no available backends. When keyring has no backends for the system, the backend will be a fail.Keyring, which raises RuntimeError on get_password. """ class FailKeyring(object): @staticmethod def get_password(system, username): raise RuntimeError("fail!") monkeypatch.setitem(sys.modules, 'keyring', FailKeyring()) def test_get_password_runtime_error_suppressed( entered_password, keyring_no_backends, recwarn): assert utils.get_password('system', 'user', None, {}) == 'entered pw' assert len(recwarn) == 1 warning = recwarn.pop(UserWarning) assert 'fail!' in str(warning) twine-1.10.0/tests/test_upload.py0000644000175100017510000001260213246346770020107 0ustar sumanahsumanah00000000000000# Copyright 2014 Ian Cordasco # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import unicode_literals import os import textwrap import pretend import pytest from twine.commands import upload from twine import package, cli import twine import helpers WHEEL_FIXTURE = 'tests/fixtures/twine-1.5.0-py2.py3-none-any.whl' def test_ensure_wheel_files_uploaded_first(): files = upload.group_wheel_files_first(["twine/foo.py", "twine/first.whl", "twine/bar.py", "twine/second.whl"]) expected = ["twine/first.whl", "twine/second.whl", "twine/foo.py", "twine/bar.py"] assert expected == files def test_ensure_if_no_wheel_files(): files = upload.group_wheel_files_first(["twine/foo.py", "twine/bar.py"]) expected = ["twine/foo.py", "twine/bar.py"] assert expected == files def test_find_dists_expands_globs(): files = sorted(upload.find_dists(['twine/__*.py'])) expected = [os.path.join('twine', '__init__.py'), os.path.join('twine', '__main__.py')] assert expected == files def test_find_dists_errors_on_invalid_globs(): with pytest.raises(ValueError): upload.find_dists(['twine/*.rb']) def test_find_dists_handles_real_files(): expected = ['twine/__init__.py', 'twine/__main__.py', 'twine/cli.py', 'twine/utils.py', 'twine/wheel.py'] files = upload.find_dists(expected) assert expected == files def test_get_config_old_format(tmpdir): pypirc = os.path.join(str(tmpdir), ".pypirc") dists = ["tests/fixtures/twine-1.5.0-py2.py3-none-any.whl"] with open(pypirc, "w") as fp: fp.write(textwrap.dedent(""" [server-login] username:foo password:bar """)) try: upload.upload(dists=dists, repository="pypi", sign=None, identity=None, username=None, password=None, comment=None, cert=None, client_cert=None, sign_with=None, config_file=pypirc, skip_existing=False, repository_url=None, ) except KeyError as err: assert err.args[0] == ( "Missing 'pypi' section from the configuration file\n" "or not a complete URL in --repository-url.\n" "Maybe you have a out-dated '{0}' format?\n" "more info: " "https://docs.python.org/distutils/packageindex.html#pypirc\n" ).format(pypirc) def test_skip_existing_skips_files_already_on_PyPI(monkeypatch): response = pretend.stub( status_code=400, reason='A file named "twine-1.5.0-py2.py3-none-any.whl" already ' 'exists for twine-1.5.0.') pkg = package.PackageFile.from_filename(WHEEL_FIXTURE, None) assert upload.skip_upload(response=response, skip_existing=True, package=pkg) is True def test_skip_existing_skips_files_already_on_pypiserver(monkeypatch): # pypiserver (https://pypi.python.org/pypi/pypiserver) responds with 409 response = pretend.stub( status_code=409, reason='A file named "twine-1.5.0-py2.py3-none-any.whl" already ' 'exists for twine-1.5.0.') pkg = package.PackageFile.from_filename(WHEEL_FIXTURE, None) assert upload.skip_upload(response=response, skip_existing=True, package=pkg) is True def test_skip_upload_respects_skip_existing(monkeypatch): response = pretend.stub( status_code=400, reason='A file named "twine-1.5.0-py2.py3-none-any.whl" already ' 'exists for twine-1.5.0.') pkg = package.PackageFile.from_filename(WHEEL_FIXTURE, None) assert upload.skip_upload(response=response, skip_existing=False, package=pkg) is False def test_values_from_env(monkeypatch): def none_upload(*args, **kwargs): pass replaced_upload = pretend.call_recorder(none_upload) monkeypatch.setattr(twine.commands.upload, "upload", replaced_upload) testenv = {"TWINE_USERNAME": "pypiuser", "TWINE_PASSWORD": "pypipassword", "TWINE_CERT": "/foo/bar.crt"} with helpers.set_env(**testenv): cli.dispatch(["upload", "path/to/file"]) cli.dispatch(["upload", "path/to/file"]) result_kwargs = replaced_upload.calls[0].kwargs assert "pypipassword" == result_kwargs["password"] assert "pypiuser" == result_kwargs["username"] assert "/foo/bar.crt" == result_kwargs["cert"] result_kwargs = replaced_upload.calls[1].kwargs assert None is result_kwargs["password"] assert None is result_kwargs["username"] assert None is result_kwargs["cert"] twine-1.10.0/tests/test_main.py0000644000175100017510000000146013232166062017534 0ustar sumanahsumanah00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from twine import __main__ as dunder_main import pretend def test_exception_handling(monkeypatch): replaced_dispatch = pretend.raiser(KeyError('foo')) monkeypatch.setattr(dunder_main, 'dispatch', replaced_dispatch) assert dunder_main.main() == 'KeyError: foo' twine-1.10.0/tests/helpers.py0000644000175100017510000000222413232166062017212 0ustar sumanahsumanah00000000000000# Copyright 2016 Ian Cordasco # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Test functions useful across twine's tests.""" import contextlib import os @contextlib.contextmanager def set_env(**environ): """Set the process environment variables temporarily. >>> with set_env(PLUGINS_DIR=u'test/plugins'): ... "PLUGINS_DIR" in os.environ True >>> "PLUGINS_DIR" in os.environ False :param environ: Environment variables to set :type environ: dict[str, unicode] """ old_environ = dict(os.environ) os.environ.update(environ) try: yield finally: os.environ.clear() os.environ.update(old_environ) twine-1.10.0/tests/test_repository.py0000644000175100017510000000775413246346770021056 0ustar sumanahsumanah00000000000000# Copyright 2015 Ian Cordasco # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import requests from twine import repository import pretend def test_gpg_signature_structure_is_preserved(): data = { 'gpg_signature': ('filename.asc', 'filecontent'), } tuples = repository.Repository._convert_data_to_list_of_tuples(data) assert tuples == [('gpg_signature', ('filename.asc', 'filecontent'))] def test_content_structure_is_preserved(): data = { 'content': ('filename', 'filecontent'), } tuples = repository.Repository._convert_data_to_list_of_tuples(data) assert tuples == [('content', ('filename', 'filecontent'))] def test_iterables_are_flattened(): data = { 'platform': ['UNKNOWN'], } tuples = repository.Repository._convert_data_to_list_of_tuples(data) assert tuples == [('platform', 'UNKNOWN')] data = { 'platform': ['UNKNOWN', 'ANOTHERPLATFORM'], } tuples = repository.Repository._convert_data_to_list_of_tuples(data) assert tuples == [('platform', 'UNKNOWN'), ('platform', 'ANOTHERPLATFORM')] def test_set_client_certificate(): repo = repository.Repository( repository_url='https://pypi.python.org/pypi', username='username', password='password', ) assert repo.session.cert is None repo.set_client_certificate(('/path/to/cert', '/path/to/key')) assert repo.session.cert == ('/path/to/cert', '/path/to/key') def test_set_certificate_authority(): repo = repository.Repository( repository_url='https://pypi.python.org/pypi', username='username', password='password', ) assert repo.session.verify is True repo.set_certificate_authority('/path/to/cert') assert repo.session.verify == '/path/to/cert' def test_make_user_agent_string(): repo = repository.Repository( repository_url='https://pypi.python.org/pypi', username='username', password='password', ) assert 'User-Agent' in repo.session.headers user_agent = repo.session.headers['User-Agent'] assert 'twine/' in user_agent assert 'requests/' in user_agent assert 'requests-toolbelt/' in user_agent assert 'pkginfo/' in user_agent assert 'setuptools/' in user_agent def response_with(**kwattrs): resp = requests.Response() for attr, value in kwattrs.items(): if hasattr(resp, attr): setattr(resp, attr, value) return resp def test_package_is_uploaded_404s(): repo = repository.Repository( repository_url='https://pypi.python.org/pypi', username='username', password='password', ) repo.session = pretend.stub( get=lambda url, headers: response_with(status_code=404) ) package = pretend.stub( safe_name='fake', metadata=pretend.stub(version='2.12.0'), ) assert repo.package_is_uploaded(package) is False def test_package_is_uploaded_200s_with_no_releases(): repo = repository.Repository( repository_url='https://pypi.python.org/pypi', username='username', password='password', ) repo.session = pretend.stub( get=lambda url, headers: response_with(status_code=200, _content=b'{"releases": {}}', _content_consumed=True), ) package = pretend.stub( safe_name='fake', metadata=pretend.stub(version='2.12.0'), ) assert repo.package_is_uploaded(package) is False twine-1.10.0/tests/test_cli.py0000644000175100017510000000221513232165234017356 0ustar sumanahsumanah00000000000000# Copyright 2013 Donald Stufft # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import, division, print_function from __future__ import unicode_literals import pretend import pytest from twine import cli import twine.commands.upload def test_dispatch_to_subcommand(monkeypatch): replaced_main = pretend.call_recorder(lambda args: None) monkeypatch.setattr(twine.commands.upload, "main", replaced_main) cli.dispatch(["upload", "path/to/file"]) assert replaced_main.calls == [pretend.call(["path/to/file"])] def test_catches_enoent(): with pytest.raises(SystemExit): cli.dispatch(["non-existant-command"]) twine-1.10.0/PKG-INFO0000644000175100017510000003207513250050564015137 0ustar sumanahsumanah00000000000000Metadata-Version: 1.2 Name: twine Version: 1.10.0 Summary: Collection of utilities for publishing packages on PyPI Home-page: http://twine.readthedocs.io/ Author: Donald Stufft and individual contributors Author-email: donald@stufft.io License: Apache License, Version 2.0 Project-URL: Packaging tutorial, https://packaging.python.org/tutorials/distributing-packages/ Project-URL: Twine source, https://github.com/pypa/twine/ Project-URL: Twine documentation, https://twine.readthedocs.io/en/latest/ Description-Content-Type: UNKNOWN Description: twine ===== .. rtd-inclusion-marker-do-not-remove Twine is `a utility`_ for `publishing`_ packages on `PyPI`_. Currently it only supports registering `projects`_ and uploading `distributions`_. Why Should I Use This? ---------------------- The goal of ``twine`` is to improve PyPI interaction by improving security and testability. The biggest reason to use ``twine`` is that it securely authenticates you to PyPI over HTTPS using a verified connection, while ``python setup.py upload`` `only recently stopped using HTTP `_ in Python 2.7.9+ and Python 3.2+. This means anytime you use ``python setup.py upload`` with an older Python version, you expose your username and password to being easily sniffed. Twine uses only verified TLS to upload to PyPI, protecting your credentials from theft. Secondly, it allows you to precreate your distribution files. ``python setup.py upload`` only allows you to upload something that you've created in the same command invocation. This means that you cannot test the exact file you're going to upload to PyPI to ensure that it works before uploading it. Finally, it allows you to pre-sign your files and pass the ``.asc`` files into the command line invocation (``twine upload twine-1.0.1.tar.gz twine-1.0.1.tar.gz.asc``). This enables you to be assured that you're typing your ``gpg`` passphrase into ``gpg`` itself and not anything else, since *you* will be the one directly executing ``gpg --detach-sign -a ``. Features -------- - Verified HTTPS connections - Uploading doesn't require executing ``setup.py`` - Uploading files that have already been created, allowing testing of distributions before release - Supports uploading any packaging format (including wheels) Installation ------------ .. code-block:: console $ pip install twine Usage ----- 1. Create some distributions in the normal way: .. code-block:: console $ python setup.py sdist bdist_wheel 2. Upload with ``twine``: .. code-block:: console $ twine upload dist/* 3. Done! More documentation on using ``twine`` to upload packages to PyPI is in the `Python Packaging User Guide`_. Options ^^^^^^^ .. code-block:: console $ twine upload -h usage: twine upload [-h] [-r REPOSITORY] [--repository-url REPOSITORY_URL] [-s] [--sign-with SIGN_WITH] [-i IDENTITY] [-u USERNAME] [-p PASSWORD] [-c COMMENT] [--config-file CONFIG_FILE] [--skip-existing] [--cert path] [--client-cert path] dist [dist ...] positional arguments: dist The distribution files to upload to the repository, may additionally contain a .asc file to include an existing signature with the file upload optional arguments: -h, --help show this help message and exit -r REPOSITORY, --repository REPOSITORY The repository to upload the package to. Can be a section in the config file or a full URL to the repository (default: pypi). (Can also be set via TWINE_REPOSITORY environment variable) --repository-url REPOSITORY_URL The repository URL to upload the package to. This can be specified with --repository because it will be used if there is no configuration for the value passed to --repository. (Can also be set via TWINE_REPOSITORY_URL environment variable.) -s, --sign Sign files to upload using gpg --sign-with SIGN_WITH GPG program used to sign uploads (default: gpg) -i IDENTITY, --identity IDENTITY GPG identity used to sign files -u USERNAME, --username USERNAME The username to authenticate to the repository as (can also be set via TWINE_USERNAME environment variable) -p PASSWORD, --password PASSWORD The password to authenticate to the repository with (can also be set via TWINE_PASSWORD environment variable) -c COMMENT, --comment COMMENT The comment to include with the distribution file --config-file CONFIG_FILE The .pypirc config file to use --skip-existing Continue uploading files if one already exists. (Only valid when uploading to PyPI. Other implementations may not support this.) --cert path Path to alternate CA bundle (can also be set via TWINE_CERT environment variable) --client-cert path Path to SSL client certificate, a single file containing the private key and the certificate in PEM format Twine also includes a ``register`` command. .. WARNING:: ``register`` is `no longer necessary if you are uploading to pypi.org `_. As such, it is `no longer supported `_ in `Warehouse`_ (the new PyPI software running on pypi.org). However, you may need this if you are using a different package index. For completeness, its usage: .. code-block:: console $ twine register -h usage: twine register [-h] [-r REPOSITORY] [--repository-url REPOSITORY_URL] [-u USERNAME] [-p PASSWORD] [-c COMMENT] [--config-file CONFIG_FILE] [--cert path] [--client-cert path] package positional arguments: package File from which we read the package metadata optional arguments: -h, --help show this help message and exit -r REPOSITORY, --repository REPOSITORY The repository to register the package to. Can be a section in the config file or a full URL to the repository (default: pypi). (Can also be set via TWINE_REPOSITORY environment variable) --repository-url REPOSITORY_URL The repository URL to upload the package to. This can be specified with --repository because it will be used if there is no configuration for the value passed to --repository. (Can also be set via TWINE_REPOSITORY_URL environment variable.) -u USERNAME, --username USERNAME The username to authenticate to the repository as (can also be set via TWINE_USERNAME environment variable) -p PASSWORD, --password PASSWORD The password to authenticate to the repository with (can also be set via TWINE_PASSWORD environment variable) -c COMMENT, --comment COMMENT The comment to include with the distribution file --config-file CONFIG_FILE The .pypirc config file to use --cert path Path to alternate CA bundle (can also be set via TWINE_CERT environment variable) --client-cert path Path to SSL client certificate, a single file containing the private key and the certificate in PEM format Environment Variables ^^^^^^^^^^^^^^^^^^^^^ Twine also supports configuration via environment variables. Options passed on the command line will take precedence over options set via environment variables. Definition via environment variable is helpful in environments where it is not convenient to create a `.pypirc` file, such as a CI/build server, for example. * ``TWINE_USERNAME`` - the username to use for authentication to the repository * ``TWINE_PASSWORD`` - the password to use for authentication to the repository * ``TWINE_REPOSITORY`` - the repository configuration, either defined as a section in `.pypirc` or provided as a full URL * ``TWINE_REPOSITORY_URL`` - the repository URL to use * ``TWINE_CERT`` - custom CA certificate to use for repositories with self-signed or untrusted certificates Resources --------- * `IRC `_ (``#pypa`` - irc.freenode.net) * `GitHub repository `_ * User and developer `documentation`_ * `Python Packaging User Guide`_ Contributing ------------ See our `developer documentation`_ for how to get started, an architectural overview, and our future development plans. Code of Conduct --------------- Everyone interacting in the ``twine`` project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the `PyPA Code of Conduct`_. .. _`a utility`: https://pypi.org/project/twine/ .. _`publishing`: https://packaging.python.org/tutorials/distributing-packages/ .. _`PyPI`: https://pypi.org .. _`Python Packaging User Guide`: https://packaging.python.org/tutorials/distributing-packages/ .. _`documentation`: http://twine.readthedocs.io/ .. _`developer documentation`: https://twine.readthedocs.io/en/latest/contributing.html .. _`projects`: https://packaging.python.org/glossary/#term-project .. _`distributions`: https://packaging.python.org/glossary/#term-distribution-package .. _`PyPA Code of Conduct`: https://www.pypa.io/en/latest/code-of-conduct/ .. _`Warehouse`: https://github.com/pypa/warehouse Platform: UNKNOWN Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Apache Software License Classifier: Natural Language :: English Classifier: Operating System :: MacOS :: MacOS X Classifier: Operating System :: POSIX Classifier: Operating System :: POSIX :: BSD Classifier: Operating System :: POSIX :: Linux Classifier: Operating System :: Microsoft :: Windows Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy twine-1.10.0/AUTHORS0000644000175100017510000000141213233635374015112 0ustar sumanahsumanah00000000000000# A list of people who have contributed to twine in order of their first # contribution. # # Uses the format of ``Name (url)`` with the ``(url)`` # being optional. Donald Stufft (https://caremad.io/) Jannis Leidel Ralf Schmitt Ian Cordasco Marc Abramowitz (http://marc-abramowitz.com/) Tom Myers Rodrigue Cloutier Tyrel Souza (https://tyrelsouza.com) Adam Talsma Jens Diemer (http://jensdiemer.de/) Andrew Watts Anna Martelli Ravenscroft Sumana Harihareswara twine-1.10.0/setup.py0000644000175100017510000000556713250050143015553 0ustar sumanahsumanah00000000000000# Copyright 2018 Donald Stufft and individual contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from setuptools import setup import sys import twine install_requires = [ "tqdm >= 4.14", "pkginfo >= 1.0", "requests >= 2.5.0, != 2.15, != 2.16", "requests-toolbelt >= 0.8.0", "setuptools >= 0.7.0", ] if sys.version_info[:2] < (2, 7): install_requires += [ "argparse", ] blake2_requires = [] if sys.version_info[:2] < (3, 6): blake2_requires += [ "pyblake2", ] setup( name=twine.__title__, version=twine.__version__, description=twine.__summary__, long_description=open("README.rst").read(), license=twine.__license__, url=twine.__uri__, project_urls={ 'Packaging tutorial': 'https://packaging.python.org/tutorials/distributing-packages/', 'Twine documentation': 'https://twine.readthedocs.io/en/latest/', 'Twine source': 'https://github.com/pypa/twine/', }, author=twine.__author__, author_email=twine.__email__, classifiers=[ "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", "Operating System :: MacOS :: MacOS X", "Operating System :: POSIX", "Operating System :: POSIX :: BSD", "Operating System :: POSIX :: Linux", "Operating System :: Microsoft :: Windows", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", ], packages=["twine", "twine.commands"], entry_points={ "twine.registered_commands": [ "upload = twine.commands.upload:main", "register = twine.commands.register:main", ], "console_scripts": [ "twine = twine.__main__:main", ], }, install_requires=install_requires, extras_require={ 'with-blake2': blake2_requires, 'keyring': [ 'keyring', ], }, )