CrizR
CrizR

Reputation: 688

Running setup.py creates version.py file with no version set

When running my setup.py a version.py file is created without the version specified in the file. How do I fix it so that a version is specified?

Here's my setup.py:

from setuptools import setup, find_packages
from codecs import open
from os import path


here = path.abspath(path.dirname(__file__))

with open(path.join(here, 'README.md'), encoding='utf-8') as f:
    long_description = f.read()


def parse_requirements(filename):
    lineiter = (line.strip() for line in open(filename))
    return [line for line in lineiter if line and not line.startswith("#")]


install_reqs = parse_requirements(filename='requirements.txt')

setup(

    name='eagle-py-framework',  # Required

    version=1.0,  # Required

    description='Eagle Python Framework',  # Required

    long_description=long_description,  # Optional

    author='asdf',  # Optional

    author_email='asdf',

    url='asdf',

    classifiers=[  # Optional
        'Development Status :: 3 - Alpha',
        'Intended Audience :: Developers',
        'Topic :: Software Development :: Build Tools',
        'License :: OSI Approved :: MIT License',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.6',
    ],
    packages=find_packages(exclude=['contrib', 'docs', 'tests']),  # Required
    install_requires=install_reqs,  # Optional
)

The command I'm using to run it is:

python setup.py sdist

The version.py file it creates only contains this:

__version__=

Upvotes: 0

Views: 74

Answers (1)

Roushan
Roushan

Reputation: 4420

Use version as string

setup(

        name='eagle-py-framework',  # Required

        version = "1.0",  # Required #string
    )

from here -> https://www.python.org/dev/peps/pep-0396/

3) When a module (or package) includes a version number, the version SHOULD be available in the version attribute.

4) For modules which live inside a namespace package, the module SHOULD include the version attribute. The namespace package itself SHOULD NOT include its own version attribute.

5) The version attribute's value SHOULD be a string.

https://docs.python.org/2/distutils/setupscript.html

Upvotes: 1

Related Questions