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 schema version #253

Merged
merged 30 commits into from
Dec 14, 2019
Merged

Add schema version #253

merged 30 commits into from
Dec 14, 2019

Conversation

bdice
Copy link
Member

@bdice bdice commented Dec 6, 2019

Description

Adds an explicit schema version for the signac data model.

Motivation and Context

Resolves #165.

Types of Changes

  • Documentation update
  • Bug fix
  • New feature
  • Breaking change1

1The change breaks (or has the potential to break) existing functionality.

Checklist:

If necessary:

  • I have updated the API documentation as part of the package doc-strings.
  • I have created a separate pull request to update the framework documentation on signac-docs and linked it here.
  • I have updated the changelog and added all related issue and pull request numbers for future reference (if applicable). See example below.

Example for a changelog entry: Fix issue with launching rockets to the moon (#101, #212).

@bdice bdice requested a review from a team as a code owner December 6, 2019 21:19
@bdice bdice requested review from csadorf and removed request for a team December 6, 2019 21:19
@bdice bdice self-assigned this Dec 6, 2019
@bdice bdice added the enhancement New feature or request label Dec 6, 2019
@bdice bdice added this to the v1.3.0 milestone Dec 6, 2019
@bdice
Copy link
Member Author

bdice commented Dec 6, 2019

@csadorf I used the Version class and parse_version function, but I'm not sure if I like it. It adds "final" to the end of the version numbers when printed, like 1.0.0final.

@codecov
Copy link

codecov bot commented Dec 6, 2019

Codecov Report

Merging #253 into master will increase coverage by 0.31%.
The diff coverage is 90.12%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #253      +/-   ##
=========================================
+ Coverage   65.08%   65.4%   +0.31%     
=========================================
  Files          39      41       +2     
  Lines        5588    5654      +66     
=========================================
+ Hits         3637    3698      +61     
- Misses       1951    1956       +5
Impacted Files Coverage Δ
signac/__main__.py 0% <ø> (ø) ⬆️
signac/common/validate.py 39.13% <ø> (-4.21%) ⬇️
signac/contrib/errors.py 94.73% <100%> (+0.61%) ⬆️
signac/contrib/migration/v0_to_v1.py 100% <100%> (ø)
signac/version.py 100% <100%> (ø) ⬆️
signac/contrib/migration/__init__.py 87.27% <87.27%> (ø)
signac/contrib/project.py 90.88% <94.73%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cea2eff...15ce09d. Read the comment docs.

@csadorf
Copy link
Contributor

csadorf commented Dec 6, 2019

@csadorf I used the Version class and parse_version function, but I'm not sure if I like it. It adds "final" to the end of the version numbers when printed, like 1.0.0final.

Under what circumstances does this happen? For the warnings and error messages?

@csadorf
Copy link
Contributor

csadorf commented Dec 6, 2019

I just did a quick search, I'm not sure where we used that class anyways, maybe use distutils.version.StrictVersion instead?

@bdice
Copy link
Member Author

bdice commented Dec 6, 2019

@csadorf I used the Version class and parse_version function, but I'm not sure if I like it. It adds "final" to the end of the version numbers when printed, like 1.0.0final.

Under what circumstances does this happen? For the warnings and error messages?

Right, in the errors/warnings. To see it, just initialize a new project and then edit the config file to a higher major/minor version.

@bdice
Copy link
Member Author

bdice commented Dec 6, 2019

@csadorf Yeah, distutils is another choice. I am unavailable for most of the weekend, so if you’re interested in trying it, go ahead and commit to this branch. We may want to check if that Version class is used elsewhere and deprecate it if distutils does the job.

@csadorf
Copy link
Contributor

csadorf commented Dec 7, 2019

I'll have a look at it.

@csadorf
Copy link
Contributor

csadorf commented Dec 7, 2019

I realized that there are few things we didn't fully consider. I'm almost done with implementing the missing pieces. Will push soon.

@bdice
Copy link
Member Author

bdice commented Dec 9, 2019

@csadorf Reminder to push your changes when convenient.

Copy link
Contributor

@csadorf csadorf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was the last one to push changes, so I am erroneously still requested for review...

@@ -19,6 +19,8 @@
import errno
from pprint import pprint, pformat

from packaging import version
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://stackoverflow.com/a/11887885
According to this StackOverflow post, packaging isn't in the standard library but comes as a dependency of setuptools. I just wanted to make a note of that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, so we should probably add setuptools to the dependencies, however, it is not clear to me if we need to require a specific version.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@csadorf I looked at the history of the setuptools git repo and changelog. packaging has been included as a vendored package (not a dependency) since setuptools v8.0 (Dec 13, 2014). I think that StackOverflow answer I linked above is out of date. I recommend that we add packaging as a dependency instead. It's a very common dependency so I expect it will be already met by most users' environments.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But then in v39 it was changed to dependencies again?

Just tested, packaging is not installed by default in a "fresh" conda environment, but it's certainly very easy to install.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this and we need packaging>=15.0.

Copy link
Member Author

@bdice bdice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@csadorf Since we're hoping to include this in the release on Friday, I am offering some preliminary feedback - I know tests aren't passing yet but I hope this is still helpful.

signac/__main__.py Outdated Show resolved Hide resolved
signac/__main__.py Outdated Show resolved Hide resolved
signac/contrib/errors.py Outdated Show resolved Hide resolved
signac/__main__.py Outdated Show resolved Hide resolved
signac/contrib/migrations.py Outdated Show resolved Hide resolved
signac/contrib/project.py Outdated Show resolved Hide resolved
@csadorf csadorf requested a review from a team as a code owner December 11, 2019 15:43
@csadorf csadorf requested review from yuanzhou0827 and removed request for a team December 11, 2019 15:43
@csadorf
Copy link
Contributor

csadorf commented Dec 11, 2019

@bdice I plan on finalizing this before Friday. I need a free minute to consider how to potentially reduce the footprint of this patch (your concern).

I'll ping you again when I think it's ready and will ask you to informally review it again. I realize that this PR is kind of turned around now, sorry about that.

@bdice
Copy link
Member Author

bdice commented Dec 11, 2019

I realize that this PR is kind of turned around now, sorry about that.

Definitely not a problem - my goal was only to provide a draft implementation for further consideration. Thanks for taking it on.

@csadorf csadorf force-pushed the feature/schema-version branch 2 times, most recently from fd79706 to f2f2426 Compare December 12, 2019 13:53
@csadorf
Copy link
Contributor

csadorf commented Dec 12, 2019

@bdice This should be ready now. Please have a look.

Copy link
Member Author

@bdice bdice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@csadorf Two change requests (I can't request changes on my own PR). I want to use proper semantic versions, e.g. '1.0.0' instead of '1'. Also we need to make the requirements.txt file match the requirements in setup.py.

@@ -52,7 +41,7 @@ def get_validator():
cfg = """
project = string()
workspace_dir = string(default='workspace')
signac_version = version(default='0,1,0')
schema_version = string(default='1')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a proper semantic version string?

Suggested change
schema_version = string(default='1')
schema_version = string(default='1.0.0')

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment below.

@csadorf
Copy link
Contributor

csadorf commented Dec 13, 2019

@csadorf Two change requests (I can't request changes on my own PR). I want to use proper semantic versions, e.g. '1.0.0' instead of '1'.

I opted to use a simpler system, because I don't think that semantic versioning actually makes sense in this context. What would it mean to have a minor or patch release of the scheme? Is there ever a scenario where you could operate on a minor or patch release without migrating?

I compare this to other API schemes, that usually use a simple sequential scheme. Many RESTful APIs use a single number to indicate which API version they are using. I don't think that semantic versioning makes sense in this context.

@bdice
Copy link
Member Author

bdice commented Dec 13, 2019

@csadorf Two change requests (I can't request changes on my own PR). I want to use proper semantic versions, e.g. '1.0.0' instead of '1'.

I opted to use a simpler system, because I don't think that semantic versioning actually makes sense in this context. What would it mean to have a minor or patch release of the scheme? Is there ever a scenario where you could operate on a minor or patch release without migrating?

I compare this to other API schemes, that usually use a simple sequential scheme. Many RESTful APIs use a single number to indicate which API version they are using. I don't think that semantic versioning makes sense in this context.

I agree that using an integer version (not a string version) is preferable, but then we don't need packaging at all, and there are other places where semantic versions are used but aren't needed.

@csadorf
Copy link
Contributor

csadorf commented Dec 13, 2019

@csadorf Two change requests (I can't request changes on my own PR). I want to use proper semantic versions, e.g. '1.0.0' instead of '1'.

I opted to use a simpler system, because I don't think that semantic versioning actually makes sense in this context. What would it mean to have a minor or patch release of the scheme? Is there ever a scenario where you could operate on a minor or patch release without migrating?
I compare this to other API schemes, that usually use a simple sequential scheme. Many RESTful APIs use a single number to indicate which API version they are using. I don't think that semantic versioning makes sense in this context.

I agree that using an integer version (not a string version) is preferable, but then we don't need packaging at all, and there are other places where semantic versions are used but aren't needed.

Agreed, I'll make that change.

@csadorf
Copy link
Contributor

csadorf commented Dec 13, 2019

@csadorf Two change requests (I can't request changes on my own PR). I want to use proper semantic versions, e.g. '1.0.0' instead of '1'.

I opted to use a simpler system, because I don't think that semantic versioning actually makes sense in this context. What would it mean to have a minor or patch release of the scheme? Is there ever a scenario where you could operate on a minor or patch release without migrating?
I compare this to other API schemes, that usually use a simple sequential scheme. Many RESTful APIs use a single number to indicate which API version they are using. I don't think that semantic versioning makes sense in this context.

I agree that using an integer version (not a string version) is preferable, but then we don't need packaging at all, and there are other places where semantic versions are used but aren't needed.

Agreed, I'll make that change.

We determined that packaging was already inadvertently introduced as dependency as part of PR #253 so we'll leave this as is.

Copy link
Member Author

@bdice bdice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@csadorf Requesting changes: use integer versions everywhere, instead of mixing '1' and '1.0.0' styles.

signac/version.py Outdated Show resolved Hide resolved
tests/test_project.py Outdated Show resolved Hide resolved
@bdice bdice requested a review from a team as a code owner December 13, 2019 21:15
@bdice bdice merged commit 6ef0a98 into master Dec 14, 2019
@bdice bdice deleted the feature/schema-version branch December 14, 2019 01:05
@bdice bdice mentioned this pull request Feb 27, 2021
12 tasks
@vyasr vyasr mentioned this pull request Mar 9, 2021
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use config's signac_version to track schema version for easier migration.
2 participants