humanfirst


Namehumanfirst JSON
Version 2.1.0 PyPI version JSON
download
home_pagehttps://humanfirst.ai
SummaryHumanFirst Package Module
upload_time2025-02-07 07:49:08
maintainerNone
docs_urlNone
authorMohammed Fayaz Ansar Jelani
requires_python>=3.8
licenseMIT
keywords python humanfirst humanfirst
VCS
bugtrack_url
requirements twine wheel keyring keyrings.alt pylint git-pylint-commit-hook numpy pandas requests requests-toolbelt autopep8 dataclasses dataclasses-json pytest python-dotenv pytest-cov ntplib PyJWT
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# 🚀 HumanFirst SDK (humanfirst-module)

---
The **HumanFirst SDK (humanfirst-module)** is a Python package that simplifies the integration and interaction with the [HumanFirst platform](https://www.humanfirst.ai/) - It is a no-code tool specializing in Data Engineering, Prompt Engineering, Context Engineering, Conversational AI and NLU.

SDK provides a set of tools, helper classes, and API methods to streamline working with the **HumanFirst JSON format**, **API endpoints**, and **Secure authorization**.

---

## 🎯 Key Features
* **HumanFirst Objects**: Helper classes to describe, validate, and manipulate the core data structures used in the HumanFirst platform.
* **HumanFirst APIs**: A streamlined way to interact with the HumanFirst APIs for managing datasets, labels, prompts, pipelines and more.
* **Secure Authorization**: Simplified handling of secure API authentication and token management.

---

## 📦 Installation

Install the package using `pip`:

```bash
pip install humanfirst
```

---

## 🧩 Components Overview
1. **humanfirst.objects**: A set of helper classes and methods for describing, validating, and interacting with HFObjects that make up the HumanFirst JSON format.

    * Validate and manipulate HumanFirst objects.
    * Convert between Python objects and HumanFirst JSON structures.

2. **humanfirst.apis**: Helper classes to interact with the HumanFirst APIs.

    * Perform CRUD operations on datasets and projects.
    * Easily integrate HumanFirst functionalities into your applications.

3. **humanfirst.authorization**: Handles secure authorization for interacting with HumanFirst APIs.

    * Manage API keys and tokens.
    * Ensure secure communication with the HumanFirst platform.

---

## 📖 Usage Example
Here's a basic example of how to use the HumanFirst SDK to connect to the HumanFirst API and perform operations:

Follow the authentication steps given in the development setup below.

```python
import humanfirst

# Step 1 : Initialize the API
hf_api = humanfirst.apis.HFAPI()

# Step 2: Perform an API call (e.g., fetching a list of projects)
playbook_list = hf_api.list_playbooks(namespace="<namespace>")

print(playbook_list)
```

---

## ⚙️ Development Setup
For contributors and developers, you can set up the package locally by cloning the repository and installing the necessary dependencies:

```bash
# Clone the repo
git clone https://github.com/zia-ai/humanfirst-module.git

# Navigate into the project directory
cd humanfirst-module
```

### Create Virtual Environment to do any dev work and perform pytest work
* Remove any previously created virtual env `rm -rf ./venv`
* Create virtualenv & activate `python3 -m venv venv` 
* if bash shell `source venv/bin/activate` **In case of deactivating use "deactivate"**
* Update PiP `python -m pip install --upgrade pip`
* install requirements  `pip install -r requirements.txt --no-cache`

### Authentication
1. Either use firebase authentication
    * Set your HF_USERNAME and HF_PASSWORD env variable
2. Or use HumanFirst API Key
    * Set HF_API_KEY env variable
    * Follow the steps [here](https://api-keys.humanfirst-docs.pages.dev/docs/api/) to get API key

### Log handling
* HF SDK logging offers multiple options. Either can save the logs, print them in the console, do both or none
* To store the logs in a specific directory set HF_LOG_FILE_ENABLE to 'TRUE' and set the directory in HF_LOG_DIR where the log files needs to be stored.
* Log file management
    * Rotating File Handler is used
    * When the log file size exceeds 100MB (Hard coded). Automatically a new file is created and old one is saved
    * Can go to upto 4 additional log files
    * If the number of log files exceed the additional log file count + 1, then automatically the oldest log file is gets replaced with new log information
* Can set log levels using HF_LOG_LEVEL. Accepts - 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL' 
* To print the logs in console set exp to 'TRUE'
* Default - the logs are neither saved nor printed onto console

### Using pytest to test everything is working fine
#### Running on production

This is the default.

`pytest --cov ./humanfirst/ --cov-report html --cov-report term`
* --cov-report html - produces a report in HTML page
* --cov-report term - prints the report in console
* --cov-report term:skip-covered - helps to see uncovered parts

#### Testing using Docker build for this module

Check docker is working with `docker run hello-world` or `sudo docker run hello-world` depending on whether you have a user or root docker setup.

* `docker build . -t humanfirst-module:latest --no-cache`
To run the tests for this module we pass through the necessary env variables
`echo $HF_ENVIRONMENT $BASE_URL_TEST $HF_USERNAME $HF_PASSWORD`

```sh
docker run \
-e "HF_USERNAME=$HF_USERNAME" \
-e "HF_PASSWORD=$HF_PASSWORD" \
--name humanfirst-module-0 \
humanfirst-module \
pytest -s --cov ./humanfirst/ --cov-report term
```

### To install humanfirst package locally

`pip install dist/humanfirst-<version number>.tar.gz --no-cache`

For more details on developer setup visit Developer [README.md](https://github.com/zia-ai/humanfirst-module/blob/master/humanfirst/README.md)

---
## 🔧 Configuration Files
The package includes configuration files located in the config/ directory. 

```bash
config/
│
├── logging.conf
└── setup.cfg
```
* logging.conf - contains all the logging related configurations
* setup.cfg - contains all important default constants

---

## 📚 API Reference
For detailed API reference, visit the official documentation:

📖 Documentation: https://docs.humanfirst.ai/docs/api/

📂 Source Code APIs: https://github.com/zia-ai/humanfirst-module/blob/master/humanfirst/apis.py

---

## 🤝 Contributing
We welcome contributions to the HumanFirst SDK! If you find a bug or have a feature request, please open an issue on GitHub.

### Steps to Contribute:
* Fork the repository.
* Create a new branch for your feature/bugfix.
* Submit a pull request.

---

## 📄 License
This project is licensed under the MIT License. See the [LICENSE](https://github.com/zia-ai/humanfirst-module/blob/master/LICENSE) file for more details.

---

## 💬 Support
If you have any questions or need support, feel free to reach out:

📧 Email: fayaz@humanfirst.ai

💻 GitHub Issues: https://github.com/zia-ai/humanfirst-module/issues

---

## 🔗 Links
🌐 Official Website: https://www.humanfirst.ai

📚 Documentation: https://docs.humanfirst.ai/docs

🐙 GitHub Repo: https://github.com/zia-ai/humanfirst-module

🐞 Issue Tracker: https://github.com/zia-ai/humanfirst-module/issues

---

            

Raw data

            {
    "_id": null,
    "home_page": "https://humanfirst.ai",
    "name": "humanfirst",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "python, humanfirst, HumanFirst",
    "author": "Mohammed Fayaz Ansar Jelani",
    "author_email": "fayaz@humanfirst.ai",
    "download_url": "https://files.pythonhosted.org/packages/85/1c/c508079078a0fb4222897b32d3def4b6e9db410b5bb7795e82e343153a9b/humanfirst-2.1.0.tar.gz",
    "platform": null,
    "description": "\n# \ud83d\ude80 HumanFirst SDK (humanfirst-module)\n\n---\nThe **HumanFirst SDK (humanfirst-module)** is a Python package that simplifies the integration and interaction with the [HumanFirst platform](https://www.humanfirst.ai/) - It is a no-code tool specializing in Data Engineering, Prompt Engineering, Context Engineering, Conversational AI and NLU.\n\nSDK provides a set of tools, helper classes, and API methods to streamline working with the **HumanFirst JSON format**, **API endpoints**, and **Secure authorization**.\n\n---\n\n## \ud83c\udfaf Key Features\n* **HumanFirst Objects**: Helper classes to describe, validate, and manipulate the core data structures used in the HumanFirst platform.\n* **HumanFirst APIs**: A streamlined way to interact with the HumanFirst APIs for managing datasets, labels, prompts, pipelines and more.\n* **Secure Authorization**: Simplified handling of secure API authentication and token management.\n\n---\n\n## \ud83d\udce6 Installation\n\nInstall the package using `pip`:\n\n```bash\npip install humanfirst\n```\n\n---\n\n## \ud83e\udde9 Components Overview\n1. **humanfirst.objects**: A set of helper classes and methods for describing, validating, and interacting with HFObjects that make up the HumanFirst JSON format.\n\n    * Validate and manipulate HumanFirst objects.\n    * Convert between Python objects and HumanFirst JSON structures.\n\n2. **humanfirst.apis**: Helper classes to interact with the HumanFirst APIs.\n\n    * Perform CRUD operations on datasets and projects.\n    * Easily integrate HumanFirst functionalities into your applications.\n\n3. **humanfirst.authorization**: Handles secure authorization for interacting with HumanFirst APIs.\n\n    * Manage API keys and tokens.\n    * Ensure secure communication with the HumanFirst platform.\n\n---\n\n## \ud83d\udcd6 Usage Example\nHere's a basic example of how to use the HumanFirst SDK to connect to the HumanFirst API and perform operations:\n\nFollow the authentication steps given in the development setup below.\n\n```python\nimport humanfirst\n\n# Step 1 : Initialize the API\nhf_api = humanfirst.apis.HFAPI()\n\n# Step 2: Perform an API call (e.g., fetching a list of projects)\nplaybook_list = hf_api.list_playbooks(namespace=\"<namespace>\")\n\nprint(playbook_list)\n```\n\n---\n\n## \u2699\ufe0f Development Setup\nFor contributors and developers, you can set up the package locally by cloning the repository and installing the necessary dependencies:\n\n```bash\n# Clone the repo\ngit clone https://github.com/zia-ai/humanfirst-module.git\n\n# Navigate into the project directory\ncd humanfirst-module\n```\n\n### Create Virtual Environment to do any dev work and perform pytest work\n* Remove any previously created virtual env `rm -rf ./venv`\n* Create virtualenv & activate `python3 -m venv venv` \n* if bash shell `source venv/bin/activate` **In case of deactivating use \"deactivate\"**\n* Update PiP `python -m pip install --upgrade pip`\n* install requirements  `pip install -r requirements.txt --no-cache`\n\n### Authentication\n1. Either use firebase authentication\n    * Set your HF_USERNAME and HF_PASSWORD env variable\n2. Or use HumanFirst API Key\n    * Set HF_API_KEY env variable\n    * Follow the steps [here](https://api-keys.humanfirst-docs.pages.dev/docs/api/) to get API key\n\n### Log handling\n* HF SDK logging offers multiple options. Either can save the logs, print them in the console, do both or none\n* To store the logs in a specific directory set HF_LOG_FILE_ENABLE to 'TRUE' and set the directory in HF_LOG_DIR where the log files needs to be stored.\n* Log file management\n    * Rotating File Handler is used\n    * When the log file size exceeds 100MB (Hard coded). Automatically a new file is created and old one is saved\n    * Can go to upto 4 additional log files\n    * If the number of log files exceed the additional log file count + 1, then automatically the oldest log file is gets replaced with new log information\n* Can set log levels using HF_LOG_LEVEL. Accepts - 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL' \n* To print the logs in console set exp to 'TRUE'\n* Default - the logs are neither saved nor printed onto console\n\n### Using pytest to test everything is working fine\n#### Running on production\n\nThis is the default.\n\n`pytest --cov ./humanfirst/ --cov-report html --cov-report term`\n* --cov-report html - produces a report in HTML page\n* --cov-report term - prints the report in console\n* --cov-report term:skip-covered - helps to see uncovered parts\n\n#### Testing using Docker build for this module\n\nCheck docker is working with `docker run hello-world` or `sudo docker run hello-world` depending on whether you have a user or root docker setup.\n\n* `docker build . -t humanfirst-module:latest --no-cache`\nTo run the tests for this module we pass through the necessary env variables\n`echo $HF_ENVIRONMENT $BASE_URL_TEST $HF_USERNAME $HF_PASSWORD`\n\n```sh\ndocker run \\\n-e \"HF_USERNAME=$HF_USERNAME\" \\\n-e \"HF_PASSWORD=$HF_PASSWORD\" \\\n--name humanfirst-module-0 \\\nhumanfirst-module \\\npytest -s --cov ./humanfirst/ --cov-report term\n```\n\n### To install humanfirst package locally\n\n`pip install dist/humanfirst-<version number>.tar.gz --no-cache`\n\nFor more details on developer setup visit Developer [README.md](https://github.com/zia-ai/humanfirst-module/blob/master/humanfirst/README.md)\n\n---\n## \ud83d\udd27 Configuration Files\nThe package includes configuration files located in the config/ directory. \n\n```bash\nconfig/\n\u2502\n\u251c\u2500\u2500 logging.conf\n\u2514\u2500\u2500 setup.cfg\n```\n* logging.conf - contains all the logging related configurations\n* setup.cfg - contains all important default constants\n\n---\n\n## \ud83d\udcda API Reference\nFor detailed API reference, visit the official documentation:\n\n\ud83d\udcd6 Documentation: https://docs.humanfirst.ai/docs/api/\n\n\ud83d\udcc2 Source Code APIs: https://github.com/zia-ai/humanfirst-module/blob/master/humanfirst/apis.py\n\n---\n\n## \ud83e\udd1d Contributing\nWe welcome contributions to the HumanFirst SDK! If you find a bug or have a feature request, please open an issue on GitHub.\n\n### Steps to Contribute:\n* Fork the repository.\n* Create a new branch for your feature/bugfix.\n* Submit a pull request.\n\n---\n\n## \ud83d\udcc4 License\nThis project is licensed under the MIT License. See the [LICENSE](https://github.com/zia-ai/humanfirst-module/blob/master/LICENSE) file for more details.\n\n---\n\n## \ud83d\udcac Support\nIf you have any questions or need support, feel free to reach out:\n\n\ud83d\udce7 Email: fayaz@humanfirst.ai\n\n\ud83d\udcbb GitHub Issues: https://github.com/zia-ai/humanfirst-module/issues\n\n---\n\n## \ud83d\udd17 Links\n\ud83c\udf10 Official Website: https://www.humanfirst.ai\n\n\ud83d\udcda Documentation: https://docs.humanfirst.ai/docs\n\n\ud83d\udc19 GitHub Repo: https://github.com/zia-ai/humanfirst-module\n\n\ud83d\udc1e Issue Tracker: https://github.com/zia-ai/humanfirst-module/issues\n\n---\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "HumanFirst Package Module",
    "version": "2.1.0",
    "project_urls": {
        "Documentation": "https://docs.humanfirst.ai/docs/",
        "Homepage": "https://humanfirst.ai",
        "Source": "https://github.com/zia-ai/humanfirst-module"
    },
    "split_keywords": [
        "python",
        " humanfirst",
        " humanfirst"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e0ce019af986159f4d7c88f2985eb4405f66fe14eeb9394291095d8c01399074",
                "md5": "9ea0a30cef4669bae5f05a134a5b5f69",
                "sha256": "7b5a111af8ffd1878d21d9da0dc6ae31f4e911fee69a46b18e33b810bad67bf7"
            },
            "downloads": -1,
            "filename": "humanfirst-2.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9ea0a30cef4669bae5f05a134a5b5f69",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 114606,
            "upload_time": "2025-02-07T07:49:05",
            "upload_time_iso_8601": "2025-02-07T07:49:05.645826Z",
            "url": "https://files.pythonhosted.org/packages/e0/ce/019af986159f4d7c88f2985eb4405f66fe14eeb9394291095d8c01399074/humanfirst-2.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "851cc508079078a0fb4222897b32d3def4b6e9db410b5bb7795e82e343153a9b",
                "md5": "41eb0f6333df37a34ddcc26f7ad78a6a",
                "sha256": "8c5d29e7a600f0e26418d4507e73332054497cd0b6c530e93b945f4fcfa08c9e"
            },
            "downloads": -1,
            "filename": "humanfirst-2.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "41eb0f6333df37a34ddcc26f7ad78a6a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 117146,
            "upload_time": "2025-02-07T07:49:08",
            "upload_time_iso_8601": "2025-02-07T07:49:08.056009Z",
            "url": "https://files.pythonhosted.org/packages/85/1c/c508079078a0fb4222897b32d3def4b6e9db410b5bb7795e82e343153a9b/humanfirst-2.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-07 07:49:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zia-ai",
    "github_project": "humanfirst-module",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "circle": true,
    "requirements": [
        {
            "name": "twine",
            "specs": [
                [
                    "==",
                    "5.1.1"
                ]
            ]
        },
        {
            "name": "wheel",
            "specs": [
                [
                    "==",
                    "0.41.2"
                ]
            ]
        },
        {
            "name": "keyring",
            "specs": []
        },
        {
            "name": "keyrings.alt",
            "specs": []
        },
        {
            "name": "pylint",
            "specs": []
        },
        {
            "name": "git-pylint-commit-hook",
            "specs": []
        },
        {
            "name": "numpy",
            "specs": []
        },
        {
            "name": "pandas",
            "specs": []
        },
        {
            "name": "requests",
            "specs": []
        },
        {
            "name": "requests-toolbelt",
            "specs": []
        },
        {
            "name": "autopep8",
            "specs": []
        },
        {
            "name": "dataclasses",
            "specs": []
        },
        {
            "name": "dataclasses-json",
            "specs": []
        },
        {
            "name": "pytest",
            "specs": []
        },
        {
            "name": "python-dotenv",
            "specs": []
        },
        {
            "name": "pytest-cov",
            "specs": []
        },
        {
            "name": "ntplib",
            "specs": []
        },
        {
            "name": "PyJWT",
            "specs": []
        }
    ],
    "lcname": "humanfirst"
}
        
Elapsed time: 3.08102s