-
-
Notifications
You must be signed in to change notification settings - Fork 544
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
chore(packaging): Enable support for versioning Git archives #737
base: master
Are you sure you want to change the base?
chore(packaging): Enable support for versioning Git archives #737
Conversation
I suppose that's why you marked it as draft? via pre-commit-terraform
➜ pip install https://github.com/antonbabenko/pre-commit-terraform/archive/339c31a.tar.gz
Collecting https://github.com/antonbabenko/pre-commit-terraform/archive/339c31a.tar.gz
Downloading https://github.com/antonbabenko/pre-commit-terraform/archive/339c31a.tar.gz
- 102.1 kB 2.2 MB/s 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... error
error: subprocess-exited-with-error
× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [39 lines of output]
fatal: not a git repository (or any of the parent directories): .git
Traceback (most recent call last):
File "/home/vm/code/0-other/open-source/pre-commit-terraform/venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/home/vm/code/0-other/open-source/pre-commit-terraform/venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/vm/code/0-other/open-source/pre-commit-terraform/venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 152, in prepare_metadata_for_build_wheel
whl_basename = backend.build_wheel(metadata_directory, config_settings)
File "/tmp/pip-build-env-f_b8t2yj/overlay/lib/python3.10/site-packages/hatchling/build.py", line 58, in build_wheel
return os.path.basename(next(builder.build(directory=wheel_directory, versions=['standard'])))
File "/tmp/pip-build-env-f_b8t2yj/overlay/lib/python3.10/site-packages/hatchling/builders/plugin/interface.py", line 90, in build
self.metadata.validate_fields()
File "/tmp/pip-build-env-f_b8t2yj/overlay/lib/python3.10/site-packages/hatchling/metadata/core.py", line 265, in validate_fields
_ = self.version
File "/tmp/pip-build-env-f_b8t2yj/overlay/lib/python3.10/site-packages/hatchling/metadata/core.py", line 149, in version
self._version = self._get_version()
File "/tmp/pip-build-env-f_b8t2yj/overlay/lib/python3.10/site-packages/hatchling/metadata/core.py", line 244, in _get_version
core_metadata = self.core
File "/tmp/pip-build-env-f_b8t2yj/overlay/lib/python3.10/site-packages/hatchling/metadata/core.py", line 196, in core
metadata_hook.update(self.core_raw_metadata)
File "/tmp/pip-build-env-f_b8t2yj/overlay/lib/python3.10/site-packages/hatch_vcs/metadata_hook.py", line 45, in update
urls[key] = formatter.format(url)
File "/usr/lib/python3.10/string.py", line 161, in format
return self.vformat(format_string, args, kwargs)
File "/tmp/pip-build-env-f_b8t2yj/overlay/lib/python3.10/site-packages/hatchling/utils/context.py", line 143, in vformat
result, _ = self._vformat(format_string, args, kwargs, used_args, 10)
File "/usr/lib/python3.10/string.py", line 218, in _vformat
result.append(self.format_field(obj, format_spec))
File "/tmp/pip-build-env-f_b8t2yj/overlay/lib/python3.10/site-packages/hatchling/utils/context.py", line 161, in format_field
return self.__formatters[formatter](value, data)
File "/tmp/pip-build-env-f_b8t2yj/overlay/lib/python3.10/site-packages/hatch_vcs/metadata_hook.py", line 39, in <lambda>
'commit_hash': lambda *args: vcs_utils.get_commit_hash(self.root),
File "/tmp/pip-build-env-f_b8t2yj/overlay/lib/python3.10/site-packages/hatch_vcs/vcs_utils.py", line 10, in get_commit_hash
return subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=root).decode('utf-8').strip()
File "/usr/lib/python3.10/subprocess.py", line 421, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/lib/python3.10/subprocess.py", line 526, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['git', 'rev-parse', 'HEAD']' returned non-zero exit status 128.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output. |
Yep: ofek/hatch-vcs#80. I'm withdrawing the effort until I hear from the upstream. |
8d8350e
to
a7155a7
Compare
@MaxymVlasov this can be merged now. |
Nice, |
@MaxymVlasov no, it's not outdated. You can see in the other job that it's of the latest version. The problem here is that your other workflow did not execute this check for the past 3 months and it's version changed over this period of time. It's actually two problems:
FWIW, I think I saw a Python implementation of the same check somewhere that gives you more control over the version pinning. |
ubuntu22.04 has 0.8.0 of it, if install it via That's why I, as user of ubuntu 22.04 locally, and in CI itself which use same official instalation method via |
a7155a7
to
32afbff
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## master #737 +/- ##
===========================================
- Coverage 100.00% 96.38% -3.62%
===========================================
Files 9 10 +1
Lines 161 249 +88
Branches 5 7 +2
===========================================
+ Hits 161 240 +79
- Misses 0 9 +9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
'Source Archive' = 'https://github.com/antonbabenko/pre-commit-terraform/archive/{commit_hash}.tar.gz' | ||
# FIXME: Uncomment 'Source Archive' as soon as | ||
# FIXME: https://github.com/ofek/hatch-vcs/issues/80 is fixed. | ||
# 'Source Archive' = 'https://github.com/antonbabenko/pre-commit-terraform/archive/{commit_hash}.tar.gz' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it not essential to "Enable support for versioning Git archives"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's another feature. You're not using it now anyway.
32afbff
to
1115c64
Compare
The point still stands: the software wasn't pinned. The VM image upgrade was just a method by which said upgrade happened. These images could also be pinned. I've been considering doing this in my projects too, due to similar cases of the underlying software being swapped out unexpectedly, especially in low-activity projects. |
Agree, everything should be pinned, especially if it not cost much to achive that |
Rebase/merge please last changes, and I'll merge this PR |
It's a follow-up to antonbabenko#735 that lacks this property. It's also an internal change. It essentially allows one to ``` $ pip install https://github.com/antonbabenko/pre-commit-terraform/archive/ae5057d.zip ``` and get a correctly computed version in the installed metadata. [1]: https://setuptools-scm.rtfd.io/en/latest/usage/#git-archives
This is a workaround for ofek/hatch-vcs#80 that manifests itself as a traceback when calling Git commands. The commit must be reverted once said upstream issue is fixed.
1115c64
to
0f07114
Compare
It's a follow-up to #735 that lacks this property. It's also an internal change.
It essentially allows one to
and get a correctly computed version in the installed metadata.
Put an
x
into the box if that apply:Description of your changes
See above.
How can we test changes