Skip to content

Commit

Permalink
Merge pull request #734 from Changaco/patch-1
Browse files Browse the repository at this point in the history
Update the README: document support for Git archives
  • Loading branch information
RonnyPfannschmidt authored Jun 28, 2022
2 parents 775b9a0 + fadcda9 commit 1b18371
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -255,16 +255,6 @@ To avoid BuildKit and mounting of the .git folder altogether, one can also pass
version as a build argument. Note that ``SETUPTOOLS_SCM_PRETEND_VERSION_FOR_${UPPERCASED_DIST_NAME}``
is preferred over ``SETUPTOOLS_SCM_PRETEND_VERSION``.

Notable Plugins
---------------

`setuptools_scm_git_archive <https://pypi.python.org/pypi/setuptools_scm_git_archive>`_
Provides partial support for obtaining versions from git archives that
belong to tagged versions. The only reason for not including it in
``setuptools_scm`` itself is Git/GitHub not supporting sufficient metadata
for untagged/followup commits, which is preventing a consistent UX.


Default versioning scheme
-------------------------

Expand Down Expand Up @@ -313,11 +303,30 @@ Builtin mechanisms for obtaining version numbers

1. the SCM itself (git/hg)
2. ``.hg_archival`` files (mercurial archives)
3. ``PKG-INFO``
3. ``.git_archival.txt`` files (git archives, see subsection below)
4. ``PKG-INFO``

.. note::
Git archives
~~~~~~~~~~~~

Git archives are supported, but a few changes to your repository are required.

Create a ``.git_archival.txt`` file in the root directory of your repository,
and copy-paste this into it::

node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true)$
ref-names: $Format:%D$

Create the ``.gitattributes`` file in the root directory of your repository
if it doesn't already exist, and copy-paste this into it::

.git_archival.txt export-subst

Finally, don't forget to commit those two files::

Git archives are not supported due to Git shortcomings
git add .git_archival.txt .gitattributes && git commit


File finders hook makes most of MANIFEST.in unnecessary
Expand Down

0 comments on commit 1b18371

Please sign in to comment.