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

📦 Enable support for git archive installs #1095

Conversation

webknjaz
Copy link
Member

Summary

This patch enables the end-users to succeed installing from GitHub source Git archive URLs, letting setuptools-scm calculate the distribution version correctly, including the exports of non-tagged commits [1].

Pull Request Check List

  • Added tests for changed code.
    Our CI fails if coverage is not 100%.
  • New features have been added to our Hypothesis testing strategy.
  • Changes or additions to public APIs are reflected in our type stubs (files ending in .pyi).
    • ...and used in the stub test file tests/typing_example.py.
    • If they've been added to attr/__init__.pyi, they've also been re-imported in attrs/__init__.pyi.
  • Updated documentation for changed code.
    • New functions/classes have to be added to docs/api.rst by hand.
    • Changes to the signature of @attr.s() have to be added by hand too.
    • Changed/added classes/methods/functions have appropriate versionadded, versionchanged, or deprecated directives.
      The next version is the second number in the current release + 1.
      So if the current version on PyPI is 23.1.0, the next version is gonna be 23.2.0.
  • Documentation in .rst files is written using semantic newlines.
  • Changes (and possible deprecations) have news fragments in changelog.d.
  • Consider granting push permissions to the PR branch, so maintainers can fix minor issues themselves without pestering you.

@webknjaz webknjaz requested a review from hynek January 30, 2023 16:04
@webknjaz webknjaz mentioned this pull request Jan 30, 2023
This patch enables the end-users to succeed installing from GitHub
source Git archive URLs, letting `setuptools-scm` calculate the
distribution version correctly, including the exports of non-tagged
commits [[1]].

[1]: https://github.com/pypa/setuptools_scm#git-archives
@webknjaz webknjaz force-pushed the maintenance/packaging-git-archives-support branch from c7ba193 to 532d441 Compare January 30, 2023 17:59
@webknjaz
Copy link
Member Author

Proof that this works:

$ pip install https://github.com/webknjaz/attrs/archive/maintenance/packaging-git-archives-support.tar.gz
Collecting https://github.com/webknjaz/attrs/archive/maintenance/packaging-git-archives-support.tar.gz
  Downloading https://github.com/webknjaz/attrs/archive/maintenance/packaging-git-archives-support.tar.gz
     \ 208 kB 750 kB/s
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Building wheels for collected packages: attrs
  Building wheel for attrs (PEP 517) ... done
  Created wheel for attrs: filename=attrs-22.1.1.dev156-py3-none-any.whl size=59959 sha256=5fca3d4e94fdbd7dc5515da4b6e45c69db01a1fae3bb16aac1b168f5570f61d9
  Stored in directory: ~/.cache/pip/wheels/29/55/36/3b514229ffa36f05afab77610f4e90f30f1f595a2fb5aba2a9
Successfully built attrs
Installing collected packages: attrs
Successfully installed attrs-22.1.1.dev156

@webknjaz webknjaz enabled auto-merge (squash) January 30, 2023 18:12
Copy link
Member

@hynek hynek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool thanks! I guess I'll have to look at my other projects too!

@webknjaz webknjaz merged commit cabc062 into python-attrs:main Feb 2, 2023
@hynek
Copy link
Member

hynek commented Feb 9, 2023

@webknjaz I have just noticed two new warnings while building:

/tmp/build-env-c8w_zcyy/lib/python3.10/site-packages/setuptools_scm/git.py:295: UserWarning: git archive did not support describe output
[125](https://github.com/python-attrs/attrs/actions/runs/4101911014/jobs/7074233132#step:5:131)
  warnings.warn("git archive did not support describe output")
[126](https://github.com/python-attrs/attrs/actions/runs/4101911014/jobs/7074233132#step:5:132)
/tmp/build-env-c8w_zcyy/lib/python3.10/site-packages/setuptools_scm/git.py:312: UserWarning: unexported git archival found
[127](https://github.com/python-attrs/attrs/actions/runs/4101911014/jobs/7074233132#step:5:133)
  warnings.warn("unexported git archival found")

What exactly do they mean? Can we fix them or do we have to ignore them? I'm getting them locally too, that's how I noticed.

@webknjaz
Copy link
Member Author

webknjaz commented Feb 9, 2023

I'll check. I think this may happen on source archives made with very old Git but not sure. I'm traveling so it'll take a while to get to a power outlet.

@RonnyPfannschmidt might know the answer, though.

@webknjaz
Copy link
Member Author

webknjaz commented Feb 9, 2023

I only looked at the logs from phone and it seems to be happening during sdist creation. The warning seems to indicate an old Git version so I'd update it first thing, maybe that's enough.

@RonnyPfannschmidt
Copy link

im pretty sure this can happen when creating a sdist while the file finder is active
a manifest exclude for the .git_archival should help to keep the un-evaluated archival off the hands of setuptools_scm

@webknjaz
Copy link
Member Author

webknjaz commented Feb 9, 2023

@RonnyPfannschmidt are you implying that the behavior that hatch/hatch-vcs might differ from setuptools, in how this is included in sdist?

@RonnyPfannschmidt
Copy link

I missed the hatch migration, for hatch the exclude location differs from

@webknjaz
Copy link
Member Author

webknjaz commented Feb 9, 2023

@RonnyPfannschmidt is the expectation that this is just excluded?

@RonnyPfannschmidt
Copy link

No, the detail issue is that the bugfix for missed archival was tested in isolation and we missed that it warns for correct sdists depending on the order of entrypoints

@webknjaz
Copy link
Member Author

webknjaz commented Feb 9, 2023

Ah, so no changes are needed here.

@hynek
Copy link
Member

hynek commented Feb 9, 2023

Wait, I didn't understand any of this. 😅 What's happening?

@webknjaz
Copy link
Member Author

webknjaz commented Feb 9, 2023

@hynek: @RonnyPfannschmidt said that it's a bug in the setuptools-scm upstream so we just need to wait for the fix.

@hynek
Copy link
Member

hynek commented Feb 9, 2023

OK but the bug is the warning – the packages are OK, right?

@RonnyPfannschmidt
Copy link

Correct

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

Successfully merging this pull request may close these issues.

3 participants