ofek / hatch-vcs

Hatch plugin for versioning with your preferred VCS
MIT License
109 stars 15 forks source link

Questions about hatch_vcs #29

Closed lwasser closed 1 year ago

lwasser commented 1 year ago

Hi @ofek πŸ‘‹ If you'd rather me add this in the discussions I can (or in the hatch repo?). i wasnt sure where you'd prefer questions :)

I have a few.

  1. When I build my package locally, i noticed a bunch of metadata after the build version 1.1.1 : 1.1.1.dev6+g19e051e.d20230106 - i was curious what those numbers meant / where they came from in the build? When i build with setuptools_SCM locally i get a post2 after and nothing else. are these values something to do with reproducible builds (i'm just learning about that component of the build system so bare with me).
  2. is there an equivalent of twine check dist/* in hatch (i know this is the vcs repo)? or is that step even needed with modern tools like hatch? i suppose it's just checking the long description but i just wanted to understand if that is still an important step.
  3. environments: in the docs it says that by default hatch with use the default environment. My "default" environment technically is a conda environment. but when i build i think i see hatch using another env to isolate the build. i'm just curious if you can help me understand, 1. what envt manager hatch uses by default and 2. could it use an existing conda envt if i wanted to use that instead?

many many thanks. these questions are partially because i'm working on stravalib (so far the default builds are much cleaner) but also because i'm adding hatch to our pyOpenSci packaging guide and will be able to better describe it and the vcs plugin with this information! i'm thinking about creating tutorials on package builds using hatch as i really like it so far. thank you for your work on this!

RonnyPfannschmidt commented 1 year ago

The numbers mean the same as they do with setuptools_scm

If you where configuring the post release version scheme, then that's currently not happening for hatch-vcs

setuptools_scm is used under the hood

ofek commented 1 year ago

Hello!

  1. As Ronny mentioned this plug-in uses his library under the hood. The stuff you see after the version number indicates that there has been a modification to the repository since the last tag.
  2. There is no equivalent, but there is not much need since file inclusion is simpler. As you mention the thing that is lost is the checking of restructured text if the readme is in that format.
  3. Hatch uses virtual environments by default but there is a plug-in for Conda https://hatch.pypa.io/latest/plugins/environment/reference/#known-third-party
lwasser commented 1 year ago

hi! πŸ‘‹ Ok this all makes sense! thank you both. And looking more closely at that string knowing it's because there have been changes post tag / release.

1.1.1.dev6+g19e051e.d20230107

1.1.1 = version dev6 = i think 6 commits past the last release g19e... = git and the associated shortened hash of the most recent commit d = date of build

Thank you so much! i will close this now. I had wondered if it was using setuptools_scm under the hood after seeing the install and looking a bit closely here at the repo !

thank you both for building such great packaging tools in our ecosystem! closing this!