Package: paradigm
paradigmIn what followspythonis an alias forpython3.8orpypy3.8or any later version (python3.9,pypy3.9and so on).InstallationInstall the latestpip&setuptoolspackages versionspython-mpipinstall--upgradepipsetuptoolsUserDownload and install the latest stable version fromPyPIrepositorypython-mpipinstall--upgradeparadigmDeveloperDownload the latest version fromGitHubrepositorygitclonehttps://github.com/lycantropos/paradigm.gitcdparadigmInstall dependenciespython-mpipinstall-rrequirements.txtInstallpythonsetup.pyinstallUsageWith setup>>>importtyping>>>fromparadigm.baseimport(OptionalParameter,...ParameterKind,...PlainSignature,...RequiredParameter,...signature_from_callable)>>>fromtyping_extensionsimportSelf>>>classUpperOut:...def__init__(self,outfile:typing.IO[typing.AnyStr])->None:...self._outfile=outfile......defwrite(self,s:typing.AnyStr)->None:...self._outfile.write(s.upper())......def__getattr__(self,name:str)->typing.Any:...returngetattr(self._outfile,name)>>>deffunc(foo:int,bar:float,*,baz:bool=False,**kwargs:str)->None:...passwe can obtain a signature ofuser-defined functions>>>signature_from_callable(func)==PlainSignature(...RequiredParameter(annotation=int,...kind=ParameterKind.POSITIONAL_OR_KEYWORD,...name='foo'),...RequiredParameter(annotation=float,...kind=ParameterKind.POSITIONAL_OR_KEYWORD,...name='bar'),...OptionalParameter(annotation=bool,...default=False,...kind=ParameterKind.KEYWORD_ONLY,...name='baz'),...OptionalParameter(annotation=str,...kind=ParameterKind.VARIADIC_KEYWORD,...name='kwargs'),...returns=None...)Trueuser-defined classes>>>signature_from_callable(UpperOut)==PlainSignature(...RequiredParameter(annotation=typing.IO[typing.AnyStr],...kind=ParameterKind.POSITIONAL_OR_KEYWORD,...name='outfile'),...returns=Self...)Trueuser-defined classes methods>>>signature_from_callable(UpperOut.write)==PlainSignature(...RequiredParameter(annotation=typing.Any,...kind=ParameterKind.POSITIONAL_OR_KEYWORD,...name='self'),...RequiredParameter(annotation=typing.AnyStr,...kind=ParameterKind.POSITIONAL_OR_KEYWORD,...name='s'),...returns=None...)Truebuilt-in functions>>>signature_from_callable(any)==PlainSignature(...RequiredParameter(annotation=typing.Iterable[object],...kind=ParameterKind.POSITIONAL_ONLY,...name='__iterable'),...returns=bool...)Truebuilt-in classes>>>signature_from_callable(bool)==PlainSignature(...OptionalParameter(annotation=object,...kind=ParameterKind.POSITIONAL_ONLY,...name='__o'),...returns=Self...)Truebuilt-in classes methods>>>signature_from_callable(float.hex)==PlainSignature(...RequiredParameter(annotation=Self,...kind=ParameterKind.POSITIONAL_ONLY,...name='self'),...returns=str...)TrueDevelopmentBumping versionPreparationInstallbump2version.Pre-releaseChoose which version number category to bump followingsemver
specification.Test bumping versionbump2version--dry-run--verbose$CATEGORYwhere$CATEGORYis the target version number category name, possible
values arepatch/minor/major.Bump versionbump2version--verbose$CATEGORYThis will set version tomajor.minor.patch-alpha.ReleaseTest bumping versionbump2version--dry-run--verbosereleaseBump versionbump2version--verbosereleaseThis will set version tomajor.minor.patch.Running testsInstall dependenciespython-mpipinstall-rrequirements-tests.txtPlainSignaturepytestInsideDockercontainer:withCPythondocker-compose--filedocker-compose.cpython.ymlupwithPyPydocker-compose--filedocker-compose.pypy.ymlupBashscript (e.g. can be used inGithooks):withCPython./run-tests.shor./run-tests.shcpythonwithPyPy./run-tests.shpypyPowerShellscript (e.g. can be used inGithooks):withCPython.\run-tests.ps1or.\run-tests.ps1cpythonwithPyPy.\run-tests.ps1pypy