Plai 
Plai is a domain specific programming language(DSL) to create data manipulation pipelines with focus on data treatment, validation and easier syntax. It uses pandas as data manipulation engine so it is meant to work with small data.
Examples
Example of pipeline with basic data manipulation using Plai:
df = read_file('issues.csv')
pipeline(df) as 'gh_pct_issues_by_language.csv':
$.groupby(.name, as_index=False).sum()
(.count/.count.sum()) * 100 as pct
{.name, .count, .pct}
To create validations for the dataframes being manipulated you can define dictionaries mapping each column to a specific type, and apply that to a dataframe or pipeline. When applied to the dataframe it will validate its schema accordingly to the defined on the dictionary, that is, it will check data type and column presence. For the pipeline, the result dataframe will be validated. The following snippet is an example of implementation:
input_type = {
'name': 'str',
'year': 'int',
'quarter': 'int',
'count': 'int'
}
output_type = {
'name': 'str',
'count': 'int',
'pct': 'float'
}
input_type::df = read_file('issues.csv')
output_type::pipeline(df) as 'gh_pct_issues_by_language.csv':
$.groupby(.name, as_index=False).sum()
(.count/.count.sum()) * 100 as pct
{.name, .count, .pct}
Development
- Install the dependencies by running the command on the root folder of the project:
pip install -r requirements-dev.txt
- To run all the tests execute:
pytest tests
To run a specific test execute:
# For a specific test file
pytest tests/test_grammar.py
# For a specific test class
pytest tests/test_grammar.py::TestBasicTokens
# For a specific tests method
pytest tests/test_grammar.py::TestBasicTokens::test_token_number
- To run the interactive terminal execute on the root folder:
python -m plai
- To execute the code from a file:
python -m plai file.plai
Metadata
Release files for plai 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| plai-0.1.tar.gz | 15.0 kB | Without provenance | Details for plai-0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| plai-0.1-py3-none-any.whl | Python 3 | none | any | Details for plai-0.1-py3-none-any.whl |
Total release size: 33.5 kB
Release files / plai-0.1.tar.gz
| Download URL | plai-0.1.tar.gz |
|---|---|
| Size | 15.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
825541da7fb91badc09ab9fa76974bae51e265fe2019aac4afcfb2b5f61c0618
|
|
BLAKE2b-256 checksum How to use checksums |
58753e6a19ae86894bcf353d64c5a20713753f04dc9f41f75a44142c09b6df88
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2
|
Release files / plai-0.1-py3-none-any.whl
| Download URL | plai-0.1-py3-none-any.whl |
|---|---|
| Size | 18.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1b5797246900feb72a8d9d3df241b02c449450d6c52b2caa16615c541a000f8e
|
|
BLAKE2b-256 checksum How to use checksums |
3f1c724d64a64fbc86d64284c0b1ead829e120dc8948d60fe0b9fd916c84b00e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2
|
Security for plai 0.1
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.