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

use pyproject.toml [build-system] and setuptools_scm #188

Merged
merged 6 commits into from Aug 12, 2022

Conversation

mathause
Copy link
Member

I did not plan to do this now but as setuptool v64 causes problems with versioneer I went for it (instead of pinning setuptools). I do have a bit of experience with this setup by now, so I feel fairly confident this "just works". Maybe requires a re-install in your development environment.

@znicholls FYI.

@mathause
Copy link
Member Author

So much to "I know what I am doing" 😂

@mathause
Copy link
Member Author

Ok falling back to pkg_ressources for python 3.7 - we cannot conditionally requires pkg_resources for python 3.7 in conda...

@codecov-commenter
Copy link

codecov-commenter commented Aug 12, 2022

Codecov Report

❗ No coverage uploaded for pull request base (main@f5f7be1). Click here to learn what that means.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #188   +/-   ##
=======================================
  Coverage        ?   79.28%           
=======================================
  Files           ?       31           
  Lines           ?     1400           
  Branches        ?        0           
=======================================
  Hits            ?     1110           
  Misses          ?      290           
  Partials        ?        0           
Flag Coverage Δ
unittests 79.28% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@mathause mathause merged commit 3a881ab into MESMER-group:main Aug 12, 2022
@mathause mathause deleted the pyproject_toml branch August 12, 2022 15:58
authors = "Authors, see AUTHORS"
author = authors

# The short X.Y version
version = get_versions()["version"].split("+")[0]
version = mesmer.__version__.split("+")[0]
Copy link
Collaborator

Choose a reason for hiding this comment

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

In other packages I had to follow this pattern https://github.com/openscm/openscm-runner/blob/27eb7baddb686862c7996dbccabf34cea934fcb7/docs/source/conf.py#L19

I can't remember why exactly, but it was something to do with being installed or not being installed when building docs

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh - I wasn't aware that it's not (no longer?) installed per default in RTD. In xarray and regionmask we install it manually using pip (but I thought this is because it installs it with eager updates [making it impossible to pin packages]).

In any case RTD currently reports "mesmer 0.0.0 documentation" - I'll try your pattern to fix this in a new PR.

Related - for regionmask it reported a "dirty" version even for releases. This happens because RTD changes some files before installing the package. I used the following to work around this: regionmask/regionmask/pull/348

Copy link
Member Author

Choose a reason for hiding this comment

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

We currently do an install on RTD using "setuptools", i.e. i.e., python ./setup.py install, which is deprecated and may therefore not work together with pyproject.toml.

see #190 and

- method: setuptools

@@ -0,0 +1,4 @@
node: $Format:%H$
Copy link
Collaborator

Choose a reason for hiding this comment

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

Out of curiosity , what is this file?

Copy link
Member Author

Choose a reason for hiding this comment

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

I only just got this recently. If you define <filename> export-subst in a .gitattributes file, git will expand several placeholders when adding this file to an archive (from https://git-scm.com/docs/gitattributes). These placeholders can be the commit hash etc.

It currently still points to the wrong file (#189). With #189 merged:

mkdir archive
git archive HEAD > archive/HEAD.tar.gz
cd archive
tar -xvf HEAD.tar.gz
cat .git_archival.txt

returns

node: d933fa6f0835203e8310ca68b7307ebc34e63c43
node-date: 2022-08-15T11:05:04+02:00
describe-name: v0.8.3-39-gd933fa6
ref-names: HEAD -> fix_gitattributes_versioneer, origin/fix_gitattributes_versioneer

I think git archive is used to create the files in https://github.com/MESMER-group/mesmer/releases/tag/v0.8.3. Versioneer does it slightly differntly by writing to mesmer/_version.py export-subst.

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.

None yet

3 participants