Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a schema version on releases of NMDC schema #17

Closed
dehays opened this issue Apr 9, 2021 · 2 comments
Closed

add a schema version on releases of NMDC schema #17

dehays opened this issue Apr 9, 2021 · 2 comments
Assignees

Comments

@dehays
Copy link
Contributor

dehays commented Apr 9, 2021

We discussed using semantic versioning or simply a time stamp on release versions. Either could work, to avoid needing to define the semantics of semantic versioning (does minor or patch break ingest or only major?) we decided time stamp release versions was simplest.

With versions on the schema it becomes possible to ask what schema version the metadata store (MongoDB or Terminus) is at and what version the search application ingest and relationship schema support

@dehays dehays transferred this issue from microbiomedata/nmdc-metadata Apr 9, 2021
@dwinston
Copy link
Collaborator

dwinston commented Apr 9, 2021

@wdduncan I'm familiar with the following scheme (which I used for https://github.com/polyneme/nmdc-mongo-tools):

# among dev requirements
invoke
setuptools-scm
twine
# in /setup.py

from setuptools import setup, find_packages

setup(
    packages=find_packages(),
    use_scm_version=True,
...
# in /tasks.py
from subprocess import run

from invoke import task


@task
def publish(c):
    completed = run(
        "git describe --tags $(git rev-list --tags --max-count=1)",
        shell=True,
        capture_output=True,
        encoding="utf-8",
    )
    vtag = completed.stdout.strip()
    major_minor, dot, patch = vtag.rpartition(".")
    vtag_new = major_minor + dot + str(int(patch) + 1)
    run(["git", "tag", vtag_new])
    run(["git", "push"])
    run(["git", "push", "--tags"])
    c.run("rm dist/*.*", warn=True)
    c.run("python setup.py sdist bdist_wheel")
    c.run("twine upload dist/*")

Here, invoke publish on the command line bumps the patch version via a git tag and pushes that to PyPI. The logic above can be refactored to use calver (e.g. YYYY.MM.DD).

@wdduncan
Copy link
Contributor

The nmdc-schema is now versioned using pypi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants