Skip to main content

My Personal Configuration System for Python MPCSPY

I like to use Python as a configuration file. I have added some security features using AST module to prevent injecting malicious code to config files.

Requirements

  • Python >= 3.6 (fstrings)

Install

PyPI

pip3 install mpcspy

Source

git clone https://github.com/goktug97/mpcspy
cd mpcspy
python3 setup.py install

Example

  • Config File
#!/usr/bin/env python3

import dataclasses
import numpy as np

@dataclasses.dataclass
class Robot(object):
    width: float = 1.2 # [m]
    height: float = 0.5 # [m]
    max_angular_velocity: float = np.radians(40.0) # [rad/s]
  • Reading Config
import mpcspy
config = mpcspy.read_config(config_file = 'config',
        allowed_modules={'numpy': ['radians'],
            'dataclasses': ['dataclass']},
        allowed_functions=[],
        verbose=True)
print(config.Robot.width)
print(config.Robot.height)
print(config.Robot.max_angular_velocity)
  • Config File
#!/usr/bin/env python3

from os import path

dataset_path = path.join('./data/')
  • Reading Config
import mpcspy
config = mpcspy.read_config(config_file = 'config',
        allowed_modules={'os': ['path'],
            'path': ['join']},
        allowed_functions=[],
        verbose=True)

Metadata

Release files for mpcspy 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mpcspy 0.0.5
File Size Uploaded Provenance Actions
mpcspy-0.0.5.tar.gz 3.3 kB Without provenance Details for mpcspy-0.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mpcspy 0.0.5
File Interpreter ABI Platform Actions
mpcspy-0.0.5-py3.8.egg Legacy Egg format - - Details for mpcspy-0.0.5-py3.8.egg

Total release size: 9.0 kB

Release files / mpcspy-0.0.5.tar.gz

Download URL mpcspy-0.0.5.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3ade4d432346561eb0ecbd83522071b86d0528964fa19cf14ff6168b17a77665
BLAKE2b-256 checksum
How to use checksums
f6f461e17570fbbb5582c7bdfe30236657629bd3d1560dece4c81da854588a6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.4.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Release files / mpcspy-0.0.5-py3.8.egg

Download URL mpcspy-0.0.5-py3.8.egg
Size 5.7 kB
Tags Egg
SHA-256 checksum
How to use checksums
5930109bbccee7e00cf42de147a550a56ce5adbd901ebd930b92289293048fb7
BLAKE2b-256 checksum
How to use checksums
414757e0ef241c292e6ea36dd56eb05de97119541a7e12d2b52c73b302041c04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.4.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Security for mpcspy 0.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page