Commit 5eeb4712 authored by SVN-Git Migration's avatar SVN-Git Migration

Imported Upstream version 1.5.0

parent ef8161d2
# A list of people who have contributed to Warehouse in order of their first
# A list of people who have contributed to twine in order of their first
# contribution.
#
# Uses the format of ``Name <email@domain.tld> (url)`` with the ``(url)``
# being optional.
Donald Stufft <donald@stufft.io> (https://caremad.io/)
Jannis Leidel <jannis@leidel.info>
Ralf Schmitt <ralf@systemexit.de>
Ian Cordasco <graffatcolmingov@gmail.com>
Marc Abramowitz <msabramo@gmail.com> (http://marc-abramowitz.com/)
include LICENSE
include CONTRIBUTORS
include README.rst
include AUTHORS
......
Metadata-Version: 1.1
Name: twine
Version: 1.3.1
Version: 1.5.0
Summary: Collection of utilities for interacting with PyPI
Home-page: https://github.com/dstufft/twine
Home-page: https://github.com/pypa/twine
Author: Donald Stufft and individual contributors
Author-email: donald@stufft.io
License: Apache License, Version 2.0
Description: twine
=====
Twine is a utility for interacting with PyPI.
Twine is a utility for interacting `with PyPI <https://pypi.python.org/pypi/twine>`_.
Currently it only supports uploading distributions.
......@@ -17,10 +17,12 @@ Description: twine
Why Should I Use This?
----------------------
The biggest reason to use twine is that ``python setup.py upload`` uploads
files over plaintext. This means anytime you use it you expose your username
and password to a MITM attack. Twine uses only verified TLS to upload to PyPI
protecting your credentials from theft.
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`` `uses
HTTP and exposes your credentials <http://bugs.python.org/issue12226>`_. This
means anytime you use it you expose your username and password to being
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
......@@ -39,17 +41,17 @@ Description: twine
Features
--------
* Verified HTTPS Connections
* Uploading doesn't require executing setup.py
* Uploading files that have already been created, allowing testing of
- 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).
- Supports uploading any packaging format (including wheels).
Installation
------------
.. code:: bash
.. code-block:: bash
$ pip install twine
......@@ -59,13 +61,13 @@ Description: twine
1. Create some distributions in the normal way:
.. code:: bash
.. code-block:: bash
$ python setup.py sdist bdist_wheel
2. Upload with twine:
.. code:: bash
.. code-block:: bash
$ twine upload dist/*
......@@ -75,7 +77,7 @@ Description: twine
Options
~~~~~~~
.. code:: bash
.. code-block:: bash
$ twine upload -h
usage: twine upload [-h] [-r REPOSITORY] [-s] [-i IDENTITY] [-u USERNAME]
......@@ -106,21 +108,29 @@ Description: twine
---------
* `IRC <http://webchat.freenode.net?channels=%23pypa>`_
(#pypa - irc.freenode.net)
* `Repository <https://github.com/dstufft/twine>`_
(``#pypa`` - irc.freenode.net)
* `GitHub repository <https://github.com/pypa/twine>`_
Contributing
------------
1. Fork the `repository`_ on GitHub.
1. Fork the `repository <https://github.com/pypa/twine>`_ on GitHub.
2. Make a branch off of master and commit your changes to it.
3. Ensure that your name is added to the end of the AUTHORS file using the
3. Run the tests with ``tox``
- 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``.
- Always run ``tox -e pep8``
4. Ensure that your name is added to the end of the AUTHORS file using the
format ``Name <email@domain.com> (url)``, where the ``(url)`` portion is
optional.
4. Submit a Pull Request to the master branch on GitHub.
5. Submit a Pull Request to the master branch on GitHub.
.. _repository: https://github.com/dstufft/twine
If you'd like to have a development environment for twine, you should create a
virtualenv and then do ``pip install -e .`` from within the directory.
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
......@@ -138,5 +148,6 @@ Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
twine
=====
Twine is a utility for interacting with PyPI.
Twine is a utility for interacting `with PyPI <https://pypi.python.org/pypi/twine>`_.
Currently it only supports uploading distributions.
......@@ -9,10 +9,12 @@ Currently it only supports uploading distributions.
Why Should I Use This?
----------------------
The biggest reason to use twine is that ``python setup.py upload`` uploads
files over plaintext. This means anytime you use it you expose your username
and password to a MITM attack. Twine uses only verified TLS to upload to PyPI
protecting your credentials from theft.
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`` `uses
HTTP and exposes your credentials <http://bugs.python.org/issue12226>`_. This
means anytime you use it you expose your username and password to being
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
......@@ -31,17 +33,17 @@ anything else since *you* will be the one directly executing
Features
--------
* Verified HTTPS Connections
* Uploading doesn't require executing setup.py
* Uploading files that have already been created, allowing testing of
- 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).
- Supports uploading any packaging format (including wheels).
Installation
------------
.. code:: bash
.. code-block:: bash
$ pip install twine
......@@ -51,13 +53,13 @@ Usage
1. Create some distributions in the normal way:
.. code:: bash
.. code-block:: bash
$ python setup.py sdist bdist_wheel
2. Upload with twine:
.. code:: bash
.. code-block:: bash
$ twine upload dist/*
......@@ -67,7 +69,7 @@ Usage
Options
~~~~~~~
.. code:: bash
.. code-block:: bash
$ twine upload -h
usage: twine upload [-h] [-r REPOSITORY] [-s] [-i IDENTITY] [-u USERNAME]
......@@ -98,18 +100,26 @@ Resources
---------
* `IRC <http://webchat.freenode.net?channels=%23pypa>`_
(#pypa - irc.freenode.net)
* `Repository <https://github.com/dstufft/twine>`_
(``#pypa`` - irc.freenode.net)
* `GitHub repository <https://github.com/pypa/twine>`_
Contributing
------------
1. Fork the `repository`_ on GitHub.
1. Fork the `repository <https://github.com/pypa/twine>`_ on GitHub.
2. Make a branch off of master and commit your changes to it.
3. Ensure that your name is added to the end of the AUTHORS file using the
3. Run the tests with ``tox``
- 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``.
- Always run ``tox -e pep8``
4. Ensure that your name is added to the end of the AUTHORS file using the
format ``Name <email@domain.com> (url)``, where the ``(url)`` portion is
optional.
4. Submit a Pull Request to the master branch on GitHub.
5. Submit a Pull Request to the master branch on GitHub.
.. _repository: https://github.com/dstufft/twine
If you'd like to have a development environment for twine, you should create a
virtualenv and then do ``pip install -e .`` from within the directory.
......@@ -4,6 +4,30 @@
Changelog
=========
* :release:`1.5.0 <2015-03-10>`
* :bug:`85` Display information about the version of setuptools installed
* :bug:`61` Support deprecated pypirc file format
* :feature:`29` Support commands not named "gpg" for signing
* Add lower-limit to requests dependency
* :release:`1.4.0 <2014-12-12>`
* :bug:`28` Prevent ResourceWarning from being shown
* :bug:`34` List registered commands in help text
* :bug:`32` Use pkg_resources to load registered commands
* :bug:`47` Fix issue uploading packages with ``_``\ s in the name
* :bug:`26` Add support for uploading Windows installers
* :bug:`65` Expand globs and check for existence of dists to upload
* :feature:`13` Parse ~/.pypirc ourselves and use subprocess instead of the
distutils.spawn module.
* :feature:`6` Switch to a git style dispatching for the commands to enable
......
......@@ -18,7 +18,7 @@ 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('.'))
sys.path.insert(0, os.path.abspath(os.pardir))
import twine
......@@ -26,7 +26,7 @@ import twine
# -- General configuration ----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
......@@ -40,8 +40,8 @@ extensions = [
]
# 'releases' (changelog) settings
releases_issue_uri = "https://github.com/dstufft/twine/issues/%s"
releases_release_uri = "https://github.com/dstufft/twine/tree/%s"
releases_issue_uri = "https://github.com/pypa/twine/issues/%s"
releases_release_uri = "https://github.com/pypa/twine/tree/%s"
# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
......@@ -50,7 +50,7 @@ templates_path = ["_templates"]
source_suffix = ".rst"
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = "index"
......@@ -70,37 +70,37 @@ release = twine.__version__
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# 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
# default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# 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
# add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# 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 = []
# modindex_common_prefix = []
# -- Options for HTML output --------------------------------------------------
......@@ -112,26 +112,26 @@ html_theme = "default"
# 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 = {}
# html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# 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
# 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
# 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,
......@@ -140,44 +140,44 @@ 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'
# 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
# html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = "twinedoc"
......@@ -187,13 +187,13 @@ htmlhelp_basename = "twinedoc"
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
# 'preamble': '',
}
# Grouping the document tree into LaTeX files. List of tuples
......@@ -210,23 +210,23 @@ latex_documents = [
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# latex_show_urls = False
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# latex_domain_indices = True
# -- Options for manual page output -------------------------------------------
......@@ -244,7 +244,7 @@ man_pages = [
]
# If true, show URL addresses after external links.
#man_show_urls = False
# man_show_urls = False
# -- Options for Texinfo output -----------------------------------------------
......@@ -265,13 +265,13 @@ texinfo_documents = [
]
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
# texinfo_show_urls = 'footnote'
# Example configuration for intersphinx: refer to the Python standard library.
......
......@@ -14,6 +14,6 @@ requires-dist =
[egg_info]
tag_build =
tag_svn_revision = 0
tag_date = 0
tag_svn_revision = 0
......@@ -19,8 +19,9 @@ import twine
install_requires = [
"requests",
"pkginfo",
"requests >= 2.0",
"setuptools >= 0.7.0",
]
if sys.version_info[:2] < (2, 7):
......@@ -57,6 +58,7 @@ setup(
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.2",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
],
......@@ -64,9 +66,11 @@ setup(
packages=["twine", "twine.commands"],
entry_points={
"twine.registered_commands": [
"upload = twine.commands.upload:main",
],
"console_scripts": [
"twine = twine.__main__:main",
"twine-upload = twine.commands.upload:main",
],
},
......
# 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"])
# 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.
import pretend
import pytest
from twine.commands import upload
def test_find_dists_expands_globs():
files = sorted(upload.find_dists(['twine/__*.py']))
expected = ['twine/__init__.py', '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_sign_file(monkeypatch):
replaced_check_call = pretend.call_recorder(lambda args: None)
monkeypatch.setattr(upload.subprocess, 'check_call', replaced_check_call)
upload.sign_file('gpg2', 'my_file.tar.gz', None)
args = ['gpg2', '--detach-sign', '-a', 'my_file.tar.gz']
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(upload.subprocess, 'check_call', replaced_check_call)
upload.sign_file('gpg', 'my_file.tar.gz', 'identity')
args = ['gpg', '--detach-sign', '--local-user', 'identity', '-a',
'my_file.tar.gz']
assert replaced_check_call.calls == [pretend.call(args)]
# 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.path
import textwrap
import pytest
from twine.utils import DEFAULT_REPOSITORY, get_config, get_userpass_value
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 get_config(pypirc) == {
"pypi": {
"repository": 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 get_config(pypirc) == {
"pypi": {
"repository": 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 get_config(pypirc) == {
"pypi": {
"repository": DEFAULT_REPOSITORY,
"username": "testuser",
"password": "testpassword",
},
}
def test_get_config_missing(tmpdir):
pypirc = os.path.join(str(tmpdir), ".pypirc")
assert get_config(pypirc) == {
"pypi": {
"repository": DEFAULT_REPOSITORY,
"username": None,
"password": None,
},
}
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 get_config(deprecated_pypirc_path) == {
"pypi": {
"repository": 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 = get_userpass_value(cli_value, config, key, strategy)
assert ret == expected
Metadata-Version: 1.1
Name: twine
Version: 1.3.1
Version: 1.5.0
Summary: Collection of utilities for interacting with PyPI
Home-page: https://github.com/dstufft/twine
Home-page: https://github.com/pypa/twine