unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Alexis Simon <alexis.simon@runbox.com>
To: Polyedre <polyedre@disroot.org>, help-guix@gnu.org
Subject: Re: Python package that uses setuptools_scm is builded with version 0.0.0
Date: Sun, 2 Jun 2024 18:09:15 -0700	[thread overview]
Message-ID: <0475e6c9-d346-4c25-81f4-e82af9d21bb1@runbox.com> (raw)
In-Reply-To: <87h6ecv3yn.fsf@disroot.org>

Hi Polyedre,

I think having python-setuptools-scm in your native-inputs should be enough for building with the 
right version number.
At least it was enough for me when I encountered this issue before.

Best,
Alexis

On 01/06/2024 12:49, Polyedre wrote:
> Hello,
> 
> While trying to package maestral[1] for guix, I came across the python
> package 'survey'[2]. With the following package description, this
> package builds but the version of the resulting python package is 0.0.0.
> 
> ```scheme
> (define-public python-survey
>    (package
>      (name "python-survey")
>      (version "5.3.0")
>      (source
>       (origin
>         (method url-fetch)
>         (uri (pypi-uri "survey" version))
>         (sha256
>          (base32 "1q2b07rq66njyg70fsd0gn6710z1sz9phpy3rd7p7dqxn6rfvi4c"))))
>      (build-system pyproject-build-system)
>      ;; (propagated-inputs (list python-setuptools-scm))
>      (arguments
>       `(#:phases (modify-phases %standard-phases
>                    (delete 'check))))
>      (home-page "https://github.com/Exahilosys/survey")
>      (synopsis "A simple library for creating beautiful interactive prompts.")
>      (description
>       "This package provides a simple library for creating beautiful interactive
> prompts.")
>      (license license:expat)))
> ```
> 
> It seems that this package uses setuptools_scm. According to its
> documentation, the latter detects the version of the package currently
> building directly from "`git` or `hg`" (I guess with the tags?).
> 
> As a consequence, this package builds with the version 0.0.0:
> 
> ```
> $ guix shell -f test.scm python -- pip3 freeze
> survey==0.0.0
> ````
> 
> It seems that the environment variables SETUPTOOLS_SCM_PRETEND_VERSION
> and SETUPTOOLS_SCM_PRETEND_VERSION_FOR_<package>[3] can be used to override
> this behavior.
> 
> What would be the best way to add an environment variable to te build
> process? Just exporting the variable to my shell before calling `guix
> build` does not work.
> 
> Regards,
> Polyedre
> 
> [1] https://pypi.org/project/maestral/
> [2] https://pypi.org/project/survey/
> [3] https://setuptools-scm.readthedocs.io/en/latest/usage/#with-dockerpodman
> 


      reply	other threads:[~2024-06-03  4:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-01 19:49 Python package that uses setuptools_scm is builded with version 0.0.0 Polyedre
2024-06-03  1:09 ` Alexis Simon [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0475e6c9-d346-4c25-81f4-e82af9d21bb1@runbox.com \
    --to=alexis.simon@runbox.com \
    --cc=help-guix@gnu.org \
    --cc=polyedre@disroot.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).