jbweston / miniver

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

miniver refuses to use git's version if the package is not at the repository's root #38

Closed jsacrist closed 2 years ago

jsacrist commented 3 years ago

There is a comment in _version.py that reads:

# The top-level directory of the current Git repository is not the same
# as the root directory of the distribution: do not extract the
# version from Git.

I tried looking for documentation elaborating on why this is desirable, but didn't find much.

The problem I'm experiencing is that requiring the distribution package to be at the top level of the repository makes miniver fail whenever we want to version and package two distributions that belong to the same namespace.

Here's the documentation on how to structure several packages so that they are part of the same namespace.

As you can see, this approach requires that your distribution package is contained in a subdirectory inside of another directory with the name of the namespace, like so:

$ tree
.                                 # <-- Root of the repository
├── some_namespace                # <-- namespace directory
│   └── some_package              # <-- distribution package directory
│       ├── some_sourcefile.py    #
│       ├── .gitattributes        #
│       ├── __init__.py           #
│       ├── _static_version.py    #
│       └── _version.py           # <-- miniver will refuse to get the version from git because it's one level removed from the root
├── README.md
└── setup.py