-
-
Notifications
You must be signed in to change notification settings - Fork 541
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
Draft
webknjaz
wants to merge
2
commits into
antonbabenko:master
Choose a base branch
from
webknjaz:maintenance/versioning-git-archives
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
chore(packaging): Enable support for versioning Git archives #737
webknjaz
wants to merge
2
commits into
antonbabenko:master
from
webknjaz:maintenance/versioning-git-archives
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
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. |
MaxymVlasov
changed the title
chore(packaging): X📦 Enable support for versioning Git archives
chore(packaging): Enable support for versioning Git archives
Dec 28, 2024
Yep: ofek/hatch-vcs#80. I'm withdrawing the effort until I hear from the upstream. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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