lidatong / dataclasses-json

Easily serialize Data Classes to and from JSON
MIT License
1.34k stars 151 forks source link

feat: Implement dymamic versioning #454

Closed s-vitaliy closed 11 months ago

s-vitaliy commented 11 months ago

Resolves #446

Implemented

The plugin generates version based on git tags:

$ poetry build
Building dataclasses-json (0.5.14.post3.dev0+ebe887f)
  - Building sdist
  - Built dataclasses_json-0.5.14.post3.dev0+ebe887f.tar.gz
  - Building wheel
  - Built dataclasses_json-0.5.14.post3.dev0+ebe887f-py3-none-any.whl

Where 0.5.14 is the latest git tag, post3 - number of commits ahead of the tag and +ebe887f is git commit SHA.

The dev0 section added if the lates commit in HEAD is not the release tag.

For instance, if we will create new release tag locally, the plugin will build the following version:

$ git tag "v0.5.15"
$ poetry build
Building dataclasses-json (0.5.15)
  - Building sdist
  - Built dataclasses_json-0.5.15.tar.gz
  - Building wheel
  - Built dataclasses_json-0.5.15-py3-none-any.whl
github-actions[bot] commented 11 months ago

Coverage

Coverage Report
FileStmtsMissCoverMissing
dataclasses_json
   cfg.py51492%80, 84–86
   core.py2351096%38–41, 51, 64, 66, 81, 83, 169, 197
   mm.py2003085%33–36, 42–45, 53–56, 62–65, 88, 161–162, 167, 171, 175, 180, 184, 188, 196, 202, 207, 216, 221, 226, 235, 244–251
   stringcase.py25388%59, 76, 97
   undefined.py143299%24, 38
   utils.py1283672%11–24, 44–49, 60–64, 74, 99–100, 108–109, 124–132, 158, 177, 202
tests
   entities.py220299%229, 235
   test_annotations.py814248%50–67, 78–102, 106–122
   test_api.py142497%88, 99, 139–140
   test_str_subclass.py22195%9
   test_union.py981090%87–94, 108–115
TOTAL247614494% 

Tests Skipped Failures Errors Time
291 3 :zzz: 0 :x: 0 :fire: 6.852s :stopwatch:
s-vitaliy commented 11 months ago

@george-zubrienko, take a look. I think we can adopt this plugin in SneaksAndData and use it to build development versions of our python packages as we do for our dotnet packages.

s-vitaliy commented 11 months ago

@baldurmen, take a look at examples in the PR description, does it solve your issue?

baldurmen commented 11 months ago

It does, thank you.

george-zubrienko commented 11 months ago

Huge! :) thanks a lot both @baldurmen and @s-vitaliy