openedx / openedx/openedx-events

PEP-440 Not supported by EventMetadata

Open
#513 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
13
Forks
33
Avg merge
14h 37m
Merged PRs (30d)
4

Description

Description

sourcelib field of EventMetada does not support PEP-440 post, pre and development releases due to intended parse of version data to integer. @hooks-extension-framework

Context

During the development process of a new signal we face the need to create a fork of the v9.10.0 version of openedx-events package. To properly follow the versioning protocol, we decide to use post releases for the mentioned version so in that way we won't interfere with the upstream versioning in a case of syncing the changes.

Once the post release v9.10.0.post1 was released, we face an issue with our CI process: openedx-events eventmetada raised an error due to trying to parse an string value into integer.

https://packaging.python.org/en/latest/discussions/versioning/#valid-version-numbers

This was caused by the "post1" key set in the version definition of the package.

Solution

Remove the map function that tries to parse the version keys to integer. and let the field defined this way:

    sourcelib = attr.ib(
        type=tuple, default=None,
        converter=attr.converters.default_if_none(
            attr.Factory(lambda: tuple(openedx_events.__version__.split(".")))
        ),
        validator=attr.validators.instance_of(tuple),
    )

We already implement this solution in our fork and no test nor workflows were impacted.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the EventMetadata field in openedx_events/data.py and the version definition in openedx_events/init.py; openedx_events/tooling.py shows where the metadata is raised. Verify that post, pre, and development release versions are accepted without integer parsing, then confirm the existing tests and workflows remain unaffected.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.