Package: pycommons
pycommons: Common Utility Functions for Python Projects.Some common utility functionality for Python projects.IntroductionInstallationExamplesLicenseContact1. IntroductionIn this project, we combine several utilities and functions that are used in our other projects.These functions have in common that they are fail-fast.
They usually check the types of all of their inputs and raise exceptions immediately if something looks dodgy.
There is no garbage-in/garbage-out:
Our functions raise descriptive errors as soon as they detect something strange.2. InstallationIn order to use this package, you need to first install it usingpipor some other tool that can install packages fromPyPi.
You can install the newest version of this library fromPyPiusingpipby doingpipinstallpycommonsThis will install the latest official release of our package as well asall dependencies.
If you want to install the latest source code version from GitHub (which may not yet be officially released), you can dopipinstallgit+https://github.com/thomasWeise/pycommons.gitIf you want to install the latest source code version from GitHub (which may not yet be officially released) and you have set up a private/public key for GitHub, you can also do:gitclonessh://git@github.com/thomasWeise/pycommons
pipinstallpycommonsThis may sometimes work better if you are having trouble reaching GitHub viahttpsorhttp.You can also clone the repository and then run amakebuild, which will automatically install all dependencies, run all the tests, and then install the package on your system, too.
This will work only on Linux, though.
It also installs thedependencies for building, which include, e.g., those for unit testing and static analysis.
If this build completes successful, you can be sure thatpycommonswill work properly on your machine.All dependencies for using and runningpycommonsare listed athere.
The additional dependencies for afullmakebuild, including unit tests, static analysis, and the generation of documentation are listedhere.3. Examples3.1. Data Structuresfrompycommons.ds.cacheimportstr_is_newcache=str_is_new()print(cache("1"))print(cache("2"))print(cache("1"))print(cache("3"))print(cache("2"))printsTrue,True,False,True, andFalse.frompycommons.ds.immutable_mapimportimmutable_mappingimap=immutable_mapping({1:2,3:4})try:imap[1]=3exceptTypeErroraste:print(te)print(imap[1])prints'mappingproxy' object does not support item assignmentand2.4. Licensepycommonsis a library with utilities for Python projects.Copyright (C) 2024Thomas Weise(汤卫思教授)Dr. Thomas Weise (seeContact) holds the copyright of this package.pycommonsis provided to the public as open source software under theGNU GENERAL PUBLIC LICENSE, Version 3, 29 June 2007.
Terms for other licenses, e.g., for specific industrial applications, can be negotiated with Dr. Thomas Weise (who can be reached via thecontact informationbelow).This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program.
If not, seehttps://www.gnu.org/licenses/.Please visit thecontributions guidelinesforpycommonsif you would like to contribute to our package.
If you have any concerns regarding security, please visit oursecurity policy.5. ContactIf you have any questions or suggestions, please contact
Prof. Dr.Thomas Weise(汤卫思教授) of the
Institute of Applied Optimization (应用优化研究所,IAO) of the
School of Artificial Intelligence and Big Data (人工智能与大数据学院) atHefei University(合肥大学) in
Hefei, Anhui, China (中国安徽省合肥市) via
email totweise@hfuu.edu.cnwith CC totweise@ustc.edu.cn.