A tiny Configuration File Parser for Python Projects

Overview

configPy [ 🏗 Under Construction ]

A tiny Configuration File Parser for Python Projects. Currently Supports JSON files only.

Installation

Install the Latest Stable Build - v0.0.7-Testing Build

pip install configParsePy

Usage

Use configPy to get your configurations imported to your python code from JSON File.

Import the configPy object from configPy module.

from configPy import configPy 

JSONConfigParser - for JSON Configuration Files

Initiate the JSONConfigParser by passing the JSON config file. Use getConfigurations() method to get the Configuration. The getConfigurations() method returns the configurations as a Dictionary.

importedConfigs = configPy.JSONConfigParser(configFilePath="./sampleConfig.json").getConfigurations()

Use the configurations as a dict object.

print("Module Name: ", importedConfigs["module_name"])
print("Purpose: ", importedConfigs["purpose"])

The whole code for the above example can be found here.

Examples

Usage Samples can be found in the examples directory

Comments
  • Add CI/CD for automated deployment/publishing to PyPi

    Add CI/CD for automated deployment/publishing to PyPi

    Add CI/CD Capabilities for Auto-Testing and Auto-Deployment to PyPi.

    • [x] Auto unit-testing using GitHub Actions
    • [x] Auto Deployment/Publishing to PyPi
    • [x] Auto Increment versions for TestPyPi and PyPi using Python Script and GitHub Actions.
    • [x] #9
    documentation 
    opened by TanmoySG 5
  • Publish v0.0.1-Test Release

    Publish v0.0.1-Test Release

    Publish the first Ready-to-Use Build of configPy to PyPi for testing and name reservation.

    • [x] Build a testable build for Differential testing of configPy.
    • [x] Update Documentation
    • [x] List Publishing Documentation - How and Where.

    Use Separate Branch - pypi-publish branch for Publishing to PyPi.

    documentation 
    opened by TanmoySG 4
  • ConfigPy for JSON Configurations

    ConfigPy for JSON Configurations

    JSON Config File Parser for Python.

    Work on -

    • [x] Initializer Method/Object specific to JSON Files
    • [x] Read JSON File and Parse Objects.
    • [x] Return Config in dict format.
    • [x] #5
    • [x] #6

    Moved -

    • [x] #3
    • [x] #2

    to Separate Issues and Workflows.

    documentation enhancement feature 
    opened by TanmoySG 4
  • A Easy Version Bumping Tool

    A Easy Version Bumping Tool

    Create a Easy-to-use Version Bump-up Tool that can be Integrated into the CI/CD pipelines.

    The intent of the tool will be to -

    • [x] A easy to use CLI (kind of) tool that can help in Bumping the three level version system - X.Y.Z
    • [x] Keeps Test-PyPi and PyPi Publishing Versions separate and bumps the required one's version as per required
    • [x] Can be Integrated into CI/CD Pipelines such that Versions are Bumped up and package published for Bumped Versions and Repos in single targeted Commit Statement , like Bump and Publish v.
    • [x] Custom triggerable - from Actions Tab.
    documentation enhancement 
    opened by TanmoySG 3
  • Publish `configPy v0.1` to PyPi

    Publish `configPy v0.1` to PyPi

    • [x] Publish Current Code changes with support for json and ndjson and Test scripts to Test-PyPi
    • [x] Test Published Test-PyPi Package locally
    • [x] Publish tested Code to PyPi.
    documentation feature 
    opened by TanmoySG 2
  • Better Usability - Import Statement

    Better Usability - Import Statement

    There's a usability hurdle in importing the package.

    Currently we're using

    from configPy import configPy
    
    // Cannot import the JSONConfigParser() method
    
    confobj = configPy.JSONConfigParser(" ")
    

    Instead we should be doing

    from configPy import JSONConfigParser
    
    confobj = JSONConfigParser(" ")
    
    • [ ] Ensure better uability
    bug enhancement 
    opened by TanmoySG 2
  • `NDJSON` Key-JSON Mapping Feature

    `NDJSON` Key-JSON Mapping Feature

    • [x] Add Key to JSON Mapping feature that allows users to assign user-defined Keys to each JSON Object delimited by newline.

    Example -

    For a NDJSON like

    { "name" : "Raj", "age" : 15, "city" : "DEL" }
    { "name" : "Rohan", "age" : 25, "city" : "GOA" }
    { "name" : "Rahul", "age" : 35, "city" : "MUM" }
    

    User should be able to assign a key to each JSON object (each line) by passing an array like ["raj", "rohan", "rahul"]. It should return a dict object. Something like -

    map( ndjsonFile, ["raj", "rohan", "rahul"] ) 
    

    The above should return something like

    {
       "raj" : { "name" : "Raj", "age" : 15, "city" : "DEL" },
       "rohan" : { "name" : "Rohan", "age" : 25, "city" : "GOA" },
       "rahul" : { "name" : "Rahul", "age" : 35, "city" : "MUM" }, 
    }
    

    So that the user can use the config like

    rahulAge = mappedNDJSONobj["raj"]["age"]
    print(rahulAge)
    

    Use Cases

    1. In case when a project has different environments (eg: dev, prod, stage) in a single file, user can use the config using a dict object instead of an array.
    enhancement feature 
    opened by TanmoySG 1
  • Return `NDJSON` Configs as Dictionary instead of List [Patch Fix]

    Return `NDJSON` Configs as Dictionary instead of List [Patch Fix]

    Native NDJSONConfigParser returns lists or arrays, which can be accessed by its index number.

    { "name" : "Raj", "age" : 15, "city" : "DEL" }
    { "name" : "Rohan", "age" : 25, "city" : "GOA" }
    { "name" : "Rahul", "age" : 35, "city" : "MUM" }
    

    Returns -

    [
      [Index 0] { "name" : "Raj", "age" : 15, "city" : "DEL" } ,
      [Index 1] { "name" : "Rohan", "age" : 25, "city" : "GOA" } ,
      [Index 2] { "name" : "Rahul", "age" : 35, "city" : "MUM" }
    ]
    

    and using the Index in the List/Array

    ndjsonParsedObj[0]["name"] => "Raj"
    

    While the mappedKeys returns a dict. JSONConfigParser also returns a dictionary and not a list.

    It would be better to Unify the return type. Return map/dict with Number as Key. As -

    {
      0 :  { "name" : "Raj", "age" : 15, "city" : "DEL" } ,
      1 :  { "name" : "Rohan", "age" : 25, "city" : "GOA" } ,
      2 :  { "name" : "Rahul", "age" : 35, "city" : "MUM" }
    }
    

    The above can be used using the Index (Index Used as Key in Dict) -

    ndjsonParsedObj[0]["name"] => "Raj"
    
    enhancement 
    opened by TanmoySG 0
  • Merge `NDJSON-DEV` -> `main`

    Merge `NDJSON-DEV` -> `main`

    Add All Code changes for NDJSON Support to main.

    • [x] Merge ndjson-dev to main
    • [x] Sync NDJSON support and Test code with main
    • [x] Update CI/CD for ndjson
    • [x] Update Documentation
    enhancement feature 
    opened by TanmoySG 0
  • Test Scripts for `NDJSONConfigParser` for unit-testing

    Test Scripts for `NDJSONConfigParser` for unit-testing

    Test Scripts for Unit-Testing of NDJSONConfigParser for New-Line Delimited JSON Config Files.

    • [x] Add test cases - I/O
    • [x] Create Testing Script
    • [x] Add to Auto Testing on Push to main
    • [x] Integrate with all CI/CD Pipelines
    documentation testing 
    opened by TanmoySG 0
  • Extend support for new-line delimited JSON `ndjson`

    Extend support for new-line delimited JSON `ndjson`

    Refer ndjson.org for New-Line Delimited JSON.

    • [x] Add support for reading Config Files from NDJSON
    • [x] #11
    • [x] Test NDJSON-Support
    • [x] Documentation
    enhancement feature 
    opened by TanmoySG 0
  • [CSV] Add user-defined Type-Mapping

    [CSV] Add user-defined Type-Mapping

    Allow users for define type and map them over extracted/parsed CSV Data.

    mapType({ "key" : "type" })
    

    The defined "type" is mapped onto the value of the "key"

    enhancement feature 
    opened by TanmoySG 0
  • Add column-based key-mapping [Unique Column Value-based Key-mapping]

    Add column-based key-mapping [Unique Column Value-based Key-mapping]

    If there is any column in CSV having unique values, use those unique values as keys for each row, for identifying and using the Columns in CSV.

    [Add Description and Tasks]

    enhancement feature 
    opened by TanmoySG 0
  • `CSV` Support

    `CSV` Support

    Add CSV Support for using CSV based config files.

    • [x] Add Basic CSV Support
    • [x] Enhance Basic CSV Usage
    • [x] #15
    • [ ] #16
    • [ ] Enhance Usage [Add any features that comes while working]
    enhancement feature 
    opened by TanmoySG 0
  • Add CLI Capabilities

    Add CLI Capabilities

    Add CLI Capabilities for configPy.

    Some Features can be -

    • [ ] Ability to Set Environment Variables from Config Files at once using mass export command. Like export [ENVIRONMENT_VARIABLE]=[VALUE] that takes the variable and value from the config file's Key-Value Pair.
    • [ ] Add as Required (what else ?)
    enhancement feature 
    opened by TanmoySG 0
Owner
Tanmoy Sen Gupta
Software Engineer @ Optum (UHG)
Tanmoy Sen Gupta
A python script to convert an ucompressed Gnucash XML file to a text file for Ledger and hledger.

README 1 gnucash2ledger gnucash2ledger is a Python script based on the Github Gist by nonducor (nonducor/gcash2ledger.py). This Python script will tak

Thomas Freeman 0 Jan 28, 2022
Python package to read and display segregated file names present in a directory based on type of the file

tpyfilestructure Python package to read and display segregated file names present in a directory based on type of the file. Installation You can insta

Tharun Kumar T 2 Nov 28, 2021
File-manager - A basic file manager, written in Python

File Manager A basic file manager, written in Python. Installation Install Pytho

Samuel Ko 1 Feb 5, 2022
A simple Python code that takes input from a csv file and makes it into a vcf file.

Contacts-Maker A simple Python code that takes input from a csv file and makes it into a vcf file. Imagine a college or a large community where each y

null 1 Feb 13, 2022
Nintendo Game Boy music assembly files parser into musicxml format

GBMusicParser Nintendo Game Boy music assembly files parser into musicxml format This python code will get an file.asm from the disassembly of a Game

null 1 Dec 11, 2021
gitfs is a FUSE file system that fully integrates with git - Version controlled file system

gitfs is a FUSE file system that fully integrates with git. You can mount a remote repository's branch locally, and any subsequent changes made to the files will be automatically committed to the remote.

Presslabs 2.3k Jan 8, 2023
This is a file deletion program that asks you for an extension of a file (.mp3, .pdf, .docx, etc.) to delete all of the files in a dir that have that extension.

FileBulk This is a file deletion program that asks you for an extension of a file (.mp3, .pdf, .docx, etc.) to delete all of the files in a dir that h

Enoc Mena 1 Jun 26, 2022
Search for files under the specified directory. Extract the file name and file path and import them as data.

Search for files under the specified directory. Extract the file name and file path and import them as data. Based on that, search for the file, select it and open it.

G-jon FujiYama 2 Jan 10, 2022
Small-File-Explorer - I coded a small file explorer with several options

Petit explorateur de fichier / Small file explorer Pour la première option (création de répertoire) / For the first option (creation of a directory) e

Xerox 1 Jan 3, 2022
Pti-file-format - Reverse engineering the Polyend Tracker instrument file format

pti-file-format Reverse engineering the Polyend Tracker instrument file format.

Jaap Roes 14 Dec 30, 2022
Generates a clean .txt file of contents of a 3 lined csv file

Generates a clean .txt file of contents of a 3 lined csv file. File contents is the .gml file of some function which stores the contents of the csv as a map.

Alex Eckardt 1 Jan 9, 2022
PaddingZip - a tool that you can craft a zip file that contains the padding characters between the file content.

PaddingZip - a tool that you can craft a zip file that contains the padding characters between the file content.

phithon 53 Nov 7, 2022
Extract longest transcript or longest CDS transcript from GTF annotation file or gencode transcripts fasta file.

Extract longest transcript or longest CDS transcript from GTF annotation file or gencode transcripts fasta file.

laojunjun 13 Nov 23, 2022
Two scripts help you to convert csv file to md file by template

Two scripts help you to convert csv file to md file by template. One help you generate multiple md files with different filenames from the first colume of csv file. Another can generate one md file with several blocks.

null 2 Oct 15, 2022
Python Fstab Generator is a small Python script to write and generate /etc/fstab files based on yaml file on Unix-like systems.

PyFstab Generator PyFstab Generator is a small Python script to write and generate /etc/fstab files based on yaml file on Unix-like systems. NOTE : Th

Mahdi 2 Nov 9, 2021
An object-oriented approach to Python file/directory operations.

Unipath An object-oriented approach to file/directory operations Version: 1.1 Home page: https://github.com/mikeorr/Unipath Docs: https://github.com/m

Mike Orr 506 Dec 29, 2022
A platform independent file lock for Python

py-filelock This package contains a single module, which implements a platform independent file lock in Python, which provides a simple way of inter-p

Benedikt Schmitt 497 Jan 5, 2023
Simple Python File Manager

This script lets you automatically relocate files based on their extensions. Very useful from the downloads folder !

Aimé Risson 22 Dec 27, 2022
Python function to stream unzip all the files in a ZIP archive: without loading the entire ZIP file or any of its files into memory at once

Python function to stream unzip all the files in a ZIP archive: without loading the entire ZIP file or any of its files into memory at once

Department for International Trade 206 Jan 2, 2023