Skip to main content

Simple lightweight data-interchange format, written in Python

Project description

EVE

EVE is an lightweight data-interchange format.


Getting Started

These instructions will help you get started using EVE


Installing

You can install it with pip (https://pypi.org/project/evepy/)

pip install evepy

Another way is to clone the repo and import the python file (Eve.py) If none of them, you can also put the GitHub URL in your requirements.txt file (https://pip.pypa.io/en/stable/user_guide/#requirements-files)


Upgrading Version

You can upgrade Eve with the following pip command:

pip install evepy -U

Example use

Here are examples of how to use EVE

Example.eve

[
  @ Simple Stuff
  'String' :: 'Hello, World!'     @ A simple string : Hello, World
  'Int' :: 5                      @ A simple int    : 5
  'Float' :: 6.9                  @ A simple float  : 6.9
  'Bool' :: False                 @ A simple bool   : False
  'List' :: ('a', 1, False)       @ A simple list   : ['a', 1, False]

  @ Advanced Stuff
  {String.Upper}
  'Advanced_String' :: 'Hello, World!'      @ An advanced string    : HELLO, WORLD!
  {Math.Eval}
  'Advanced_Math' :: (5 + 2) * 3            @ Doing math            : 21
  {Math.Round}
  'Advanced_Float' :: 6.9                   @ Float rounding        : 7
  {Hash.MD5}
  'Advanced_Hashing' :: 'Hello, World!'     @ Hashing strings       : 65a8e27d8879283831b664bd8b7f0ad4
  {List.Lower}
  'Advanced_List' :: ('A', 'B', 'C')        @ Changing list values  : ['a', 'b', 'c']

  'Math_List' :: (10 + 10, (5 + 2) * 3)     @ Doing math in list    : [20, 21]

  @ And much more!
];

[
  @ Btw, you can have multiple sections.
  'IsGonnaUseEVE?' :: True
];

Example.py
import Eve

# Load a file :: load(path)
Data = Eve.Load ('Example.eve')

# Print variables (Prints: Hello, World!)
print (Result[0]['String'])

Parsing:

import Eve

Data = Eve.Parse (Eve.Load ('Test.eve'))

print (dir (Data))

"""
If the file only has 1 section, you can access variables like this:
print (Data.MyVar1)
print (Data.MyVar2)
print (Data.MyVar3)
"""

"""
If the file contaions more than one section, you'll need to access them like this:
print (Data.Section0.MyVar1)
print (Data.Section0.MyVar2)
print (Data.Section0.MyVar3)
print (Data.Section1.MyVar4)
"""

ATOM grammar syntax highlighting

You can find the syntax file which is named: EVE.cson


Methods

Load Method

The load method takes in a path to an eve file, and returns the content

Load (Path)

Loads Method

The loads method takes in EVE data and returns a dict of the content

Loads (Data)

Features

Variable Marking

The variable defining feature let's you control different variables

Supported definers:

  • String
    • Upper : Makes the string uppercase
    • Lower : Makes the string lowercase
  • Math
    • Eval : Calculates the variable value
    • Round : Rounds up a float to nearest 1
  • Hash
    • MD5 : Hashes the variable value with MD5
  • List
    • Upper : Makes all string values in the list uppercase
    • Lower : Makes all string values in the list lowercase

Examples:

[
  @ This here will always make the string uppercase (Return: 'MARTIN')
  {String.Upper}
  'Name' :: 'martin'

  @ This here will add the numbers (Return: 7)
  {Math.Eval}
  'Number' :: 5 + 2

  @ This will round up the float (Return: 7)
  {Math.Round}
  'Float' :: 6.7
];

Contribute

Feel free to make a pull request, so you can help create Eve! And also feel free to create Eve in other languages!

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

evepy-3.1.tar.gz (5.3 kB view details)

Uploaded Source

File details

Details for the file evepy-3.1.tar.gz.

File metadata

  • Download URL: evepy-3.1.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.16

File hashes

Hashes for evepy-3.1.tar.gz
Algorithm Hash digest
SHA256 d72f347a22d8c070576f537d3cf1c44d52c77e3be4d3e4312cfe3df768ce0e4b
MD5 3a58acd8e7b4613e835b8a9ebef86a62
BLAKE2b-256 060403a92321ba960b375a529698ac416fb68dad049baff271f18e261904884e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page