A package with utility functionality for Python projects.
Project description
pycommons: Common Utility Functions for Python Projects.
Some common utility functionality for Python projects.
1. Introduction
In 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. Installation
In order to use this package, you need to first install it using pip
or some other tool that can install packages from PyPi.
You can install the newest version of this library from PyPi using pip
by doing
pip install pycommons
This will install the latest official release of our package as well as all dependencies. If you want to install the latest source code version from GitHub (which may not yet be officially released), you can do
pip install git+https://github.com/thomasWeise/pycommons.git
If 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:
git clone ssh://git@github.com/thomasWeise/pycommons
pip install pycommons
This may sometimes work better if you are having trouble reaching GitHub via https
or http
.
You can also clone the repository and then run a build script, 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.
If this build completes successful, you can be sure that pycommons
will work properly on your machine.
All dependencies for using and running pycommons
are listed at here.
3. Examples
3.1. Data Structures
from pycommons.ds.cache import str_is_new
cache = str_is_new()
print(cache("1"))
print(cache("2"))
print(cache("1"))
print(cache("3"))
print(cache("2"))
prints True
, True
, False
, True
, and False
.
from pycommons.ds.immutable_map import immutable_mapping
imap = immutable_mapping({1: 2, 3: 4})
try:
imap[1] = 3
except TypeError as te:
print(te)
print(imap[1])
prints 'mappingproxy' object does not support item assignment
and 2
.
4. License
pycommons
is a library with utilities for Python projects.
Copyright (C) 2024 Thomas Weise (汤卫思教授)
Dr. Thomas Weise (see Contact) holds the copyright of this package.
pycommons
is provided to the public as open source software under the GNU 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 the contact information below).
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, see https://www.gnu.org/licenses/.
Please visit the contributions guidelines for pycommons
if you would like to contribute to our package.
If you have any concerns regarding security, please visit our security policy.
5. Contact
If 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 (人工智能与大数据学院) at Hefei University (合肥大学) in Hefei, Anhui, China (中国安徽省合肥市) via email to tweise@hfuu.edu.cn with CC to tweise@ustc.edu.cn.
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
Built Distribution
File details
Details for the file pycommons-0.8.58.tar.gz
.
File metadata
- Download URL: pycommons-0.8.58.tar.gz
- Upload date:
- Size: 134.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce19bbd49e6563e7954b9a50bd45bef94db6f1905cac4eb986725ff2bd3b19e8 |
|
MD5 | b52123e9967ff25270e1479b721fff64 |
|
BLAKE2b-256 | 0e71f232a1e04748d1dcc6a4931caec8977d028e9bb635d11250e4287c601619 |
Provenance
The following attestation bundles were made for pycommons-0.8.58.tar.gz
:
Publisher:
release.yml
on thomasWeise/pycommons
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
pycommons-0.8.58.tar.gz
- Subject digest:
ce19bbd49e6563e7954b9a50bd45bef94db6f1905cac4eb986725ff2bd3b19e8
- Sigstore transparency entry: 149036078
- Sigstore integration time:
- Predicate type:
File details
Details for the file pycommons-0.8.58-py3-none-any.whl
.
File metadata
- Download URL: pycommons-0.8.58-py3-none-any.whl
- Upload date:
- Size: 148.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e12ca7a426f5308269e682c03dae13c266b4896533db7d8f5d1137af48914cbf |
|
MD5 | 0cce4e1d562d1ff405f7bfba529f7706 |
|
BLAKE2b-256 | 2a53b41a555319faa6f64d3ef794e6e4102f10d8b65030106c44551dcd65484e |
Provenance
The following attestation bundles were made for pycommons-0.8.58-py3-none-any.whl
:
Publisher:
release.yml
on thomasWeise/pycommons
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
pycommons-0.8.58-py3-none-any.whl
- Subject digest:
e12ca7a426f5308269e682c03dae13c266b4896533db7d8f5d1137af48914cbf
- Sigstore transparency entry: 149036080
- Sigstore integration time:
- Predicate type: