A tiny python library that links against libcogito.
>>> import cogito
>>> print cogito.to_json('ALLOW a on b;')
[
{
"Effect": "Allow",
"Action": [
"a"
],
"Resource": [
"b"
]
}
]
>>> print cogito.to_iam('[{ "Effect": "Allow", "Action": "a", "Resource": "b" }]')
ALLOW
a
ON
b;
If your libcogito
library is in a non-standard location, you should set the COGITO_PATH
environment variable before you import the cogito
module.
import os
os.environ['COGITO_PATH'] = os.path.join(os.getcwd(), 'local', 'lib', 'libcogito.so')
import cogito
To run tests, run py.test
. To release a new version:
pip install twine
python setup.py sdist
python setup.py bdist_wheel --universal
twine upload dist/*
Bug reports and pull requests are welcome on GitHub at https://github.com/cogito-lang/cogito-py.
The package is available as open source under the terms of the MIT License.