Giter VIP home page Giter VIP logo

setuptools_scm's Introduction

setuptools_scm

github ci Documentation Status tidelift

about

setuptools-scm extracts Python package versions from git or hg metadata instead of declaring them as the version argument or in an SCM managed file.

Additionally, setuptools-scm provides setuptools with a list of files that are managed by the SCM
(i.e. it automatically adds all of the SCM-managed files to the sdist).
Unwanted files must be excluded via MANIFEST.in.

pyproject.toml usage

The preferred way to configure setuptools-scm is to author settings in a tool.setuptools_scm section of pyproject.toml.

This feature requires setuptools 61 or later. First, ensure that setuptools-scm is present during the project's build step by specifying it as one of the build requirements.

[build-system]
requires = ["setuptools>=64", "setuptools_scm>=8"]
build-backend = "setuptools.build_meta"

That will be sufficient to require setuptools-scm for projects that support PEP 518 like pip and build.

To enable version inference, you need to set the version dynamically in the project section of pyproject.toml:

[project]
# version = "0.0.1"  # Remove any existing version parameter.
dynamic = ["version"]

[tool.setuptools_scm]

Additionally, a version file can be written by specifying:

[tool.setuptools_scm]
version_file = "pkg/_version.py"

Where pkg is the name of your package.

If you need to confirm which version string is being generated or debug the configuration, you can install setuptools-scm directly in your working environment and run:

$ python -m setuptools_scm
# To explore other options, try:
$ python -m setuptools_scm --help

For further configuration see the documentation.

Interaction with Enterprise Distributions

Some enterprise distributions like RHEL7 ship rather old setuptools versions.

In those cases its typically possible to build by using an sdist against setuptools_scm<2.0. As those old setuptools versions lack sensible types for versions, modern setuptools-scm is unable to support them sensibly.

It's strongly recommended to build a wheel artifact using modern Python and setuptools, then installing the artifact instead of trying to run against old setuptools versions.

Code of Conduct

Everyone interacting in the setuptools-scm project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the PSF Code of Conduct.

Security Contact

To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.

setuptools_scm's People

Contributors

abravalheri avatar anntzer avatar blueyed avatar chrisjbillington avatar con-f-use avatar dependabot[bot] avatar dimitripapadopoulos avatar engnadeau avatar flameeyes avatar flying-sheep avatar henryiii avatar hugovk avatar ikerreyes avatar ionelmc avatar jamesbraza avatar jaraco avatar layday avatar mgorny avatar mindw avatar mr-rodgers avatar paugier avatar pre-commit-ci[bot] avatar puxlit avatar ronnypfannschmidt avatar sbidoul avatar schang412 avatar stephenfin avatar untitaker avatar userzimmermann avatar webknjaz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

setuptools_scm's Issues

allow arbitrary filenames/templates in write_to

superseeds #33

there should be a way to allow the writing of arbitrary files/styles

an idea os to have a write_to_template that acompanies write_to and
just having defaults for the supported extensions

Consider replacing guess_next (boolean) with next_version_scheme (or similar)

The readme describes a guess_next parameter, which is a boolean that defaults to True.

Rather than have a boolean for this parameter (especially one that defaults to True), I recommend a model that's more extensible. Consider the facet that this flag reflects and create textual indicators representing the possible values. For example:

next_version_scheme: If the current (or parent) changeset is not tagged with a version, describes how the version should be calculated. Set to "next-pre" to create a "dev" version of the best guessed next release (default). Set to "post-tag" to create a "post" release of the latest previous release.

This approach has several benefits:

  • The technique has a clear indicator by which to describe it. It describes a more general concept than simply guess_next, but instead describes the concept of next version inference.
  • Additional techniques could be easily added.
  • Transition to an even more extensible form (where users might supply a function for calculating the version) would be straightforward to implement within the same option.

add a comparable version tuple for use in write_to_template

@prologic noted in #36 that having a version tuple for use in write_to might be helpful for a number of scenarios

personally i think just parsing versions with pkg_resources is fine is fine,
however since users declared a desire to have this im putting up this issue,

anyone can implement it, i'm happy to review and merge a reasonable solution

package installed as 0.0.0

Using easy_install to install setuptools_scm, it installs as version 0.0.0:

C:\Users\jaraco\scm> $env:PYTHONPATH='.'
C:\Users\jaraco\scm> easy_install -d . setuptools_scm
Creating c:\users\jaraco\scm\site.py
Searching for setuptools-scm
Reading https://pypi.python.org/simple/setuptools_scm/
C:\Program Files\Python34\lib\site-packages\setuptools-12.2-py3.4.egg\pkg_resources\__init__.py:2512: PEP440Warning: 'setuptools (scm-0.26)' is being parsed as a legacy, non PEP 440, version. You may find odd behavior and sort order. In particular it will be sorted as less than 0.0. It is recommend to migrate to PEP 440 compatible versions.
C:\Program Files\Python34\lib\site-packages\setuptools-12.2-py3.4.egg\pkg_resources\__init__.py:2512: PEP440Warning: 'setuptools (scm-1.0.0)' is being parsed as a legacy, non PEP 440, version. You may find odd behavior and sort order. In particular it will be sorted as less than 0.0. It is recommend to migrate to PEP 440 compatible versions.
C:\Program Files\Python34\lib\site-packages\setuptools-12.2-py3.4.egg\pkg_resources\__init__.py:2512: PEP440Warning: 'setuptools (scm-1.1.0)' is being parsed as a legacy, non PEP 440, version. You may find odd behavior and sort order. In particular it will be sorted as less than 0.0. It is recommend to migrate to PEP 440 compatible versions.
Best match: setuptools-scm 1.1.0
Downloading https://pypi.python.org/packages/source/s/setuptools_scm/setuptools-scm-1.1.0.tar.gz#md5=a4a06bc7c862f63029793085734adcfb
Processing setuptools-scm-1.1.0.tar.gz
Writing C:\Users\jaraco\AppData\Local\Temp\easy_install-xeq_tah8\setuptools-scm-1.1.0\setup.cfg
Running setuptools-scm-1.1.0\setup.py -q bdist_egg --dist-dir C:\Users\jaraco\AppData\Local\Temp\easy_install-xeq_tah8\setuptools-scm-1.1.0\egg-dist-tmp-yzff7icr
C:\Program Files\Python34\lib\distutils\dist.py:260: UserWarning: Unknown distribution option: 'use_scm_version'
  warnings.warn(msg)
zip_safe flag not set; analyzing archive contents...
Copying setuptools_scm-0.0.0-py3.4.egg to c:\users\jaraco\scm
Adding setuptools-scm 0.0.0 to easy-install.pth file

Installed c:\users\jaraco\scm\setuptools_scm-0.0.0-py3.4.egg
Processing dependencies for setuptools-scm
Finished processing dependencies for setuptools-scm
C:\Users\jaraco\scm> python
Python 3.4.2 (v3.4.2:ab2c023a9432, Oct  6 2014, 22:16:31) [MSC v.1600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pkg_resources
>>> pkg_resources.require('setuptools_scm')[0].version
'0.0.0'

It should install as the advertised version.


setup.py develop and console_scripts

When installing a package with python setup.py develop or pip install -e ., setuptools creates a script with the version hardcoded, e.g.

#!/Users/rouge8/.virtualenvs/tmp-902d747a861cbe3/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'pytest==2.7.3.dev402+ng06a70b6','console_scripts','py.test'
__requires__ = 'pytest==2.7.3.dev402+ng06a70b6'
import sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
    sys.exit(
        load_entry_point('pytest==2.7.3.dev402+ng06a70b6', 'console_scripts', 'py.test')()
    )

You can make changes to files and see them reflected in the console script (e.g. add a print statement), but once you commit, setuptools continues running the old version. Any ideas on a workaround other than reinstalling after every commit?

pkg_resources.SetuptoolsVersion does not exist

This commit: https://bitbucket.org/pypa/setuptools_scm/commits/1f5bd7130e640e818132b5583e5328875a81b4d2#Lsetuptools_scm/version.pyT5

pkg_resources does not have an attribute called "SetuptoolsVersion"

This breaks a pip install of this package on a fresh virtualenv for me (python 2.7.6 + pip 1.5.6 and python 3.4.0 + pip 1.5.6)


'write_to' configuration parameter does not work

I'm using setuptools 18.0.1 with the following setup script:

setup(
    ...
    setup_requires=['setuptools_scm'],
    use_scm_version={'write_to': 'package/VERSION'},
    ...
)

Running the script like this just uses the default version that I gave to the setup script. However, if I change the parameter to use_scm_version=True, then it all works fine. The README says that I should be able to use the mapping as shown above, so this looks like a bug.

Use a smarter way to detect git repositories

Currently, hgdistver looks for .git to determine if cwdir is a git repository. Instead, running a git command such as git status should be used to determine if the current repo is a git directory. If the command fails w/ a status error, then we have an invalid repo otherwise, we're in a git repo.


Release 1.5.5

1.5.3/4 are broken on Python 2.7 and Windows.

The previous issue tracking this was deleted.

Setuptools dependency is too strict

The dependency on setuptools >= 12 is rather strict. There are lots of environments still on older versions of setuptools. This strict requirement makes setuptools_scm a poor replacement for hgtools.

I'd like to see a new version that supports setuptools >= 0.6.


root configuration parameter and PKG-INFO

I have a git repository which contains several sub-directories, each with its own setup.py. To get setuptools_scm to work, I thus pass root: '..'. However, when I try to pip install the result of a setup.py sdist, it doesn't find the version. The reason (I am pretty sure) is that it tries to look for PKG-INFO also in .. and doesn't find it.

Is there any way to do this while still keeping the given structure of the repository? If not, maybe it makes sense to disregard root when searching for PKG-INFO?

Lack of documentation

This project is something I am looking for, but I am missing some documentation and/or place to discuss things. Personally, I would like to help with the development and/or documentation, so I share things that I have learned about the problem setuptools_scm is trying to address:

Connecting SCM with versioning stuff is difficult. There are two major use cases when you want the package to know its version:

  • The moment when you release (release-time) the package and
  • the moment when an unsuspecting user installs it without any knowledge of SCM at all.

During the release-time, thigs are easy. It is not that difficult to guess the descriptive version string of the package from the SCM. This is mainly because the developer has all tools he needs and the source code is tagged.

However, when one releases the package, users that are going to install it don't have the advanced tools and the package should be well-aware of which version it is (a good practice is that package foo has foo.__version__ attribute that is the semver version string). So, the version has to be somehow injected to the package and the package has to be able to pick it up.

Some quick examples:

  • numpy writes the version they infer from git to numpy/version.py at release-time. However, they keep the version number in setup.py along some boilerplate code.
  • setuptools maintain a setuptools/version.py containing a version string in SCM
  • matplotlib maintains version string in lib/matplotlib/__init__.py and has relatively convoluted code that extracts it.

Generally, there are two ways of how to solve this:

  1. Store the version string somewhere and introspect it from setup.py using more or less convoluted code you have to write yourself.

  2. Generate the version string during release-time and inject it somehow to the package in a smart way.
    The cons of this approach is that it is an unusual approach and one can forget to perform the injection step. Having it as a hook of setup.py [sb]dist would be so much cleaner.

    Also, there would be the ordering problem - first you tag, then you release and the release gets modified ex-post when it gets the right version string. So the package should be tagged afterwards or the part with the version string should not be revision-controled.

Now, let's get to setuptools_scm.
AFAIK, users will be obliged to get it when they get in touch with package that requires it, which I regard as sub-optimal, but if parts of it get integrated into setuptools, it would dissolve this weakness.
On the other hand, it seems to me that it is introspecting PKG-INFO, which I think is the right way to go. In my opinion, generating PKG-INFO is essentially the injection step and people in charge of their package's setup.py just have to have good possibilities of getting it out of the file.

So what would I like to see in this package:

  • Better documentation. Everybody needs under-the-hood documentation because of inevitable leakage of abstractions. A tutorial is also a must.
  • Integration of PKG-INFO parsing to setuptools, a pattern of using setuptools_scm in a way that end-users don't have to worry about having it installed.

Running tests raises TypeError exceptions about LocalPath

With Python 2, I get errors like this:
TypeError: coercing to Unicode: need string or buffer, LocalPath found

With Python 3, those become:
TypeError: Can't convert 'LocalPath' object to str implicitly

This is just by calling pytest from the source toplevel directory.

get_version returns None when not in the root of the repository

I have projects that use hgtools to load the version when building Sphinx docs. Sphinx expects the docs to be built with docs/ as the current directory. Therefore, when using setuptools_scm with a conf file like this one is executed, it always returns None for the version.

I suggest that setuptools_scm should operate even if the cwd is not in the root of the repository. Hgtools did this by setting the cwd to the repository root when invoking the commands.


Clarify support for X.X versions

The readme states:

This requires always using all components in tags (i.e. 2.0.0 instead of 2.0) to avoid counting up at the wrong level and inadvertedly releasing a higher version (i.e. 2.1.devX instead of 2.0.1.devX)

I believe this statement betrays a very strict restriction on version numbers, which in my opinion is too strict for a tool meant to be generally used. A great many packages use the semver deviant model of advertising only the X.X form prior to patch releases.

Perhaps setuptools_scm handles this latter model with the caveat that it will always only increment the last advertised number, as given in the example. If that's the case, that's probably an acceptable limitation.

If on the other hand, the situation is that using this feature is disallowed unless the version number has three components, I see that as an unacceptable constraint.

You may want to consider allowing the next version inference to be specified. Hgtools allowed this via its 'versioning' module.


Migrate issues from bitbucket to github

The PyPA desires to host setuptools_scm at Github instead of Bitbucket, but in doing so, the issue tracker in Bitbucket was disabled, making references to to the tickets impossible. I proposed we migrate the issues, keeping the issue numbers the same and continuing the issue tracking in Github from the last Bitbucket issue number.

pip install fails

"pip install setuptools_scm" fails with this error:

#!bash

Downloading/unpacking setuptools-scm
  Downloading setuptools-scm-1.1.0.tar.gz
  Running setup.py egg_info for package setuptools-scm
    Traceback (most recent call last):
      File "<string>", line 14, in <module>
      File "/home/vagrant/build/setuptools-scm/setup.py", line 86, in <module>
        setuptools.setup(**arguments)
      File "/usr/lib/python2.7/distutils/core.py", line 112, in setup
        _setup_distribution = dist = klass(attrs)
      File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 225, in __init__
        _Distribution.__init__(self,attrs)
      File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__
        self.finalize_options()
      File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 258, in finalize_options
        ep.load()(self, ep.name, value)
      File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1989, in load
        entry = __import__(self.module_name, globals(),globals(), ['__name__'])
      File "setuptools_scm/__init__.py", line 10, in <module>
        from .version import format_version
      File "setuptools_scm/version.py", line 5, in <module>
        from pkg_resources import parse_version, SetuptoolsVersion, iter_entry_points
    ImportError: cannot import name SetuptoolsVersion
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 14, in <module>

  File "/home/vagrant/build/setuptools-scm/setup.py", line 86, in <module>

    setuptools.setup(**arguments)

  File "/usr/lib/python2.7/distutils/core.py", line 112, in setup

    _setup_distribution = dist = klass(attrs)

  File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 225, in __init__

    _Distribution.__init__(self,attrs)

  File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__

    self.finalize_options()

  File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 258, in finalize_options

    ep.load()(self, ep.name, value)

  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1989, in load

    entry = __import__(self.module_name, globals(),globals(), ['__name__'])

  File "setuptools_scm/__init__.py", line 10, in <module>

    from .version import format_version

  File "setuptools_scm/version.py", line 5, in <module>

    from pkg_resources import parse_version, SetuptoolsVersion, iter_entry_points

ImportError: cannot import name SetuptoolsVersion

----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /home/vagrant/.pip/pip.log

Shipping mercurial remnants

I notice that the tarballs contain .hgignore .hgtags, which is strange since the project is now on git : perhaps those file can be removed from the repository?

Allow installation without history or metadata

Eg, allow this to just work (with pip install):

Collecting https://github.com/pytest-dev/pytest/archive/master.zip

  Downloading https://github.com/pytest-dev/pytest/archive/master.zip (654kB)

    Complete output from command python setup.py egg_info:



    Installed /tmp/pip-hFmzwC-build/.eggs/setuptools_scm-1.7.0-py2.7.egg

    Traceback (most recent call last):

      File "<string>", line 20, in <module>

      File "/tmp/pip-hFmzwC-build/setup.py", line 123, in <module>

        main()

      File "/tmp/pip-hFmzwC-build/setup.py", line 81, in main

        zip_safe=False,

      File "/opt/python/2.7.9/lib/python2.7/distutils/core.py", line 111, in setup

        _setup_distribution = dist = klass(attrs)

      File "/home/travis/build/pytest-dev/pytest-cov/.tox/2.7-28-37/lib/python2.7/site-packages/setuptools/dist.py", line 272, in __init__

        _Distribution.__init__(self,attrs)

      File "/opt/python/2.7.9/lib/python2.7/distutils/dist.py", line 287, in __init__

        self.finalize_options()

      File "/home/travis/build/pytest-dev/pytest-cov/.tox/2.7-28-37/lib/python2.7/site-packages/setuptools/dist.py", line 327, in finalize_options

        ep.load()(self, ep.name, value)

      File "build/bdist.linux-x86_64/egg/setuptools_scm/integration.py", line 17, in version_keyword

      File "build/bdist.linux-x86_64/egg/setuptools_scm/__init__.py", line 65, in get_version

      File "build/bdist.linux-x86_64/egg/setuptools_scm/__init__.py", line 34, in version_from_scm

    LookupError: setuptools-scm was unable to detect version for '/tmp/pip-hFmzwC-build'.



    Make sure you're not using GitHub's tarballs (or similar ones), as those don't contain the necessary metadata. Use PyPI's tarballs instead.

In this situation I don't think anyone cares about what the version is.

WindowsError: [Error 2] - on file finder

Windows 7, Python 2.7.8

To reproduce:

git clone https://github.com/peritus/bumpversion bumpversion
cd bumpversion
python.exe setup.py sdist
C:\Users\<user>\Documents\scripts\python\_other\bumpversion_clean2>python.exe setup.py sdist
C:\Python27\ArcGIS10.2\lib\site-packages\setuptools\dist.py:282: UserWarning: Normalizing '0.5.4-dev' to '0.5.4.dev0'
  normalized_version,
options (after parsing config files):
options (after parsing command line):
option dict for 'aliases' command:
  {}
option dict for 'sdist' command:
  {}
option dict for 'wheel' command:
  {'universal': ('setup.cfg', '1')}
running sdist
Distribution.get_command_obj(): creating 'sdist' command object
running egg_info
Distribution.get_command_obj(): creating 'egg_info' command object
writing bumpversion.egg-info\PKG-INFO
writing top-level names to bumpversion.egg-info\top_level.txt
writing dependency_links to bumpversion.egg-info\dependency_links.txt
writing entry points to bumpversion.egg-info\entry_points.txt
Distribution.get_command_obj(): creating 'build_py' command object
Distribution.get_command_obj(): creating 'build' command object
error: [Error 2]
Traceback (most recent call last):
  File "setup.py", line 39, in <module>
    'Programming Language :: Python :: Implementation :: PyPy',
  File "C:\Python27\ArcGIS10.2\lib\distutils\core.py", line 151, in setup
    dist.run_commands()
  File "C:\Python27\ArcGIS10.2\lib\distutils\dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "C:\Python27\ArcGIS10.2\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "C:\Python27\ArcGIS10.2\lib\site-packages\setuptools\command\sdist.py", line 40, in run
    self.run_command('egg_info')
  File "C:\Python27\ArcGIS10.2\lib\distutils\cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "C:\Python27\ArcGIS10.2\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "C:\Python27\ArcGIS10.2\lib\site-packages\setuptools\command\egg_info.py", line 180, in run
    self.find_sources()
  File "C:\Python27\ArcGIS10.2\lib\site-packages\setuptools\command\egg_info.py", line 207, in find_sources
    mm.run()
  File "C:\Python27\ArcGIS10.2\lib\site-packages\setuptools\command\egg_info.py", line 291, in run
    self.add_defaults()
  File "C:\Python27\ArcGIS10.2\lib\site-packages\setuptools\command\egg_info.py", line 323, in add_defaults
    rcfiles = list(walk_revctrl())
  File "C:\Python27\ArcGIS10.2\lib\site-packages\setuptools\command\sdist.py", line 19, in walk_revctrl
    for item in ep.load()(dirname):
  File "C:\Python27\ArcGIS10.2\lib\site-packages\setuptools_scm\__init__.py", line 77, in find_files
    return do(ep.load(), path).splitlines()
  File "C:\Python27\ArcGIS10.2\lib\site-packages\setuptools_scm\utils.py", line 48, in do
    out, err, ret = do_ex(cmd, cwd)
  File "C:\Python27\ArcGIS10.2\lib\site-packages\setuptools_scm\utils.py", line 33, in do_ex
    HGPLAIN='1',
  File "C:\Python27\ArcGIS10.2\lib\subprocess.py", line 710, in __init__
    errread, errwrite)
  File "C:\Python27\ArcGIS10.2\lib\subprocess.py", line 958, in _execute_child
    startupinfo)
WindowsError: [Error 2]

Contents of setup.py

import re
from setuptools import setup

description = 'Version-bump your software with a single command!'

long_description = re.sub(
  "\`(.*)\<#.*\>\`\_",
  r"\1",
  str(open('README.rst', 'rb').read()).replace(description, '')
)

setup(
    name='bumpversion',
    version='0.5.4-dev',
    url='https://github.com/peritus/bumpversion',
    author='Filip Noetzel',
    author_email='[email protected]',
    license='MIT',
    packages=['bumpversion'],
    description=description,
    long_description=long_description,
    entry_points={
        'console_scripts': [
            'bumpversion = bumpversion:main',
        ]
    },
    classifiers=(
        'Development Status :: 4 - Beta',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: MIT License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.2',
        'Programming Language :: Python :: 3.3',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: Implementation :: PyPy',
    ),
)

Error 2 means "file not found"
https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382%28v=vs.85%29.aspx

But which file? There is no information.

When i delete setuptools_scm pip uninstall setuptools_scm - all is ok, no more error.


Test failures

==================================== ERRORS ====================================
__________________________ ERROR at setup of test_do ___________________________

@pytest.mark.parametrize('cmd', ['ls', 'dir'])
def test_do(cmd, tmpdir):
    LookupError: no factory found for function argument 'cmd'
    available funcargs: pytestconfig, capsys, capfd, tmpdir, monkeypatch, recwarn, case, data, expected
    use 'py.test --funcargs [testpath]' for help on them.

/var/tmp/portage/dev-python/hgdistver-0.16/work/hgdistver-0.16/test_hgdistver.py:22
__________________ ERROR at setup of test_archival_to_version __________________

request = <FuncargRequest for <Function 'test_archival_to_version'>>

def pytest_funcarg__expected(request): return request.param
E AttributeError: FuncargRequest instance has no attribute 'param'

test_hgdistver.py:59: AttributeError
__________________ ERROR at setup of test_version_from_hg_id ___________________

@py.test.mark.parametrize('method', ['version_from_hg15_parents', 'version_from_hg_log_with_tags'])
def test_version_from_hg_id(tmpdir, method):
    LookupError: no factory found for function argument 'method'
    available funcargs: pytestconfig, capsys, capfd, tmpdir, monkeypatch, recwarn, case, data, expected
    use 'py.test --funcargs [testpath]' for help on them.

/var/tmp/portage/dev-python/hgdistver-0.16/work/hgdistver-0.16/test_hgdistver.py:95
=================================== FAILURES ===================================
____________________________ test_version_from_git _____________________________

tmpdir = local('/var/tmp/portage/dev-python/hgdistver-0.16/temp/pytest-0/test_version_from_git0')

def test_version_from_git(tmpdir):
    cwd = str(tmpdir)
    do('git init', cwd)
    initial = get_version(cwd)
    assert initial == '0.0'
    tmpdir.join('test.txt').write('test')
    do('git add test.txt', cwd)
    do('git commit -m commit', cwd)
    after_first_commit = get_version(cwd)
  assert after_first_commit.startswith('0.0.post1-')

E assert False
E + where False = <built-in method startswith of str object at 0x17ff2d8>('0.0.post1-')
E + where <built-in method startswith of str object at 0x17ff2d8> = '0.0'.startswith

test_hgdistver.py:77: AssertionError
------------------------------- Captured stdout --------------------------------
cmd 'git init'
out 'Initialized empty Git repository in /var/tmp/portage/dev-python/hgdistver-0.16/temp/pytest-0/test_version_from_git0/.git/\n'
cmd 'git rev-parse --verify --quiet HEAD'
ret 1
cmd 'git add test.txt'
cmd 'git commit -m commit'
err '\n*** Please tell me who you are.\n\nRun\n\n git config --global user.email "[email protected]"\n git config --global user.name "Your Name"\n\nto set your account's default identity.\nOmit --global to set the identity only in this repository.\n\nfatal: empty ident <djc@miles.(none)> not allowed\n'
ret 128
*** Please tell me who you are.

Run

git config --global user.email "[email protected]"
git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: empty ident <djc@miles.(none)> not allowed
cmd 'git rev-parse --verify --quiet HEAD'
ret 1
================= 1 failed, 8 passed, 3 error in 0.20 seconds ==================


UnicodeDecodeError

I have a python project. Trying to execute
py2 setup.py bdist_wheel

<skipping lines...>
  File "setup.py", line 20, in <module>
    description='my script'
  File "C:\Python27\ArcGIS10.2\lib\distutils\core.py", line 151, in setup
    dist.run_commands()
  File "C:\Python27\ArcGIS10.2\lib\distutils\dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "C:\Python27\ArcGIS10.2\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "C:\Python27\ArcGIS10.2\lib\site-packages\wheel\bdist_wheel.py", line 211, in run
    self.run_command('install')
  File "C:\Python27\ArcGIS10.2\lib\distutils\cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "C:\Python27\ArcGIS10.2\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "C:\Python27\ArcGIS10.2\lib\site-packages\setuptools\command\install.py", line 61, in run
    return orig.install.run(self)
  File "C:\Python27\ArcGIS10.2\lib\distutils\command\install.py", line 575, in run
    self.run_command(cmd_name)
  File "C:\Python27\ArcGIS10.2\lib\distutils\cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "C:\Python27\ArcGIS10.2\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "C:\Python27\ArcGIS10.2\lib\site-packages\setuptools\command\install_egg_info.py", line 33, in run
    self.run_command('egg_info')
  File "C:\Python27\ArcGIS10.2\lib\distutils\cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "C:\Python27\ArcGIS10.2\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "C:\Python27\ArcGIS10.2\lib\site-packages\setuptools\command\egg_info.py", line 180, in run
    self.find_sources()
  File "C:\Python27\ArcGIS10.2\lib\site-packages\setuptools\command\egg_info.py", line 207, in find_sources
    mm.run()
  File "C:\Python27\ArcGIS10.2\lib\site-packages\setuptools\command\egg_info.py", line 291, in run
    self.add_defaults()
  File "C:\Python27\ArcGIS10.2\lib\site-packages\setuptools\command\egg_info.py", line 323, in add_defaults
    rcfiles = list(walk_revctrl())
  File "C:\Python27\ArcGIS10.2\lib\site-packages\setuptools\command\sdist.py", line 19, in walk_revctrl
    for item in ep.load()(dirname):
  File "C:\Python27\ArcGIS10.2\lib\site-packages\setuptools_scm\__init__.py", line 77, in find_files
    return do(ep.load(), path).splitlines()
  File "C:\Python27\ArcGIS10.2\lib\site-packages\setuptools_scm\utils.py", line 48, in do
    out, err, ret = do_ex(cmd, cwd)
  File "C:\Python27\ArcGIS10.2\lib\site-packages\setuptools_scm\utils.py", line 44, in do_ex
    return out.strip().decode(), err.strip().decode(), p.returncode
UnicodeDecodeError: 'ascii' codec can't decode byte 0xf1 in position 17: ordinal not in range(128)

Windows 7, python 2.7


provide reliable root discovery using a relative_to argument

get_version(root=some_relative_path) can be unreliable when the python file is executed in unexpected contexts

in order to provide reliable root finding relative to the executing file there should be a relative_to argument that should be the current file

then root must be relative to the directory containing the current file

this would also help to solve #44 in a proper manner

Unable to detect version when running pytest-runner's tests

Hi,

I am running pytest-runner's tests with "py.test" in its hg repo root folder, and getting the following error:

______________________________________________________________ ERROR collecting docs/conf.py _______________________________________________________________
docs/conf.py:15: in <module>
    version = setuptools_scm.get_version(root='..')
/usr/lib/python3.4/site-packages/setuptools_scm/__init__.py:65: in get_version
    version = version_from_scm(root)
/usr/lib/python3.4/site-packages/setuptools_scm/__init__.py:34: in version_from_scm
    "instead." % root)
E   LookupError: setuptools-scm was unable to detect version for '/tmp'.
E
E   Make sure you're not using GitHub's tarballs (or similar ones), as those don't contain the necessary metadata. Use PyPI's tarballs instead.
================================================================= 1 error in 0.12 seconds ==================================================================

I have tried to downgrade setuptools_scm and found that it worked till 1.5.5. The repo is located at https://bitbucket.org/pytest-dev/pytest-runner

There was no error running setup.py build, etc, though.

Any hints?

get_version_from_hg betrays git support

When hgtools added git support, it changed the use_hg_version directive to also support use_vcs_version. According to the docs for hgdistver, the directive is get_version_from_hg. It should support a more generic directive. I haven't looked at the code. It may be the case that a doc fix is all that's needed.


Please add a tag for 1.7.0

Looks like there is a 1.6.0 version on PyPI, but not in the repository. It would be great if 1.6.0 would be tagged here as well, thanks!

UnicodeDecodeError parsing PKG-INFO

On Python 3.4.2 in some environments (maybe when LANG=C), setuptools_scm raises a UnicodeDecodeError when it encounters non-ascii in the PKG-INFO file:

wget https://pypi.python.org/packages/source/i/irc/irc-12.2.tar.gz#md5=efbb4d9a6bb92b24ab6109e04716ef38 -O - | tar xz
cd irc-12.2
python
>>> import setuptools_scm       
>>> setuptools_scm.get_version()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/app/env/lib/python3.4/site-packages/setuptools_scm-1.5.2-py3.4.egg/setuptools_scm/__init__.py", line 43, in get_version
  File "/app/env/lib/python3.4/site-packages/setuptools_scm-1.5.2-py3.4.egg/setuptools_scm/__init__.py", line 21, in version_from_scm
  File "/app/env/lib/python3.4/site-packages/setuptools_scm-1.5.2-py3.4.egg/setuptools_scm/hacks.py", line 8, in parse_pkginfo
  File "/app/env/lib/python3.4/site-packages/setuptools_scm-1.5.2-py3.4.egg/setuptools_scm/utils.py", line 64, in data_from_mime
  File "/usr/lib/python3.4/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 8768: ordinal not in range(128)

This causes the version inference to fail and all versions of the irc package to install as 0.0.0.


Warning "setuptools_scm functionality is degraded" over stdout

The warning "setuptools_scm functionality is degraded" in setuptools_scm/setuptools_scm/version.py is printed to stdout, I rather think that it should rather be written to stderr, so that shell scripts will not break due to unexpected content in stdout.

Would warnings.warn(....) be suitable?

Failing tests in 1.7.0

On OpenBSD, I notice that the tests all fail unless the package has been installed (for some reason test suite looks for setuptools-scm instead of setuptools_scm):

============================= test session starts ==============================
platform openbsd5 -- Python 2.7.10 -- py-1.4.23 -- pytest-2.6.1
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/usr/local/lib/python2.7/site-packages/_pytest/main.py", line 82, in wrap_session
INTERNALERROR>     config.hook.pytest_sessionstart(session=session)
INTERNALERROR>   File "/usr/local/lib/python2.7/site-packages/_pytest/core.py", line 413, in __call__
INTERNALERROR>     return self._docall(methods, kwargs)
INTERNALERROR>   File "/usr/local/lib/python2.7/site-packages/_pytest/core.py", line 424, in _docall
INTERNALERROR>     res = mc.execute()
INTERNALERROR>   File "/usr/local/lib/python2.7/site-packages/_pytest/core.py", line 315, in execute
INTERNALERROR>     res = method(**kwargs)
INTERNALERROR>   File "/usr/local/lib/python2.7/site-packages/_pytest/terminal.py", line 285, in pytest_sessionstart
INTERNALERROR>     config=self.config, startdir=self.startdir)
INTERNALERROR>   File "/usr/local/lib/python2.7/site-packages/_pytest/core.py", line 413, in __call__
INTERNALERROR>     return self._docall(methods, kwargs)
INTERNALERROR>   File "/usr/local/lib/python2.7/site-packages/_pytest/core.py", line 424, in _docall
INTERNALERROR>     res = mc.execute()
INTERNALERROR>   File "/usr/local/lib/python2.7/site-packages/_pytest/core.py", line 315, in execute
INTERNALERROR>     res = method(**kwargs)
INTERNALERROR>   File "/usr/ports/pobj/py-setuptools_scm-1.7.0/setuptools_scm-1.7.0/testing/conftest.py", line 10, in pytest_report_header
INTERNALERROR>     version = pkg_resources.get_distribution(pkg).version
INTERNALERROR>   File "/usr/local/lib/python2.7/site-packages/pkg_resources.py", line 344, in get_distribution
INTERNALERROR>     if isinstance(dist,Requirement): dist = get_provider(dist)
INTERNALERROR>   File "/usr/local/lib/python2.7/site-packages/pkg_resources.py", line 223, in get_provider
INTERNALERROR>     return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
INTERNALERROR>   File "/usr/local/lib/python2.7/site-packages/pkg_resources.py", line 725, in require
INTERNALERROR>     needed = self.resolve(parse_requirements(requirements))
INTERNALERROR>   File "/usr/local/lib/python2.7/site-packages/pkg_resources.py", line 628, in resolve
INTERNALERROR>     raise DistributionNotFound(req)
INTERNALERROR> DistributionNotFound: setuptools-scm

Once installed, the tests at least run, but I get the following errors:

============================= test session starts ==============================
platform openbsd5 -- Python 2.7.10 -- py-1.4.23 -- pytest-2.6.1
setuptools version 3.4.4
setuptools_scm version 1.7.0
collected 31 items

testing/test_basic_api.py .s....FFFF.......
testing/test_functions.py FFF...........

=================================== FAILURES ===================================
____________________ test_archival_to_version[1.2.2-data3] _____________________

expected = '1.2.2', data = {'tag': 'release-1.2.2'}

    @pytest.mark.parametrize('expected,data', sorted(archival_mapping.items()))
    def test_archival_to_version(expected, data):
        version = archival_to_version(data)
>       assert format_version(
            version,
            version_scheme='guess-next-dev',
            local_scheme='node-and-date') == expected
E       assert 'release-1.2.2' == '1.2.2'
E         - release-1.2.2
E         + 1.2.2

testing/test_basic_api.py:87: AssertionError
----------------------------- Captured stdout call -----------------------------
data {'tag': 'release-1.2.2'}
version release-1.2.2
scm version <ScmVersion release-1.2.2 d=None n=None d=False x={}>
config {'version_scheme': 'guess-next-dev', 'local_scheme': 'node-and-date'}
ep ('setuptools_scm.version_scheme', 'guess-next-dev')
ep ('setuptools_scm.local_scheme', 'node-and-date')
version release-1.2.2
local_version 
__________________ test_archival_to_version[1.2.2.dev0-data4] __________________

expected = '1.2.2.dev0', data = {'tag': 'release-1.2.2.dev'}

    @pytest.mark.parametrize('expected,data', sorted(archival_mapping.items()))
    def test_archival_to_version(expected, data):
        version = archival_to_version(data)
>       assert format_version(
            version,
            version_scheme='guess-next-dev',
            local_scheme='node-and-date') == expected
E       assert 'release-1.2.2.dev' == '1.2.2.dev0'
E         - release-1.2.2.dev
E         + 1.2.2.dev0

testing/test_basic_api.py:87: AssertionError
----------------------------- Captured stdout call -----------------------------
data {'tag': 'release-1.2.2.dev'}
version release-1.2.2.dev
scm version <ScmVersion release-1.2.2.dev d=None n=None d=False x={}>
config {'version_scheme': 'guess-next-dev', 'local_scheme': 'node-and-date'}
ep ('setuptools_scm.version_scheme', 'guess-next-dev')
ep ('setuptools_scm.local_scheme', 'node-and-date')
version release-1.2.2.dev
local_version 
____________________________ test_version_from_git _____________________________

wd = <test_basic_api.Wd object at 0x17ba4185c790>

    def test_version_from_git(wd):
        wd('git init')
        wd('git config user.email [email protected]')
        wd('git config user.name "a test"')
        assert wd.version == '0.0'
        wd.write('test.txt', 'test')
        wd('git add test.txt')
        wd('git commit -m commit')

        assert wd.version.startswith('0.1.dev1+')
        assert not wd.version.endswith('1-')

        wd('git tag v0.1')
>       assert wd.version == '0.1'
E       assert 'v0.1' == '0.1'
E         - v0.1
E         ? -
E         + 0.1

testing/test_basic_api.py:106: AssertionError
----------------------------- Captured stdout call -----------------------------
cmd 'git init'
out 'Initialized empty Git repository in /tmp/pytest-12/test_version_from_git0/.git/\n'
cmd 'git config user.email [email protected]'
cmd 'git config user.name "a test"'
root '/tmp/pytest-12/test_version_from_git0'
looking for ep setuptools_scm.parse_scm /tmp/pytest-12/test_version_from_git0
found ep .git = setuptools_scm.git:parse
cmd 'git rev-parse --verify --quiet HEAD'
ret 1
version 0.0
scm version <ScmVersion 0.0 d=None n=None d=False x={}>
config {'version_scheme': 'guess-next-dev', 'local_scheme': 'node-and-date'}
ep ('setuptools_scm.version_scheme', 'guess-next-dev')
ep ('setuptools_scm.local_scheme', 'node-and-date')
version 0.0
local_version 
0.0
cmd 'git add test.txt'
cmd 'git commit -m commit'
out '[master (root-commit) 9cdd030] commit\n 1 file changed, 1 insertion(+)\n create mode 100644 test.txt\n'
root '/tmp/pytest-12/test_version_from_git0'
looking for ep setuptools_scm.parse_scm /tmp/pytest-12/test_version_from_git0
found ep .git = setuptools_scm.git:parse
cmd 'git rev-parse --verify --quiet HEAD'
out '9cdd0300c04b4e5362616343bcdea9128a39e1b8\n'
cmd 'git describe --dirty --tags --long'
err 'fatal: No names found, cannot describe anything.\n'
ret 128
cmd 'git rev-list HEAD'
out '9cdd0300c04b4e5362616343bcdea9128a39e1b8\n'
version 0.0
scm version <ScmVersion 0.0 d=1 n=9cdd030 d=False x={}>
config {'version_scheme': 'guess-next-dev', 'local_scheme': 'node-and-date'}
ep ('setuptools_scm.version_scheme', 'guess-next-dev')
ep ('setuptools_scm.local_scheme', 'node-and-date')
version 0.1.dev1
local_version +n9cdd030
0.1.dev1+n9cdd030
root '/tmp/pytest-12/test_version_from_git0'
looking for ep setuptools_scm.parse_scm /tmp/pytest-12/test_version_from_git0
found ep .git = setuptools_scm.git:parse
cmd 'git rev-parse --verify --quiet HEAD'
out '9cdd0300c04b4e5362616343bcdea9128a39e1b8\n'
cmd 'git describe --dirty --tags --long'
err 'fatal: No names found, cannot describe anything.\n'
ret 128
cmd 'git rev-list HEAD'
out '9cdd0300c04b4e5362616343bcdea9128a39e1b8\n'
version 0.0
scm version <ScmVersion 0.0 d=1 n=9cdd030 d=False x={}>
config {'version_scheme': 'guess-next-dev', 'local_scheme': 'node-and-date'}
ep ('setuptools_scm.version_scheme', 'guess-next-dev')
ep ('setuptools_scm.local_scheme', 'node-and-date')
version 0.1.dev1
local_version +n9cdd030
0.1.dev1+n9cdd030
cmd 'git tag v0.1'
root '/tmp/pytest-12/test_version_from_git0'
looking for ep setuptools_scm.parse_scm /tmp/pytest-12/test_version_from_git0
found ep .git = setuptools_scm.git:parse
cmd 'git rev-parse --verify --quiet HEAD'
out '9cdd0300c04b4e5362616343bcdea9128a39e1b8\n'
cmd 'git describe --dirty --tags --long'
out 'v0.1-0-g9cdd030\n'
version v0.1
scm version <ScmVersion v0.1 d=None n=g9cdd030 d=False x={}>
config {'version_scheme': 'guess-next-dev', 'local_scheme': 'node-and-date'}
ep ('setuptools_scm.version_scheme', 'guess-next-dev')
ep ('setuptools_scm.local_scheme', 'node-and-date')
version v0.1
local_version 
v0.1
___________________________ test_version_from_hg_id ____________________________

wd = <test_basic_api.Wd object at 0x17b986f40250>

    def test_version_from_hg_id(wd):
        wd('hg init')
        assert wd.version == '0.0'
        wd.write('test.txt', 'test')
        wd('hg add test.txt')
        wd('hg commit -m commit -u test -d "0 0"')

        assert wd.version.startswith('0.1.dev2+')

        # tagging commit is considered the tag
        wd('hg tag v0.1 -u test -d "0 0"')
>       assert wd.version == '0.1'
E       assert 'v0.1' == '0.1'
E         - v0.1
E         ? -
E         + 0.1

testing/test_basic_api.py:129: AssertionError
----------------------------- Captured stdout call -----------------------------
cmd 'hg init'
root '/tmp/pytest-12/test_version_from_hg_id0'
looking for ep setuptools_scm.parse_scm /tmp/pytest-12/test_version_from_hg_id0
found ep .hg = setuptools_scm.hg:parse
cmd 'hg id -i -t'
out '000000000000 tip\n'
tag tip
initial node /tmp/pytest-12/test_version_from_hg_id0
version 0.0
scm version <ScmVersion 0.0 d=None n=None d=False x={}>
config {'version_scheme': 'guess-next-dev', 'local_scheme': 'node-and-date'}
ep ('setuptools_scm.version_scheme', 'guess-next-dev')
ep ('setuptools_scm.local_scheme', 'node-and-date')
version 0.0
local_version 
0.0
cmd 'hg add test.txt'
cmd 'hg commit -m commit -u test -d "0 0"'
root '/tmp/pytest-12/test_version_from_hg_id0'
looking for ep setuptools_scm.parse_scm /tmp/pytest-12/test_version_from_hg_id0
found ep .hg = setuptools_scm.hg:parse
cmd 'hg id -i -t'
out '653ed0c70e50 tip\n'
tag tip
cmd 'hg parents --template "{latesttag} {latesttagdistance}"'
out 'null 1'
cmd 'hg st --no-status --change 653ed0c70e50'
out 'test.txt\n'
normalize {'node': '653ed0c70e50', 'dist': 2, 'st': 'test.txt', 'tag': '0.0', 'dirty': False, 'root': '/tmp/pytest-12/test_version_from_hg_id0'}
version 0.0
scm version <ScmVersion 0.0 d=2 n=653ed0c70e50 d=False x={}>
config {'version_scheme': 'guess-next-dev', 'local_scheme': 'node-and-date'}
ep ('setuptools_scm.version_scheme', 'guess-next-dev')
ep ('setuptools_scm.local_scheme', 'node-and-date')
version 0.1.dev2
local_version +n653ed0c70e50
0.1.dev2+n653ed0c70e50
cmd 'hg tag v0.1 -u test -d "0 0"'
root '/tmp/pytest-12/test_version_from_hg_id0'
looking for ep setuptools_scm.parse_scm /tmp/pytest-12/test_version_from_hg_id0
found ep .hg = setuptools_scm.hg:parse
cmd 'hg id -i -t'
out '4e01d61641d6 tip\n'
tag tip
cmd 'hg parents --template "{latesttag} {latesttagdistance}"'
out 'v0.1 1'
cmd 'hg st --no-status --change 4e01d61641d6'
out '.hgtags\n'
normalize {'node': '4e01d61641d6', 'dist': '1', 'st': '.hgtags', 'tag': 'v0.1', 'dirty': False, 'root': '/tmp/pytest-12/test_version_from_hg_id0'}
version v0.1
scm version <ScmVersion v0.1 d=None n=None d=False x={}>
config {'version_scheme': 'guess-next-dev', 'local_scheme': 'node-and-date'}
ep ('setuptools_scm.version_scheme', 'guess-next-dev')
ep ('setuptools_scm.local_scheme', 'node-and-date')
version v0.1
local_version 
v0.1
_________________________ test_next_tag[1.1-1.2.dev0] __________________________

tag = '1.1', expected = '1.2.dev0'

    @pytest.mark.parametrize('tag, expected', [
        ('1.1', '1.2.dev0'),
        ('1.2.dev', '1.2.dev0'),
        ('1.1a2', '1.1a3.dev0'),
        ])
    def test_next_tag(tag, expected):
        version = pkg_resources.parse_version(tag)
>       assert guess_next_version(version, 0) == expected

testing/test_functions.py:19: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

tag_version = ('00000001', '00000001', '*final'), distance = 0

    def guess_next_version(tag_version, distance):
        version = str(tag_version)
        if '.dev' in version:
            prefix, tail = version.rsplit('.dev', 1)
            assert tail == '0', 'own dev numbers are unsupported'
            return '%s.dev%s' % (prefix, distance)
        else:
>           prefix, tail = re.match('(.*?)(\d+)$', version).groups()
E           AttributeError: 'NoneType' object has no attribute 'groups'

/usr/local/lib/python2.7/site-packages/setuptools_scm/version.py:91: AttributeError
_______________________ test_next_tag[1.2.dev-1.2.dev0] ________________________

tag = '1.2.dev', expected = '1.2.dev0'

    @pytest.mark.parametrize('tag, expected', [
        ('1.1', '1.2.dev0'),
        ('1.2.dev', '1.2.dev0'),
        ('1.1a2', '1.1a3.dev0'),
        ])
    def test_next_tag(tag, expected):
        version = pkg_resources.parse_version(tag)
>       assert guess_next_version(version, 0) == expected

testing/test_functions.py:19: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

tag_version = ('00000001', '00000002', '*@', '*final'), distance = 0

    def guess_next_version(tag_version, distance):
        version = str(tag_version)
        if '.dev' in version:
            prefix, tail = version.rsplit('.dev', 1)
            assert tail == '0', 'own dev numbers are unsupported'
            return '%s.dev%s' % (prefix, distance)
        else:
>           prefix, tail = re.match('(.*?)(\d+)$', version).groups()
E           AttributeError: 'NoneType' object has no attribute 'groups'

/usr/local/lib/python2.7/site-packages/setuptools_scm/version.py:91: AttributeError
_______________________ test_next_tag[1.1a2-1.1a3.dev0] ________________________

tag = '1.1a2', expected = '1.1a3.dev0'

    @pytest.mark.parametrize('tag, expected', [
        ('1.1', '1.2.dev0'),
        ('1.2.dev', '1.2.dev0'),
        ('1.1a2', '1.1a3.dev0'),
        ])
    def test_next_tag(tag, expected):
        version = pkg_resources.parse_version(tag)
>       assert guess_next_version(version, 0) == expected

testing/test_functions.py:19: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

tag_version = ('00000001', '00000001', '*a', '00000002', '*final'), distance = 0

    def guess_next_version(tag_version, distance):
        version = str(tag_version)
        if '.dev' in version:
            prefix, tail = version.rsplit('.dev', 1)
            assert tail == '0', 'own dev numbers are unsupported'
            return '%s.dev%s' % (prefix, distance)
        else:
>           prefix, tail = re.match('(.*?)(\d+)$', version).groups()
E           AttributeError: 'NoneType' object has no attribute 'groups'

/usr/local/lib/python2.7/site-packages/setuptools_scm/version.py:91: AttributeError
================ 7 failed, 23 passed, 1 skipped in 3.25 seconds ================

I'm just running py.test in the source dir. Is that correct?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.