Automatically check for semver compliance based on type hints
Project description
Judgement as a Service.
Typejudge will automatically check for semver compliance based on type hints. If the type signature for a function changes, it will judge this to be an API change and recommend a major version bump.
Installation
Note: typejudge only works on python 3.5 and higher.
$ pip install typejudge
Usage
$ typejudge –help usage: typejudge [-h] [-o OUT] [-f FILE] MODULE [VERSION]
judge your types
- positional arguments:
MODULE module to import and check VERSION current version of the package
- optional arguments:
- -h, --help
show this help message and exit
- -o OUT, --out OUT
save current type definitions to this file
- -f FILE, --file FILE
load type definitions from this file
Example usage
Suppose we’ve got a module that contains some type annotations on the publicly exported API, testmodule.py:
def greeting(name: str) -> str: return 'Hello ' + name
Save the types somewhere:
$ typejudge -o testmodule.json testmodule
Make some small change to testmodule.py, add a new function:
def greeting2(name: str, name2: str) -> str: return 'Hello ' + name + ' and ' name2
Typejudge will recommend this is a minor release:
$ typejudge -f testmodule.json testmodule minor
The same, but with a known current version number:
$ typejudge -f testmodule.json testmodule 0.3.2 0.4.0
Make a change to existing type signatures:
from typing import List def greeting(names: List[str]) -> str: return 'Hello ' + ' '.join(names)
Typejudge will now recommend this is a major release:
$ typejudge -f testmodule.json testmodule major
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file typejudge-0.1.1.tar.gz
.
File metadata
- Download URL: typejudge-0.1.1.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6fb2464f6b6bb37c1d54a82e6c2ae27332ce9eed186da8c57cf4b14e6a80e778 |
|
MD5 | 1a7e114ca5b0cffd46799baa382ed868 |
|
BLAKE2b-256 | bff30c254b3302d585ca201fbb244bd532256c6a2fc01c24f54821010552ad71 |