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

lienv

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lienv

A tool to easily get typed values out of strings stored in environment variables.

  • 0.5.0
  • PyPI
  • Socket score

Maintainers
1

LiEnv: A simple yet useful library

CI PyPi Latest Release

LiEnv is a tool to easily get typed values out of strings stored in environment variables.

  • Simplifies the sometimes tedious task of parsing strings to typed variables
  • Provides a way to do it uniformly througout the project
  • Aims to prevent unwanted behaviour caused by typos, errors or malicious content in environment variables

Currently supported Python types:

  • Integers and Floats
  • Dicts
  • Lists
  • Tuples
  • Booleans

Example

>>> import lienv
>>> integer = lienv.get(int, "SOME_INTEGER") # SOME_INTEGER="42"
>>> decimal = lienv.get(float, "SOME_FLOAT") # SOME_FLOAT="2.4"
>>> dictionary = lienv.get(dict, "SOME_DICT") # SOME_DICT="{'lienv': 42}"

>>> print(f"{integer} => {type(integer)}")
42 => <class 'int'>

>>> print(f"{decimal} => {type(decimal)}")
2.4 => <class 'float'>

>>> print(f"{dictionary} => {type(dictionary)}")
{'lienv': 42} => <class 'dict'>

Setup

Install the latest version with:

pip install lienv

TODO

  • Parse types without directly using python's eval
  • Implement unit tests in Rust
  • Figure out how to test the Python module
  • Change default integers and floats to 32 bit based on architecture
  • Add wrappers for unsigned integer parsing
  • Add wrappers for 8 and 16 bit numbers

Contributing

I'll gladly accept feedback and contributions.

Although this project's purpose was to solve problems that at first seemed too simple, the practicality it provided to me was motivation enough to turn it into a library so maybe more people could benefit from it.

I am yet to be proficient in Rust, so pardon my silly mistakes.

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