Skip to content

Curricula API#

aind_behavior_vr_foraging_curricula #

pep440_to_semver #

pep440_to_semver(ver)

Convert a PEP 440 version to a SemVer-compatible string.

Examples:

1.2.3rc2 -> 1.2.3-rc2 1.2.3a1 -> 1.2.3-a1 1.2.3b1 -> 1.2.3-b1 1.2.3.dev4 -> 1.2.3-dev4 1.2.3.post1 -> 1.2.3+post1

Source code in src/packages/aind_behavior_vr_foraging_curricula/src/aind_behavior_vr_foraging_curricula/__init__.py
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
def pep440_to_semver(ver: str) -> str:
    """
    Convert a PEP 440 version to a SemVer-compatible string.

    Examples:
        1.2.3rc2   -> 1.2.3-rc2
        1.2.3a1    -> 1.2.3-a1
        1.2.3b1    -> 1.2.3-b1
        1.2.3.dev4 -> 1.2.3-dev4
        1.2.3.post1 -> 1.2.3+post1
    """
    # pre-release: a, b, rc -> -aN, -bN, -rcN
    ver = re.sub(r"(?<=\d)(a|b|rc)(\d+)", r"-\1\2", ver)
    # dev release: .devN -> -devN
    ver = re.sub(r"\.dev(\d+)", r"-dev\1", ver)
    # post release: .postN -> +postN
    ver = re.sub(r"\.post(\d+)", r"+post\1", ver)
    return ver

Authoring Notes#

To include module-specific narrative content in generated curriculum pages, add a README.md file inside each curriculum module directory:

src/packages/aind_behavior_vr_foraging_curricula/src/aind_behavior_vr_foraging_curricula/<curriculum_name>/README.md

During docs generation, the curricula builder discovers this file (when present) and renders its Markdown under a Module README section on that curriculum page. Local relative asset references in that Markdown (for example, assets/diagram.svg) are not currently supported.