Skip to content

Get version from an entrypoint #109

@nedbat

Description

@nedbat

From a discussion in Discord with @RonnyPfannschmidt:

RonnyPfannschmidt: @nedbat does scriv have any way to get the next version from something like setuptools_scm ?

nedbat: Nothing built-in, and I don't know anything about setuptools_scm, but maybe we can figure something out.
nedbat: scriv collect --version=$(setuptools_scm something?)

RonnyPfannschmidt: that works out - also wondering if perhaps a cli command could be used as default version source like (python -m setuptools_scm --strip-dev)

nedbat: you mean, we could add a setting to scriv that is the command to run to get the version?  That could work.
nedbat: I like the nature of that: nothing hard-coded, but easy to configure the connections you want. The docs could include example commands for other tools.

RonnyPfannschmidt: or a entrypoint to call

nedbat: yes
nedbat: We already have a setting: version = literal: pyproject.toml: project.version  It could be extended:
    version = command: setuptools_scm something
    or
    version = call: setuptools_scm.main(strip_dev=True)

nedbat: (maybe full python there is weird)

RonnyPfannschmidt: lets not go there, - if its a command, its a string and fair game, if its a "entrypint" it should be pre-configred for scriv

nedbat: what's an example of an entrypoint? A named entrypoint, or module.callable ?

RonnyPfannschmidt: aka there should be a entrypoint like "scriv.get_version" and importlib metadata should be used to fetch a name of that group, no parameters should be passed
RonnyPfannschmidt: lets not go down the path of random pythonpath modification and module lookup, its a can of killer worms

nedbat: I'm assuming you want to use a setuptools_scm entrypoint?  What from here would be useful? https://github.com/pypa/setuptools_scm/blob/main/pyproject.toml#L69-L101

RonnyPfannschmidt: @nedbat i think you misunderstood me - i would add a scriv.get_version entrypoint to setuptools_scm like setuptools_scm = setuptools_scm._integration.scriv:return_version_for_scriv - and then people could configure that in their scriv config

nedbat: ok, so it would be an entrypoint from setuptools_scm, that's fine if it doesn't exist yet.
nedbat: i think setuptools_scm is well ahead of the curve in terms of exporting many entrypoints, so I'm not sure I would limit the callability to only entrypoints.

RonnyPfannschmidt: @nedbat i an understand the sentiment, unfortunately that opens up the failure vector of having to manage pythonpath ^^ based on year of suffering its not something a tool wants tobe in charge of

nedbat: I will keep an eye out for that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions