# Everysk Lib
Welcome to the documentation for the Everysk Library!
Everysk's library was developed with the aim of unifying python
codes to be used in various company projects.
## API Reference
The [Everysk API](https://everysk.com/api/docs) is build around the standard [REST](https://en.wikipedia.org/wiki/REST) protocol and contains multiple endpoints to perform calculations, create portfolios, create workspaces where you can manage datastores, reports, files, workflows, and much more.
## Docker
Docker is used to create, run, and manage containers. In this project, Docker is used to set up a **PyPi** server and built the **Everysk library**.
### Running the PyPI Server.
To run the pypi server, first you will need to build a Docker image and then run a container from that image.
#### 1. Build the Docker image
The command below builds a Docker image using the Dockerfile located in the `./docker/` directory. The `--target` option specifies the build stage, which in this case is `everysk_pypi_server`. The `--tag` option assigns a name and tag to the image, `everysk_pypi_server:latest`.
```bash
docker build --file ./docker/Dockerfile --target everysk_pypi_server --tag everysk_pypi_server:latest .
```
#### 2. Run the Docker container
After that, you will need to run the Docker container from the image built in the previous step. The `--rm` option removes the container when it exits. The `-it` option allows you to interact with the container. The `-e` option sets the environment variable `PYPI_PASSWORD` to '123123'. The `-p` options map the host ports 8080 and 2020 to the container ports 80 and 22 respectively.
```
docker run --rm -it -e PYPI_PASSWORD='123123' -p 0.0.0.0:8080:80 -p 0.0.0.0:2020:22 everysk_pypi_server:latest
```
### Building the library and Sending to PyPI Server
To build the library and send to Pypi server, you will need to build another Docker image and run, once again, a container from that image.
#### 1. Build the Docker Image
We use a command that is similar to the one used to build the PyPI server image, the only thing that differs is the target build stage and tag.
```bash
docker build --file ./docker/Dockerfile --target everysk_lib_build --tag everysk_lib_build:latest .
```
#### 2. Run the Docker container
After building the docker image, we run a Docker container from the image built in the previous step. The environment variables `PYPI_PASSWORD` and `PYPI_HOST` are set to '123123' and '192.168.0.116' respectively.
```
docker run --rm -it -e PYPI_PASSWORD='123123' -e PYPI_HOST='192.168.0.116' everysk_lib_build:latest
```
## Usage/Examples
Let's have a look at the different modules available from the everysk library
### Compress Module
The **compress** module from `everysk.core` allows the compression and decompression of JSON files and Python objects. It includes functions to serialize objects into JSON strings or pickle objects, then it compresses or decompresses them using the zlib or gzip module.
Below we have an implementation example of one of the methods inside the module.
```python
>>> from everysk.core.compress import compress
>>> data = {'key' : 'value'}
>>> compressed_data = compress(data)
b'x\x9c\xcbH\xcd\xc9\xc9W(....) # example of the compressed data
```
### Exceptions Module
This module is a collection of custom exception classes designed to handle errors then raise specific exceptions based on those errors. They also provide attributes and methods to improve the debugging experience.
Below we have an example of the `DateError` exception being raised after we passed an invalid input to a hypothetical function.
```python
>>> from everysk.core.exceptions import DateError
>>> try:
... result = validate_month_day('2024-01-01')
... return result
>>> except:
... raise DateError('invalid date format')
```
### Object & Fields Module
The **object** and **fields** modules from the `everysk.core` package are used to create classes with consistent and type-checked data.
Here's an example of how to use them:
```python
>>> from everysk.core.fields import BoolField
>>> from everysk.core.object import BaseDict
>>>
>>> class MyClass(BaseDict):
... field: BoolField(required=True)
>>>
>>> obj = MyClass(field=True)
>>> obj.field is True
... True
>>> obj.field == obj['field']
... True
```
### HTTP Module
Module **http.py** module provides a set of classes for handling HTTP requests within the `everysk` framework, it is designed to facilitate HTTP communications, including specific error checking and functionalities for dealing with authentication.
```python
>>> from everysk.core.http import HttpGETConnection
>>>
>>> class MyConnection(HttpGETConnection):
... url: StrField(default='https://example.com', readonly=True)
... def get_params(self) -> dict:
... # Will be added to url p=1&p=2
... return {'p': 1, 'p': 2}
...
... def message_error_check(self, message: str, status_code: int) -> bool:
... # If this message appear on HttpError then we try again.
... return 'server is busy' in message
>>>
>>> response = MyConnection().get_response()
```
### Settings Module
Module **settings** is the sum of all settings.py created on the project.
Every setting will have it's value first from env otherwise from the attribute.
```python
>>> from everysk.config import settings
>>> settings.DEBUG
True
```
### Log Module
The **log** module from `log.py` includes a collection of methods and classes designed to handle logging operations.
```python
>>> from everysk.core.log import Logger
>>> log = Logger(name='log-test')
>>> log.debug('Test')
'2024-02-07 12:49:10,640 - DEBUG - {} - Test'
```
The log module also has useful methods like the `slack()` method from the `Logger` class which can send slack messages to a channel using the **Slack WebHooks**. Check out their [documentation](https://api.slack.com/messaging/webhooks).
Let's have a look at how the `slack()` method is used:
```python
>>> from everysk.core.log import Logger
>>> slack_instantiation = Logger()
>>> slack_instantiation.slack(title='title of the message', message='body of the message', color='danger')
'2024-05-23 13:17:22,734 - Slack message: title of the message -> body of the message'
```
### Workers Module
The `workers.py` file provides a framework for managing and executing tasks using Google Cloud Tasks within the `everysk` ecosystem. It utilizes Google Cloud Tasks to enqueue and process asynchronous tasks, suitable for handling operations that require delay or scheduling.
Below we have an usage example of deploying tasks using the `TaskGoogle` class:
```python
>>> from everysk.core.workers import TaskGoogle
>>> task = TaskGoogle(worker_url='https://example.com/worker', worker_id='example_worker_id')
>>> task.save(timeout=30.0, retry_times=3)
```
This example shows how to initialize a task with a specific worker URL and worker ID, then save it to [**Google Cloud Tasks**](https://cloud.google.com/tasks/docs).
### Firestore Module
Module **firestore.DocumentCached** is a Redis/Firestore document. This uses Redis for
read the data and Redis/Firestore to store the data. To keep the cache synchronized
with Firestore, use everysk/cloud_function. With this when we alter the data using
Firestore interface the cache will be updated.
```python
>>> from everysk.core.firestore import DocumentCached
>>> doc = Document(_collection_name='collection', firestore_id='firestore_id')
>>> doc.firestore_id
'firestore_id'
```
### String Module
The `string.py` module in the `everysk` library provides a handful of utility functions designed for string manipulation and validation, this is useful for handling text data in a variety of programming and data processing contexts.
Below we have an example of the `pluralize()` method that transforms the string into it's pluralized version
```python
>>> from everysk.core.string import pluralize
>>> pluralize('system')
'systems'
```
Below is another example of a method that converts the current string into the snake case format.
```python
>>> from everysk.core.string import snake_case
>>> snake_case('CustomIndex')
'custom_index'
```
### Threads Module
The `threads.py` module offers different methods for managing [concurrent execution](https://en.wikipedia.org/wiki/Concurrent_computing) using threads, tailored specifically for environments that require parallel processing.
Below we have an example of code that executes a task asynchronously with a simple thread management.
```python
>>> from everysk.core.threads import Thread
>>> def sum(a: int, b: int) -> int:
... return a + b
...
>>> thread = Thread(target=sum, args=(1, 2))
>>> task.start()
>>> task.join()
3
```
This module is proved to be useful for applications within the `everysk` infrastructure that require parallel computation or asynchronous task management.
### Serialize Module
The serialize module is designed to handle serialization and deserialization of complex Python objects to and from JSON format, with specific support for dates, custom objects, and structured data.
Here is an example for serializing a Python object to a JSON string in bytes:
```python
>>> from everysk.core.serialize import dumps
>>> class MyClass:
... def __init__(self, worker_name, worker_id):
... self.worker_name = worker_name
... self.worker_id = worker_id
...
>>> def _default(obj):
... if isinstance(obj, MyClass):
... return obj.__dict__
... raise TypeError(f'Type {type(obj)} is not serializable')
...
>>> my_obj = MyClass('sample_worker', 'sample_worker_id')
>>> serialized_data = dumps(my_obj, default=_default)
```
### Number Module
The `number.py` module is designed to provide utility functions related to numerical operations.
Below we have an implementation of the function `is_float_convertible` that returns a boolean indicating whether the value can be converted to a float point value or not.
```python
>>> from everysk.core.numbers import is_float_convertible
>>> is_float_convertible('3.14')
True
>>> is_float_convertible(5)
True
>>> is_float_convertible('not a float')
False
```
### Redis Module
The **Redis** module is designed to interact with a Redis server to store, retrieve and manage cached data.
Below is an example of how to use the `acquire()` method to verify if a key is locked by the current lock.
```python
>>> from everysk.core.redis import RedisLock
>>> redis_lock = RedisLock(name='test_name', timeout=1, host='1.0.0.0', port=4435)
>>> redis_lock.acquire('example_lock_key')
'Lock acquired for key "example lock_key"'
```
## Installation
Here you can access the instructions on how to install the `everysk-beta` library using pip.
To install the `everysk-beta` library, you will need to use pip's `install` command along with the `--index-url` option that allows you to specify the PyPI server from which to install the package.
Replace `PYPI_HOST` with the actual host of your PyPI server. Then run the following command:
```bash
pip install --index-url https://PYPI_HOST everysk-beta
```
### Verifying the Installation
After installing the library, it's a good practice to verify if the installation was successful. Here is how to achieve this:
#### 1. Open a terminal
#### 2. Start the Python interpreter by typing `python` and pressing `Enter`
#### 3. In the Python interpreter, type the following command then press `Enter`:
```python
import everysk
```
If the library has been installed correctly, this command should complete without any errors. If the library is not installed or there's a problem with the installation, Python will raise a `ModuleNotFoundError`
## Running Tests
This section provides instructions on how to run tests for the project. There are two scenarios, the first one is running tests in a development environment and the second one is running tests after the library has been installed from PyPI.
### Running Tests in Development Environment
In a development environment you can use the provided shell script to run the tests. The script sets up the necessary environment and then run the tests. To execute the tests, open a bash terminal and run the following command.
```bash
./run.sh tests
```
### Running Tests After the Library is Installed
After the library has been installed in your project from PyPI, you can start running tests using Python's built-in unittest module. To run tests use the following command:
```bash
python3 -m unittest everysk.core.tests
```
The command uses Python's unittest module as mentioned above as a script, which then runs the test in the `everysk.core.tests` package.
## Running Tests with coverage
Code coverage us a way of measuring how many lines of code are executed while the automated tests are running.
To run tests along with a coverage report, you can use the provided shell script. The script will not only run the tests but also generate a coverage report that shows the percentage of code that was executed during the tests.
This is useful to identify sections of your code that are not being tested and may need additional tests.
#### 1. Open a terminal in your Visual Studio Code environment.
#### 2. Run the following command.
```bash
./run.sh coverage
```
This command executes the `run.sh` script with the `coverage` argument. The report will be displayed in the terminal after the script completed the tests.
**Remember:** a high coverage percentage is generally good, but 100% coverage does not ensures that your code is free from bugs or any other problem that might occur in your code. The full coverage just means that all the lines in your code were executed during the tests.
## Contributing
Contributions are always welcome and greatly appreciated!
Go to the repository [link](https://github.com/Everysk/everysk-lib) and click on the `Fork` button to create your own copy of the everysk library.
Then clone the project in your own local machine by running the command below or using the **GitHub Desktop**.
```bash
git clone https://github.com/<your-username>/everysk-lib.git everysk-yourusername
```
This section creates a directory called `everysk-yourusername` to center all your code.
After that you can change the directory by:
```bash
cd everysk-yourusername
```
Create the **upstream** repository which will refer to the main repository that you just forked.
```bash
git remote add upstream https://github.com/Everysk/everysk-lib.git
```
Now run the following commands to make sure that your clone is up-to-date with main everysk repository
```bash
git checkout main
git pull upstream main
```
Shortly after, create a new branch to add your code
```bash
git checkout -b brand-new-feature
```
The command above will automatically switch to this newly created branch. At this moment your are able to make your modifications to the code and commit locally as you progress.
After all the code changes, you can submit your contribution by pushing the changes to your fork on GitHub:
```bash
git push origin brand-new-feature
```
The command above ensures that all the modifications that you've made are up-to-date with your current branch.
At the end of this process you will need to make a **Pull Request** to the main branch.
To achieve this, go to the GitHub page of the project and click on the `Pull requests` tab, then click on `New pull request` button.
This will open a new section used to compare branches, now choose your branch for merging into the main branch and hit the `Create pull request` button.
## License
(C) Copyright 2023 EVERYSK TECHNOLOGIES
This is an unpublished work containing confidential and proprietary
information of EVERYSK TECHNOLOGIES. Disclosure, use, or reproduction
without authorization of EVERYSK TECHNOLOGIES is prohibited.
Date: Jan 2023
Contact: contact@everysk.com
URL: https://everysk.com/
Raw data
{
"_id": null,
"home_page": null,
"name": "everysk-beta",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "python, setuptools, development, lib",
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/0b/0d/fc52e699873d36969f6af86306de35d164b4e3759e2c679a242793f4eeaa/everysk_beta-1.6.1381.tar.gz",
"platform": null,
"description": "\n# Everysk Lib\n\nWelcome to the documentation for the Everysk Library!\n\nEverysk's library was developed with the aim of unifying python\ncodes to be used in various company projects.\n\n## API Reference\n\nThe [Everysk API](https://everysk.com/api/docs) is build around the standard [REST](https://en.wikipedia.org/wiki/REST) protocol and contains multiple endpoints to perform calculations, create portfolios, create workspaces where you can manage datastores, reports, files, workflows, and much more.\n\n## Docker\n\nDocker is used to create, run, and manage containers. In this project, Docker is used to set up a **PyPi** server and built the **Everysk library**.\n\n### Running the PyPI Server.\n\nTo run the pypi server, first you will need to build a Docker image and then run a container from that image.\n\n#### 1. Build the Docker image\n\nThe command below builds a Docker image using the Dockerfile located in the `./docker/` directory. The `--target` option specifies the build stage, which in this case is `everysk_pypi_server`. The `--tag` option assigns a name and tag to the image, `everysk_pypi_server:latest`.\n\n```bash\n docker build --file ./docker/Dockerfile --target everysk_pypi_server --tag everysk_pypi_server:latest .\n```\n\n#### 2. Run the Docker container\n\nAfter that, you will need to run the Docker container from the image built in the previous step. The `--rm` option removes the container when it exits. The `-it` option allows you to interact with the container. The `-e` option sets the environment variable `PYPI_PASSWORD` to '123123'. The `-p` options map the host ports 8080 and 2020 to the container ports 80 and 22 respectively.\n\n```\n docker run --rm -it -e PYPI_PASSWORD='123123' -p 0.0.0.0:8080:80 -p 0.0.0.0:2020:22 everysk_pypi_server:latest\n```\n\n### Building the library and Sending to PyPI Server\n\nTo build the library and send to Pypi server, you will need to build another Docker image and run, once again, a container from that image.\n\n#### 1. Build the Docker Image\n\nWe use a command that is similar to the one used to build the PyPI server image, the only thing that differs is the target build stage and tag.\n\n```bash\n docker build --file ./docker/Dockerfile --target everysk_lib_build --tag everysk_lib_build:latest .\n```\n\n#### 2. Run the Docker container\n\nAfter building the docker image, we run a Docker container from the image built in the previous step. The environment variables `PYPI_PASSWORD` and `PYPI_HOST` are set to '123123' and '192.168.0.116' respectively.\n\n```\n docker run --rm -it -e PYPI_PASSWORD='123123' -e PYPI_HOST='192.168.0.116' everysk_lib_build:latest\n```\n\n## Usage/Examples\n\nLet's have a look at the different modules available from the everysk library\n\n### Compress Module\n\nThe **compress** module from `everysk.core` allows the compression and decompression of JSON files and Python objects. It includes functions to serialize objects into JSON strings or pickle objects, then it compresses or decompresses them using the zlib or gzip module.\n\nBelow we have an implementation example of one of the methods inside the module.\n\n```python\n >>> from everysk.core.compress import compress\n >>> data = {'key' : 'value'}\n >>> compressed_data = compress(data)\n b'x\\x9c\\xcbH\\xcd\\xc9\\xc9W(....) # example of the compressed data\n```\n\n### Exceptions Module\n\nThis module is a collection of custom exception classes designed to handle errors then raise specific exceptions based on those errors. They also provide attributes and methods to improve the debugging experience.\n\nBelow we have an example of the `DateError` exception being raised after we passed an invalid input to a hypothetical function.\n\n```python\n >>> from everysk.core.exceptions import DateError\n >>> try:\n ... result = validate_month_day('2024-01-01')\n ... return result\n >>> except:\n ... raise DateError('invalid date format')\n```\n\n### Object & Fields Module\n\nThe **object** and **fields** modules from the `everysk.core` package are used to create classes with consistent and type-checked data.\n\nHere's an example of how to use them:\n\n```python\n >>> from everysk.core.fields import BoolField\n >>> from everysk.core.object import BaseDict\n >>>\n >>> class MyClass(BaseDict):\n ... field: BoolField(required=True)\n >>>\n >>> obj = MyClass(field=True)\n >>> obj.field is True\n ... True\n >>> obj.field == obj['field']\n ... True\n```\n\n### HTTP Module\n\nModule **http.py** module provides a set of classes for handling HTTP requests within the `everysk` framework, it is designed to facilitate HTTP communications, including specific error checking and functionalities for dealing with authentication.\n\n```python\n >>> from everysk.core.http import HttpGETConnection\n >>>\n >>> class MyConnection(HttpGETConnection):\n ... url: StrField(default='https://example.com', readonly=True)\n ... def get_params(self) -> dict:\n ... # Will be added to url p=1&p=2\n ... return {'p': 1, 'p': 2}\n ...\n ... def message_error_check(self, message: str, status_code: int) -> bool:\n ... # If this message appear on HttpError then we try again.\n ... return 'server is busy' in message\n >>>\n >>> response = MyConnection().get_response()\n```\n\n### Settings Module\n\nModule **settings** is the sum of all settings.py created on the project.\nEvery setting will have it's value first from env otherwise from the attribute.\n\n```python\n >>> from everysk.config import settings\n >>> settings.DEBUG\n True\n```\n\n### Log Module\n\nThe **log** module from `log.py` includes a collection of methods and classes designed to handle logging operations.\n\n```python\n >>> from everysk.core.log import Logger\n >>> log = Logger(name='log-test')\n >>> log.debug('Test')\n '2024-02-07 12:49:10,640 - DEBUG - {} - Test'\n```\n\nThe log module also has useful methods like the `slack()` method from the `Logger` class which can send slack messages to a channel using the **Slack WebHooks**. Check out their [documentation](https://api.slack.com/messaging/webhooks).\n\nLet's have a look at how the `slack()` method is used:\n\n```python\n >>> from everysk.core.log import Logger\n >>> slack_instantiation = Logger()\n >>> slack_instantiation.slack(title='title of the message', message='body of the message', color='danger')\n '2024-05-23 13:17:22,734 - Slack message: title of the message -> body of the message'\n```\n\n### Workers Module\n\nThe `workers.py` file provides a framework for managing and executing tasks using Google Cloud Tasks within the `everysk` ecosystem. It utilizes Google Cloud Tasks to enqueue and process asynchronous tasks, suitable for handling operations that require delay or scheduling.\n\nBelow we have an usage example of deploying tasks using the `TaskGoogle` class:\n\n```python\n >>> from everysk.core.workers import TaskGoogle\n >>> task = TaskGoogle(worker_url='https://example.com/worker', worker_id='example_worker_id')\n >>> task.save(timeout=30.0, retry_times=3)\n```\n\nThis example shows how to initialize a task with a specific worker URL and worker ID, then save it to [**Google Cloud Tasks**](https://cloud.google.com/tasks/docs).\n\n### Firestore Module\n\nModule **firestore.DocumentCached** is a Redis/Firestore document. This uses Redis for\nread the data and Redis/Firestore to store the data. To keep the cache synchronized\nwith Firestore, use everysk/cloud_function. With this when we alter the data using\nFirestore interface the cache will be updated.\n\n```python\n >>> from everysk.core.firestore import DocumentCached\n >>> doc = Document(_collection_name='collection', firestore_id='firestore_id')\n >>> doc.firestore_id\n 'firestore_id'\n```\n\n### String Module\n\nThe `string.py` module in the `everysk` library provides a handful of utility functions designed for string manipulation and validation, this is useful for handling text data in a variety of programming and data processing contexts.\n\nBelow we have an example of the `pluralize()` method that transforms the string into it's pluralized version\n\n```python\n >>> from everysk.core.string import pluralize\n >>> pluralize('system')\n 'systems'\n```\n\nBelow is another example of a method that converts the current string into the snake case format.\n\n```python\n >>> from everysk.core.string import snake_case\n >>> snake_case('CustomIndex')\n 'custom_index'\n```\n\n### Threads Module\n\nThe `threads.py` module offers different methods for managing [concurrent execution](https://en.wikipedia.org/wiki/Concurrent_computing) using threads, tailored specifically for environments that require parallel processing.\n\nBelow we have an example of code that executes a task asynchronously with a simple thread management.\n\n```python\n >>> from everysk.core.threads import Thread\n\n >>> def sum(a: int, b: int) -> int:\n ... return a + b\n ...\n >>> thread = Thread(target=sum, args=(1, 2))\n >>> task.start()\n >>> task.join()\n 3\n```\n\nThis module is proved to be useful for applications within the `everysk` infrastructure that require parallel computation or asynchronous task management.\n\n### Serialize Module\n\nThe serialize module is designed to handle serialization and deserialization of complex Python objects to and from JSON format, with specific support for dates, custom objects, and structured data.\n\nHere is an example for serializing a Python object to a JSON string in bytes:\n\n```python\n >>> from everysk.core.serialize import dumps\n >>> class MyClass:\n ... def __init__(self, worker_name, worker_id):\n ... self.worker_name = worker_name\n ... self.worker_id = worker_id\n ...\n >>> def _default(obj):\n ... if isinstance(obj, MyClass):\n ... return obj.__dict__\n ... raise TypeError(f'Type {type(obj)} is not serializable')\n ...\n >>> my_obj = MyClass('sample_worker', 'sample_worker_id')\n >>> serialized_data = dumps(my_obj, default=_default)\n```\n\n### Number Module\n\nThe `number.py` module is designed to provide utility functions related to numerical operations.\n\nBelow we have an implementation of the function `is_float_convertible` that returns a boolean indicating whether the value can be converted to a float point value or not.\n```python\n >>> from everysk.core.numbers import is_float_convertible\n >>> is_float_convertible('3.14')\n True\n\n >>> is_float_convertible(5)\n True\n\n >>> is_float_convertible('not a float')\n False\n```\n\n### Redis Module\n\nThe **Redis** module is designed to interact with a Redis server to store, retrieve and manage cached data.\n\nBelow is an example of how to use the `acquire()` method to verify if a key is locked by the current lock.\n\n```python\n >>> from everysk.core.redis import RedisLock\n >>> redis_lock = RedisLock(name='test_name', timeout=1, host='1.0.0.0', port=4435)\n >>> redis_lock.acquire('example_lock_key')\n 'Lock acquired for key \"example lock_key\"'\n```\n\n## Installation\n\nHere you can access the instructions on how to install the `everysk-beta` library using pip.\n\nTo install the `everysk-beta` library, you will need to use pip's `install` command along with the `--index-url` option that allows you to specify the PyPI server from which to install the package.\n\nReplace `PYPI_HOST` with the actual host of your PyPI server. Then run the following command:\n\n```bash\n pip install --index-url https://PYPI_HOST everysk-beta\n```\n\n### Verifying the Installation\n\nAfter installing the library, it's a good practice to verify if the installation was successful. Here is how to achieve this:\n\n#### 1. Open a terminal\n\n#### 2. Start the Python interpreter by typing `python` and pressing `Enter`\n\n#### 3. In the Python interpreter, type the following command then press `Enter`:\n\n```python\n import everysk\n```\n\nIf the library has been installed correctly, this command should complete without any errors. If the library is not installed or there's a problem with the installation, Python will raise a `ModuleNotFoundError`\n\n\n## Running Tests\n\nThis section provides instructions on how to run tests for the project. There are two scenarios, the first one is running tests in a development environment and the second one is running tests after the library has been installed from PyPI.\n\n### Running Tests in Development Environment\n\nIn a development environment you can use the provided shell script to run the tests. The script sets up the necessary environment and then run the tests. To execute the tests, open a bash terminal and run the following command.\n\n```bash\n ./run.sh tests\n```\n\n### Running Tests After the Library is Installed\n\nAfter the library has been installed in your project from PyPI, you can start running tests using Python's built-in unittest module. To run tests use the following command:\n\n\n```bash\n python3 -m unittest everysk.core.tests\n```\n\nThe command uses Python's unittest module as mentioned above as a script, which then runs the test in the `everysk.core.tests` package.\n\n\n## Running Tests with coverage\n\nCode coverage us a way of measuring how many lines of code are executed while the automated tests are running.\n\nTo run tests along with a coverage report, you can use the provided shell script. The script will not only run the tests but also generate a coverage report that shows the percentage of code that was executed during the tests.\n\nThis is useful to identify sections of your code that are not being tested and may need additional tests.\n\n#### 1. Open a terminal in your Visual Studio Code environment.\n\n#### 2. Run the following command.\n\n```bash\n ./run.sh coverage\n```\n\nThis command executes the `run.sh` script with the `coverage` argument. The report will be displayed in the terminal after the script completed the tests.\n\n**Remember:** a high coverage percentage is generally good, but 100% coverage does not ensures that your code is free from bugs or any other problem that might occur in your code. The full coverage just means that all the lines in your code were executed during the tests.\n\n\n## Contributing\n\nContributions are always welcome and greatly appreciated!\n\nGo to the repository [link](https://github.com/Everysk/everysk-lib) and click on the `Fork` button to create your own copy of the everysk library.\n\nThen clone the project in your own local machine by running the command below or using the **GitHub Desktop**.\n\n```bash\n git clone https://github.com/<your-username>/everysk-lib.git everysk-yourusername\n```\n\nThis section creates a directory called `everysk-yourusername` to center all your code.\n\nAfter that you can change the directory by:\n\n```bash\n cd everysk-yourusername\n```\n\nCreate the **upstream** repository which will refer to the main repository that you just forked.\n\n```bash\n git remote add upstream https://github.com/Everysk/everysk-lib.git\n```\n\nNow run the following commands to make sure that your clone is up-to-date with main everysk repository\n\n```bash\n git checkout main\n git pull upstream main\n```\n\nShortly after, create a new branch to add your code\n\n```bash\n git checkout -b brand-new-feature\n```\n\nThe command above will automatically switch to this newly created branch. At this moment your are able to make your modifications to the code and commit locally as you progress.\n\nAfter all the code changes, you can submit your contribution by pushing the changes to your fork on GitHub:\n\n```bash\n git push origin brand-new-feature\n```\n\nThe command above ensures that all the modifications that you've made are up-to-date with your current branch.\n\nAt the end of this process you will need to make a **Pull Request** to the main branch.\n\nTo achieve this, go to the GitHub page of the project and click on the `Pull requests` tab, then click on `New pull request` button.\n\nThis will open a new section used to compare branches, now choose your branch for merging into the main branch and hit the `Create pull request` button.\n\n## License\n\n(C) Copyright 2023 EVERYSK TECHNOLOGIES\n\nThis is an unpublished work containing confidential and proprietary\ninformation of EVERYSK TECHNOLOGIES. Disclosure, use, or reproduction\nwithout authorization of EVERYSK TECHNOLOGIES is prohibited.\n\nDate: Jan 2023\n\nContact: contact@everysk.com\n\nURL: https://everysk.com/\n",
"bugtrack_url": null,
"license": "(C) Copyright 2023 EVERYSK TECHNOLOGIES This is an unpublished work containing confidential and proprietary information of EVERYSK TECHNOLOGIES. Disclosure, use, or reproduction without authorization of EVERYSK TECHNOLOGIES is prohibited. Date: Jan 2023 Contact: fscariott@everysk.com URL: https://everysk.com/",
"summary": "Generic lib to share python code on Everysk.",
"version": "1.6.1381",
"project_urls": {
"Homepage": "https://everysk.com/"
},
"split_keywords": [
"python",
" setuptools",
" development",
" lib"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8e53431d790ff784d0b29d9bdf55deae7c89ee02055afa24de7bf62c8042e665",
"md5": "46d7fe8b1939a0a14d129b7f7084cab5",
"sha256": "97677754e5408f3c47e296cd556508253694315db6eb3152ab529144d656f563"
},
"downloads": -1,
"filename": "everysk_beta-1.6.1381-py3-none-any.whl",
"has_sig": false,
"md5_digest": "46d7fe8b1939a0a14d129b7f7084cab5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 355009,
"upload_time": "2024-12-18T19:54:48",
"upload_time_iso_8601": "2024-12-18T19:54:48.146928Z",
"url": "https://files.pythonhosted.org/packages/8e/53/431d790ff784d0b29d9bdf55deae7c89ee02055afa24de7bf62c8042e665/everysk_beta-1.6.1381-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0b0dfc52e699873d36969f6af86306de35d164b4e3759e2c679a242793f4eeaa",
"md5": "23f0af20ceaad2c96eca4185539f4e0f",
"sha256": "06b2ad23a3e0d33fcde19dfb4eba4c4c2a35f6d604dfb840a852ecc7fd3ef71a"
},
"downloads": -1,
"filename": "everysk_beta-1.6.1381.tar.gz",
"has_sig": false,
"md5_digest": "23f0af20ceaad2c96eca4185539f4e0f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 267887,
"upload_time": "2024-12-18T19:54:51",
"upload_time_iso_8601": "2024-12-18T19:54:51.736429Z",
"url": "https://files.pythonhosted.org/packages/0b/0d/fc52e699873d36969f6af86306de35d164b4e3759e2c679a242793f4eeaa/everysk_beta-1.6.1381.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-18 19:54:51",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "everysk-beta"
}