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 Version checks to all relevant models. #180

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

evetion
Copy link
Member

@evetion evetion commented Dec 10, 2021

And lowered bounds of default versions.
Fixes #94.

@evetion
Copy link
Member Author

evetion commented Dec 10, 2021

@arthurvd Downside to this work is that we now write the lower bound version number to files.

@sonarcloud
Copy link

sonarcloud bot commented Dec 10, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

89.8% 89.8% Coverage
0.0% 0.0% Duplication

Copy link
Member

@arthurvd arthurvd left a comment

Choose a reason for hiding this comment

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

Hey @evetion , I've added some comments, but I am in doubt about whether we should squeeze this into the 0.1.6 release, as I think it deserves some further thinking.
Writing "1.09" FM-style version as `FMVersion("1.9.0") is pretty confusing. Maybe we should consider constructors using major, minor as indifvidual arguments.

Anyways, food for thought.

@@ -69,3 +72,55 @@ def get_substring_between(source: str, start: str, end: str) -> Optional[str]:
return None

return source[index_start:index_end]


class HVersion(SemVer):
Copy link
Member

Choose a reason for hiding this comment

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

Docstrings for the purpose of these classes HVersion, etc., and subroutines such as coerce() would help understanding a lot.

return cls(**version.__dict__)


class FMVersion(HVersion):
Copy link
Member

Choose a reason for hiding this comment

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

I don't quite like this FM-related class here, inside a "neutral" utils namespace.
Also it suggest that this is "the" FM version, whereas it is only the numbering schema, so consider renaming this class to: class FMStyleVersion, or DHydroStyleVersion, or ZeroPrefixedVersion.



class General(INIGeneral):
_header: Literal["General"] = "General"
program: str = Field("D-Flow FM", alias="program")
version: str = Field("1.2.94.66079M", alias="version")
filetype: Literal["modelDef"] = Field("modelDef", alias="fileType")
fileversion: str = Field("1.09", alias="fileVersion")
fileversion: FMVersion = Field(FMVersion("1.9.0"), alias="fileVersion")
Copy link
Member

Choose a reason for hiding this comment

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

I understand the attempt, yet I find it reads quite confusing.

@evetion
Copy link
Member Author

evetion commented Dec 13, 2021

but I am in doubt about whether we should squeeze this into the 0.1.6 release, as I think it deserves some further thinking.

Agreed, while most of the comments can be easily resolved, it's most about the lower/upper bound discussion (what do we write as version) that needs some thought.

@evetion evetion added this to the 0.1.7 milestone Dec 13, 2021
@evetion evetion marked this pull request as draft December 14, 2021 08:32
@arthurvd arthurvd modified the milestones: 0.2.1, Release 0.3 Feb 1, 2022
@arthurvd arthurvd modified the milestones: Release 0.3, Release 0.4 Jun 27, 2022
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

Successfully merging this pull request may close these issues.

Check fileVersion numbers and define which version(s) we support
2 participants