Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hidden files no longer required for git archive? #793

Closed
kwinkunks opened this issue Dec 5, 2022 · 6 comments
Closed

Hidden files no longer required for git archive? #793

kwinkunks opened this issue Dec 5, 2022 · 6 comments
Labels

Comments

@kwinkunks
Copy link
Sponsor Contributor

In the docs under Git archives, it states that in order for the version number to be retrieved from tags, some special content is required in 2 files: .git_archival.txt and .gitattributes.

However, after comparing notes with a colleague, it seems like the two files might not actually be required. I tried removing them and I think everything is working properly. Am I missing something, or can these files be dispensed with now?

The project I'm building: https://github.com/kwinkunks/unmap (except without those 2 files)

The content of unmap/_version.py (which is not in the archive) is being updated, e.g.:

# coding: utf-8
# file generated by setuptools_scm
# don't change, don't track in version control
__version__ = version = '0.1.3rc2.dev1+g77e7a8a.d20221205'
__version_tuple__ = version_tuple = (0, 1, 3, 'dev1', 'g77e7a8a.d20221205')

The versioning code is in unmap/__init__.py.

@RonnyPfannschmidt
Copy link
Contributor

more context is needed, classically git does not include the metadata needed to do this, so please show how you actually build things in a way i can repeat directly

@kwinkunks
Copy link
Sponsor Contributor Author

I'm sorry, I was not paying attention and missed this question.

I'm building the project with python -m build.

@RonnyPfannschmidt
Copy link
Contributor

@kwinkunks basically these files are needed for when someone pulls a git tag download
the artifacts build with python -m build do already include the metadata
but downloads from github tag archives dont

@kwinkunks
Copy link
Sponsor Contributor Author

Okay, I think I understand. Thank you for explaining that.

So since the artifacts include the metadata (I now see the version in PKG-INFO and in the wheel metadata), why do I need setuptools_scm to write to the _version.py file? Can I also skip that part? Or does this file cover some other scenario?

@RonnyPfannschmidt
Copy link
Contributor

the _version.py file is commonly used as importing a module sometimes is orders of magnitude faster than loading the package metadata

in the old pkg_resources times loading the metadata could be as expensive as 0.2 seconds or even more

which is absolute horrendous when you want very quick cli commands

even with importlib.metadata the delay can be noticeable

@kwinkunks
Copy link
Sponsor Contributor Author

Wonderful, thank you for the clarification 🙌 I will close this issue if there's no objection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants