Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

second take at setuptools_scm #1834

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ include/
*~
.hypothesis/

# autogenerated
_pytest/_version.py
# setuptools
.eggs/

doc/*/_build
Expand Down
26 changes: 11 additions & 15 deletions HOWTORELEASE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,61 @@ How to release pytest

Note: this assumes you have already registered on pypi.

1. Bump version numbers in ``_pytest/__init__.py`` (``setup.py`` reads it).
#. Check and finalize ``CHANGELOG.rst``.

2. Check and finalize ``CHANGELOG.rst``.

3. Write ``doc/en/announce/release-VERSION.txt`` and include
#. Write ``doc/en/announce/release-VERSION.txt`` and include
it in ``doc/en/announce/index.txt``. Run this command to list names of authors involved::

git log $(git describe --abbrev=0 --tags)..HEAD --format='%aN' | sort -u

4. Regenerate the docs examples using tox::
#. Regenerate the docs examples using tox::

tox -e regen

5. At this point, open a PR named ``release-X`` so others can help find regressions or provide suggestions.
#. At this point, open a PR named ``release-X`` so others can help find regressions or provide suggestions.

6. Use devpi for uploading a release tarball to a staging area::
#. Use devpi for uploading a release tarball to a staging area::

devpi use https://devpi.net/USER/dev
devpi upload --formats sdist,bdist_wheel

7. Run from multiple machines::
#. Run from multiple machines::

devpi use https://devpi.net/USER/dev
devpi test pytest==VERSION

Alternatively, you can use `devpi-cloud-tester <https://github.com/nicoddemus/devpi-cloud-tester>`_ to test
the package on AppVeyor and Travis (follow instructions on the ``README``).

8. Check that tests pass for relevant combinations with::
#. Check that tests pass for relevant combinations with::

devpi list pytest

or look at failures with "devpi list -f pytest".

9. Feeling confident? Publish to pypi::
#. Feeling confident? Publish to pypi::

devpi push pytest==VERSION pypi:NAME

where NAME is the name of pypi.python.org as configured in your ``~/.pypirc``
file `for devpi <http://doc.devpi.net/latest/quickstart-releaseprocess.html?highlight=pypirc#devpi-push-releasing-to-an-external-index>`_.

10. Tag the release::
#. Tag the release::

git tag VERSION <hash>
git push origin VERSION

Make sure ``<hash>`` is **exactly** the git hash at the time the package was created.

11. Send release announcement to mailing lists:
#. Send release announcement to mailing lists:

- [email protected]
- [email protected]
- [email protected] (only for minor/major releases)

And announce the release on Twitter, making sure to add the hashtag ``#pytest``.

12. **After the release**
#. **After the release**

a. **patch release (2.8.3)**:

Expand All @@ -81,5 +79,3 @@ Note: this assumes you have already registered on pypi.
9. Push ``master`` and ``features``.

c. **major release (3.0.0)**: same steps as that of a **minor release**


10 changes: 8 additions & 2 deletions _pytest/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
#
__version__ = '3.1.0.dev0'
__all__ = ['__version__']

try:
from ._version import version as __version__
except ImportError:
# broken installation, we don't even try
# unknown only works because we do poor mans version compare
__version__ = 'unknown'
1 change: 0 additions & 1 deletion scripts/check-manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@
else:
print('No .git directory found, skipping checking the manifest file')
sys.exit(0)

4 changes: 4 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ upload-dir = doc/en/build/html
[bdist_wheel]
universal = 1

[check-manifest]
ignore =
_pytest/_version.py

[metadata]
license_file = LICENSE

Expand Down
42 changes: 20 additions & 22 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,27 @@
import os, sys
import os
import sys
import setuptools
import pkg_resources
from setuptools import setup, Command

classifiers = ['Development Status :: 6 - Mature',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: POSIX',
'Operating System :: Microsoft :: Windows',
'Operating System :: MacOS :: MacOS X',
'Topic :: Software Development :: Testing',
'Topic :: Software Development :: Libraries',
'Topic :: Utilities'] + [
('Programming Language :: Python :: %s' % x) for x in
'2 2.6 2.7 3 3.3 3.4 3.5 3.6'.split()]
classifiers = [
'Development Status :: 6 - Mature',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: POSIX',
'Operating System :: Microsoft :: Windows',
'Operating System :: MacOS :: MacOS X',
'Topic :: Software Development :: Testing',
'Topic :: Software Development :: Libraries',
'Topic :: Utilities',
] + [
('Programming Language :: Python :: %s' % x)
for x in '2 2.6 2.7 3 3.3 3.4 3.5 3.6'.split()
]

with open('README.rst') as fd:
long_description = fd.read()

def get_version():
p = os.path.join(os.path.dirname(
os.path.abspath(__file__)), "_pytest", "__init__.py")
with open(p) as f:
for line in f.readlines():
if "__version__" in line:
return line.strip().split("=")[-1].strip(" '")
raise ValueError("could not read version")


def has_environment_marker_support():
"""
Expand Down Expand Up @@ -63,7 +58,9 @@ def main():
name='pytest',
description='pytest: simple powerful testing with Python',
long_description=long_description,
version=get_version(),
use_scm_version={
'write_to': '_pytest/_version.py',
},
url='http://pytest.org',
license='MIT license',
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
Expand All @@ -74,6 +71,7 @@ def main():
keywords="test unittest",
cmdclass={'test': PyTest},
# the following should be enabled for release
setup_requires=['setuptools-scm'],
install_requires=install_requires,
extras_require=extras_require,
packages=['_pytest', '_pytest.assertion', '_pytest._code', '_pytest.vendored_packages'],
Expand Down
5 changes: 4 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ commands=

[testenv:linting]
basepython = python2.7
# needed to keep check-manifest working
setenv =
SETUPTOOLS_SCM_PRETEND_VERSION=2.0.1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it seems this fixes the check-manifest issue. 😁

Can we switch to the write_to option now?

deps =
flake8
# pygments required by rst-lint
Expand All @@ -56,7 +59,7 @@ deps =
commands =
{envpython} scripts/check-manifest.py
flake8 pytest.py _pytest testing
rst-lint CHANGELOG.rst HOWTORELEASE.rst README.rst
rst-lint CHANGELOG.rst HOWTORELEASE.rst README.rst --encoding utf-8

[testenv:py27-xdist]
deps=pytest-xdist>=1.13
Expand Down