Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

property

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

property

A python module to load property files. Recursively define properties, load from env.

  • 2.6.2
  • PyPI
  • Socket score

Maintainers
1

pythonpropertyfileloader

Downloads Build Coverage Badge

A python module to load property files

  • Load multiple property files
  • Recursively define properties (Similar to PropertyPlaceholderConfigurer) in spring which lets you use ${variable-reference} to refer to already defined property)
  • Placeholders are also resolved using env variables, like the spring property loader does, if the class is instantiated with the use_env argument (defaults to false for backward compatibility)

Install

Available on PyPI

pip install property

Example

my_file.properties

foo = I am awesome
bar = ${chocolate}-bar
chocolate = fudge
long = a very long property that is described in the property file which takes up \
multiple lines can be defined by the escape character as it is done here
url=example.com/api?auth_token=xyz
user_dir=${HOME}/test
unresolved = ${HOME}/files/${id}/${bar}/
fname_template = /opt/myapp/{arch}/ext/{objid}.dat

Code

from properties.p import Property


## set use_env to evaluate properties from shell / os environment
prop = Property(use_env = True)
dic_prop = prop.load_property_files('my_file.properties')

## Read multiple files
## dic_prop = prop.load_property_files('file1', 'file2')


print(dic_prop)

# Output

# {'foo': 'I am awesome', 'bar': 'fudge-bar', 'chocolate': 'fudge',
#  'long': 'a very long property that is described in the property file which takes up multiple lines
#  can be defined by the escape character as it is done here', 'url': 'example.com/api?auth_token=xyz',
#  'user_dir': '/home/user/test',
#  'unresolved': '/home/user/files/${id}/fudge-bar/',
#  'fname_template': '/opt/myapp/{arch}/ext/{objid}.dat'}

Develop

git clone https://github.com/anandjoshi91/pythonpropertyfileloader.git
cd pythonpropertyfileloader

## make your changes and open a PR - https://github.com/anandjoshi91/pythonpropertyfileloader/pulls
## Ensure all tests pass

## Check Dependencies
pip install pipreqs
pipreqs .

## Test
pip install pytest
pytest

## Publish to PyPi
pip install twine

update setup.py
python setup.py sdist bdist_wheel
twine check dist/*
twine upload dist/*

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc