Skip to main content

A package for labeling data

Project description

Python Bindings for Security Labeler

Usages

From Python Interpreter

Python 3.10.13 (main, Aug 24 2023, 12:59:26) [Clang 15.0.0 (clang-1500.0.40.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from labeler import labeler
INFO:2023-12-08 06:19:28,950 get_library_name:12 - Operating System: macos-14.1.2-arm64-arm-64bit
INFO:2023-12-08 06:19:28,950 get_library_name:13 - CPU Architecture: ('64bit', '')
>>> labeler.evaluate('{"number":1}', "when number > 0 then 'tag1' else 'tag2'")
'tag1'

From Python Script

from labeler import labeler

content = '{"number":1}'
statement = "when number > 0 then 'tag1' else 'tag2'"

result: str = labeler.evaluate(content, statement)

print(f"result:{result}")

How to Build (as the developer)

Prerequisites

  • Shared libraries must have been built prior building the Python pacakge.

    • Libraries are expected to exist in the labeler directory with libkoverse_labeler- prefix.

Make Targets

Several make targets are provided.

  • clean - delete files under build/*, dist/*, src/*.egg-info/, inputs/*, src/labeler/libs/*.so, src/labeler/libs/*.dylib directory but keep the .gitkeep file.

  • init - install Python build package.

  • copy_test_data - copy the test data from ../inputs directory to the current directory.

  • copy_library - copy library files from ../labeler directory into ./src/labeler/libs/ directory.

  • install_extra_dependencies - install extra depdencies needed for testing.

  • build - build and package

  • tests - run the test

  • test_upload - upload package to Test PyPI.


Building the package

make init
make build

How to Run Tests

make tests

How to Publish to TestPyPI

make test_upload

How to Install the package (as a user)

pip install cffi

pip install -i https://test.pypi.org/simple/ labeler

# or in one go
pip install -i https://test.pypi.org/simple/ labeler --extra-index-url https://pypi.org/simple/ cffi

Editable Install

This assumes the package has been built locally already.

pip install -e .

Install extra dependencies

pip install -e ".[dev]"

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cch_labeler-0.0.0-py3-none-any.whl (30.0 kB view details)

Uploaded Python 3

File details

Details for the file cch_labeler-0.0.0-py3-none-any.whl.

File metadata

  • Download URL: cch_labeler-0.0.0-py3-none-any.whl
  • Upload date:
  • Size: 30.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.19

File hashes

Hashes for cch_labeler-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 88061288ba6d9d27805a1ea23a3b70c0035fcff2ef2b95384ad52c9159ba1773
MD5 0c4d3eb74d62c1a4cda1d7c264c0160d
BLAKE2b-256 c961a5acdac4c072c29c92007eb84e9c0b48bdf16aa7c0be25511c4d31c69c33

See more details on using hashes here.

Supported by

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