Skip to content

feat: precheck function for version consistency #3525

Closed
@terriko

Description

@terriko

@antoniogi had an interesting suggestion during the code review in #3470, which is that we may be able to make a pre-check function for versions to see if they adhere to something that looks like a version schema that we can compare. I didn't want to delay that PR further but I think it's an interesting idea.

We're handling a few variants of version cases:

  • comparison of . delimited numbers
    • e.g. 1.2.3
  • comparison of numbers which may also include a few other special characters (_, -) (in kerberos and others)
    • e.g. 5-1.4
  • comparison of numbers with appended letters that increase the version number such as openssl or libjpeg
    • e.g. 1.1.1g
  • comparison of numbers with appended pre-release designators such as pre1, rc4, dev3
    • e.g. 7.8.9rc2

There may be other types of version schemas that we could support if we knew about them, and there may be opportunities for us to do better with what we've got. A precheck function might help us throw better version errors when we encounter schemes we don't know and help us figure out how to improve the function we're using.

A note on why the version compare function is urgent: currently we've frozen on an older version of packaging which you need to use for tests, but black now uses a newer version that we support, which means people need to run linters and tests in separate venvs, which is ok when you're using precheck because it automatically does that, but it's a pain when you want to run a tool manually yourself.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions