jbweston / miniver

Like Versioneer, but smaller
Creative Commons Zero v1.0 Universal
53 stars 10 forks source link

Installation does not work with 'src' package layout #30

Open kmpf opened 3 years ago

kmpf commented 3 years ago

Used miniver as replacement for versioneer. Ran into problem:

FileNotFoundError: [Errno 2] No such file or directory: '<package_name>/_version.py'

Fixed the issue by changing:

spec = spec_from_file_location('version', os.path.join(package_name, '_version.py'))

to:

spec = spec_from_file_location('version', os.path.join('src', package_name, '_version.py'))

adding 'src' to path. This information should be included in the documentation. If I'll find time I'll provide a merge request.

jbweston commented 3 years ago

Thanks for the report @kmpf!

I agree that we need to add documentation for this.

It seems support for 'src' layout was added in v0.7.0 (according to the changelog). You can use miniver install src/<package_name> instead of miniver install <package_name>.

This can certainly be made more ergonomic (miniver should just auto-detect the src/ layout); I'll take a look into it this weekend

kmpf commented 3 years ago

Shall I help out with something. Testing? Providing documentation?

jbweston commented 3 years ago

@kmpf thanks!

Documentation would be the easiest place to start; we just need to add a section to the README. If you want to open a PR for that feel free!

jbweston commented 3 years ago

If you want to take a crack at implemention auto-detection of src layout that would be cool also!

If so we can start a discussion in a separate "feature proposal" issue, or you can directly open a PR and we'll go from there.