0

I am trying to add versioning to my current Python project. I have installed Versioneer and setup the setup.cfg file to the best of my understanding of the documentation. When I run versioneer install I receive an error stating it cannot find the _version.py file. Below is the copy of the file and error I receive.

[versioneer]
VCS = git
style = pep440
versionfile_source = hw-assesment-tool/_version.py
versionfile_build = hw-assesment-tool/_version.py
tag_prefix =
parentdir_prefix =

and this is the error I get:

FileNotFoundError: [Errno 2] No such file or directory: 'hw-assesment-tool/_version.py'
devopsrc
  • 3
  • 1
  • My understanding is that running "versioneer install" is what's supposed to generate the _version.py file. – devopsrc Sep 15 '21 at 13:39

1 Answers1

0

I had that problem with a similar setup.cfg file, but in a tiny project with no nested directories and I ended up needing to remove the directory in front of _version.py because the versioneer.py script searches from the directory that contains the setup.cfg and so it was trying to look in a directory that didn't exist.

I'm not sure how your file structure is set up but it might work if you try changing it to:

versionfile_source = _version.py
versionfile_build = _version.py

If all your source files are in the same directory as the setup.cfg then that should fix it.