Package: topo
topoIn what followspythonis an alias forpython3.5or any later
version (python3.6and so on),pypyis an alias forpypy3.5or any later
version (pypy3.6and so on).InstallationInstall the latestpip&setuptoolspackages versions:withCPythonpython-mpipinstall--upgradepipsetuptoolswithPyPypypy-mpipinstall--upgradepipsetuptoolsUserDownload and install the latest stable version fromPyPIrepository:withCPythonpython-mpipinstall--upgradetopowithPyPypypy-mpipinstall--upgradetopoDeveloperDownload the latest version fromGitHubrepositorygitclonehttps://github.com/lycantropos/topo.gitcdtopoInstall:withCPythonpythonsetup.pyinstallwithPyPypypysetup.pyinstallUsagetopoprovideshashable,partially ordered by<=("is subset of") and>=("is superset of") relations,strictly ordered by<("is strict subset of") and>("is strict superset of") relationsmodels & objects:EMPTY_SET: for set with no elements>>>fromtopo.baseimportEMPTY_SET>>>EMPTY_SETEmptySet()>>>str(EMPTY_SET)'{}'>>>EMPTY_SET<=EMPTY_SETTrue>>>EMPTY_SET<EMPTY_SETFalse>>>1inEMPTY_SETFalse# and so on for every objectDiscreteSet: for discrete sets of hashable objects
(similar to built-insets)>>>fromtopo.discreteimportDiscreteSet>>>binary_set=DiscreteSet(0,1)>>>binary_setDiscreteSet(0,1)>>>str(binary_set)'{0, 1}'>>>EMPTY_SET<=binary_setTrue>>>binary_set<EMPTY_SETFalse>>>0inbinary_setTrue>>>10inbinary_setFalseInterval: for intervals of floating point numbers>>>fromtopo.continuousimportInterval>>>unit_segment=Interval(0,1)>>>unit_segmentInterval(0,1,left_end_inclusive=True,right_end_inclusive=True)>>>str(unit_segment)'[0, 1]'>>>binary_set<=unit_segmentTrue>>>unit_segment<binary_setFalse>>>0.5inunit_segmentTrue>>>10inunit_segmentFalsewith next operators overloaded:|: for sets union>>>unit_segment|binary_setInterval(0,1,left_end_inclusive=True,right_end_inclusive=True)sinceunit_segmentcontainsbinary_setelements.-: for sets difference>>>unit_segment-binary_setInterval(0,1,left_end_inclusive=False,right_end_inclusive=False)as we can see both ends were excluded.&: for sets intersection>>>unit_segment&binary_setDiscreteSet(0,1)Also used in conditionals sets will evaluate toFalseif they are considered empty andTrueotherwise:>>>ifnotEMPTY_SET:print('Hello World!')else:print('Something went wrong.')HelloWorld!DevelopmentBumping 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--verbose--tagreleaseBump versionbump2version--verbose--tagreleaseThis will set version tomajor.minor.patchand addGittag.NotesTo avoid inconsistency between branches and pull requests,
bumping version should be merged intomasterbranch as separate pull
request.Running testsPlain:withCPythonpythonsetup.pytestwithPyPypypysetup.pytestInsideDockercontainer: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