cfg
A small package for access various types of configuration files, e.g. MySQL's my.cnf or other "ini" style configration. Wraps Python 3's standard configparser
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (15.9%) to scientific vocabulary
Repository
A small package for access various types of configuration files, e.g. MySQL's my.cnf or other "ini" style configration. Wraps Python 3's standard configparser
Basic Info
- Host: GitHub
- Owner: caltechlibrary
- License: other
- Language: Python
- Default Branch: main
- Size: 56.6 KB
Statistics
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
cfg
A small package for access various types of configuration files, e.g. MySQL's my.cnf or other "ini" style configration. Wraps Python 3's standard configparser.
Table of contents
- Introduction
- Installation
- Usage
- Known issues and limitations
- Getting help
- Contributing
- License
- Authors and history
- Acknowledgments
Introduction
This is a small simple configuration file utlity that wrap's Python 3's own configparser. Support initialization files are assumed to be in "ini" format and are associated with a support system like MySQL. Each support configuration file provides two functions, FindConfig() and ParseConfig(). FindConfig checks a series of path location for configuration and returns the first one found or None if no config file is discovered. ParseConfig takes the path from FindConfig and any additional optional parameters associated with the resource (e.g. a database name in MySQL) and returns a dictionary of key/value parse.
Installation
Requires: Git, Python 3.8 and pip. The cfg package is installable with Python 3 setup.py.
git clone git@github.com:caltechlibrary/cfg
cd cfg
python3 -m pip install --user -r requirements.txt
python3 setup.py install --user
Usage
Once installed this Python 3 package can be included using
the standard from cfg.SYSTEM_INI import ... pattern. Here's an example
of installing it to return a configuration needed for a MySQL
connection.
``` import sys from cfg.mysql import FindConfig, ParseConfig
mycnf = FindConfig() if mycnf == None: print('Can't find my.cnf') sys.exit(1) conf = ParseConfig(mycnf, database = 'mydb') if conf == None: print(f'''Can't parse {mycnf}''') sys.exit(1) ```
Known issues and limitations
Currently supports MySQL conf files first searching in the current directory for a "my.cnf" file or the user's home directory for ".my.cnf". Assumes a Unix style file system (using path separate and dot prefix). Does not current support looking for other types of configuration files.
Getting help
File an issues on GitHub, see https://github.com/caltechlibrary/cfg/issues
Contributing
This section is optional; if your repository is for a project that accepts open-source contributions, then this section is where you can mention how people can offer contributions, and point them to your guidelines for contributing. (If you delete this section, don't forget to remove the corresponding entry in the Table of Contents too.)
License
Software produced by the Caltech Library is Copyright © 2021 California Institute of Technology. This software is freely distributed under a BSD/MIT type license. Please see the LICENSE file for more information.
Authors and history
- R. S. Doiel
Acknowledgments
This work was funded by the California Institute of Technology Library.
(If this work was also supported by other organizations, acknowledge them here. In addition, if your work relies on software libraries, or was inspired by looking at other work, it is appropriate to acknowledge this intellectual debt too.)
Owner
- Name: Caltech Library
- Login: caltechlibrary
- Kind: organization
- Email: helpdesk@library.caltech.edu
- Location: Pasadena, CA 91125
- Website: https://www.library.caltech.edu/
- Repositories: 84
- Profile: https://github.com/caltechlibrary
We manage the physical and digital holdings of the California Institute of Technology, provide services and training, and develop open-source software.
CodeMeta (codemeta.json)
{
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
"@type": "SoftwareSourceCode",
"description": "cfg, a small configuration handler",
"name": "cfg",
"codeRepository": "https://github.com/caltechlibrary/cfg",
"issueTracker": "https://github.com/caltechlibrary/cfg/issues",
"license": "https://github.com/caltechlibrary/cfg/blob/master/LICENSE",
"version": "0.0.5",
"author": [
{
"@type": "Person",
"givenName": "FIRSTNAME",
"familyName": "LASTNAME",
"affiliation": "California Institute of Technology Library",
"email": "EMAIL",
"@id": "https://orcid.org/0000-0003-0900-6903"
}
],
"developmentStatus": "active",
"downloadUrl": "https://github.com/caltechlibrary/cfg/archive/main.zip",
"keywords": [
"software",
"python3",
"configuration"
],
"maintainer": "https://orcid.org/0000-0003-0900-6903"
}
GitHub Events
Total
Last Year
Issues and Pull Requests
Last synced: about 1 year ago
All Time
- Total issues: 0
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0