Metadata-Version: 2.4
Name: pytpro
Version: 0.2.3
Summary: A simple Python tools package by Ibrahim Akhlaq
Author: Ibrahim Akhlaq
Author-email: ibakhlaq@gmail.com
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: license-file
Dynamic: requires-python
Dynamic: summary

<p align="center">
  <img src="https://i.postimg.cc/BjSmyvYv/download.png" width="200" alt="pytpro logo">
</p>


<p align="center">Pytpro</p>

**pytpro** is a lightweight Python package by Ibrahim Akhlaq that provides powerful utility functions for math, randomness, and HTML rendering. It's clean, minimal, and built to feel like magic.
---
# API REFERENCE
## 🚀 Features
### ➕ Math Functions:
- `add(a, b):`

The _`add()`_ function takes two numbers __`a`__ and __`b`__ and returns their sum.

- `subtract(a, b):`

The _`subtract()`_ function takes two numbers __`a`__ and __`b`__ and returns their difference __`a`-`b`__.
- `multiply(a, b):`

The _`multiply()`_ function takes two numbers __`a`__ and __`b`__ and returns their product.
- `divide(a, b):`

The _`divide()`_ function takes two numbers __`a`__ and __`b`__ and returns their quotient __`a`/`b`__.
- `modulus(a, b):`

The _`modulus()`_ function takes two numbers __`a`__ and __`b`__ and returns the remainder of __`a`/`b`__.
- `floordivision(a, b):`

The _`floordivision()`_ function takes two numbers __`a`__ and __`b`__ and returns the largest integer less than or equal to __`a`/`b`__.
- `square(a)` / `cube(a):`

These functions return the square or cube (respectively) of a number __`a`__.
- `squareroot(a)` / `cuberoot(a):`

These functions return the square root or cube root (respectively) of a number __`a`__.
- `absolutevalue(a):`

The _`absolutevalue()`_ function returns the absolute value of a number __`a`__.
- `roundoff(a):`

The _`roundoff()`_ function rounds a number __`a`__ to the nearest integer.
- `exponent(a, b)` / `power(a, b)`

These functions return __`a`__ raised to the power of __`b`__.They are the same functions but they have different names for convenience.

### 🔢 Random Number Generators
- `randint(start=0, end=100):`

The _`randint()`_ function generates a random integer between __`start`__ and __`end`__ (inclusive). The default value is 0 to 100.
- `randfloat():`

This function (_`randfloat()`_) generates a random floating-point number between 0 and 1. It requires no parameters or arguments, and if you want to generate a random float in a specific range, you can use the _`randomfloatpositive(start, end)`_ or *`randomfloatnegative(start, end)`* functions. Inputting an argument or parameter could result in errors.
- `randomintpositive(start, end, step=1):`

The function _`randomintpositive()`_ generates a random integer between __`start`__ and __`end`__ (inclusive) with a step size of __`step`__.
The return value of this function will always be a positive value, whether the input is positive or negative.
- `randomintnegative(start, end, step=1):`

The function _`randomintnegative()`_ generates a random integer between __`start`__ and __`end`__ (inclusive) with a step size of __`step`__.
The only difference between this function and the _`randomintpositive()`_ function is that the generated integer will return a negative value, whether the input is positive or negative.
- `randomfloatpositive(start, end):`

The function _`randomfloatpositive()`_ generates a random floating-point number between __`start`__ and __`end`__ (inclusive). Just like the _`randomintpositive()`_ function, the return value of this function will always be a positive value, whether the input is positive or negative.
- `randomfloatnegative(start, end):`

The function _`randomfloatnegative()`_ generates a random floating-point number between __`start`__ and __`end`__ (inclusive). Just like the _`randomintnegative()`_ function, the return value of this function will always be a negative value, whether the input is positive or negative.
- `randomfloat(start, end):`

The function _`randomfloat()`_ generates a random floating-point number between __`start`__ and __`end`__ (inclusive).

### 📐 Trigonometry & Logs
```javascript
(1) sine(x)
(2) cosine(x)
(3) tangent(x)
(4) arctangent(x)
(5) log_base_2(x)
(6) log_base_10(x)
(7) natural_log(x)
```
The functions above return the sine, cosine, tangent, arctangent, log base 2, log base 10, and natural logarithm of a number __*`x`*__ respectively.

---
### 📏 Constants
```python
`pi()`, `e()`, `goldenratio()`, `tau()`
`speedoflight()`, `planckconstant()`, `gravitationalconstant()`
`electronmass()`, `protonmass()`, `neutronmass()`
`electronvolt()`, `joule()`, `kilojoule()`, `megajoule()`, `gigajoule()`, `terajoule()`, `petajoule()`, `exajoule()`
```
The functions above return the value of their respective constants. Note that the functions have no parameters or arguments. If any parameter or argument is provided, it could result in errors that are extremely hard to diagnose.

---

## HTML RENDERING
### `write(text)`
You can use the `write()` function to render text.
####     Example
```python
import pytpro as py
py.write("Hello World!")
```
#### Output
```HTML
<p>Hello World!</p>
```
- <p>Hello World!</p>


### `title(text)`
You can use the `title()` function to render a title as HTML text.
####     Example
```python
import pytpro as py
py.title("Hello World!")
```
#### Output
```HTML
<h1>Hello World!</h1>
```
- <h1>Hello World!</h1>

### `header(text)`
You can use the `header()` function to render a header as HTML text.
####     Example
```python
import pytpro as py
py.header("Hello World!")
```
#### Output
```HTML
<h2>Hello World!</h2>
```
- <h2>Hello World!</h2>

### `subheader(text)`
You can use the `subheader()` function to render a subheader as HTML text.
####     Example
```python
import pytpro as py
py.subheader("Hello World!")
```
#### Output
```HTML
<h3>Hello World!</h3>
```
- <h3>Hello World!</h3>
### `caption(text)`
You can use the `caption()` function to render a caption as HTML text.
####     Example
```python
import pytpro as py
py.caption("Hello World!")
```
#### Output
```HTML
<p style='font-size: 0.9em; color: gray;'>Hello World!</p>
```
- <p style='font-size: 0.9em; color: gray;'>Hello World!</p>

### `htmlcssjs(html_fragment)`
You can use the `htmlcssjs()` function to render raw HTML, CSS, and Javascript code.
####     Example
```python
import pytpro as py
py.htmlcssjs("""
<style>
button {
    background-color: red;
    color: white;
}
</style>
<button onclick='click()'>Hello World!</button>
<p id="output"></p>
<script>
  const output = document.getElementById('output');
  function click() {
    output.innerHTML = 'Hello World!';
  }
</script>
""")
```
#### Output
```HTML
<style>
button {
    background-color: red;
    color: white;
}
</style>
<button onclick='click()'>Hello World!</button>
<p id="output"></p>
<script>
  const output = document.getElementById('output');
  function click() {
    output.innerHTML = 'Hello World!';
  }
</script>
```
- <style>
button {
    background-color: red;
    color: white;
}
</style>
<button onclick='click()'>Hello World!</button>
<p id="output">{javascript is not supported in PYPI}</p>

### Alert Boxes
#### `alertbox_red(text)`
#### `alertbox_green(text)`
#### `alertbox_blue(text)`
#### `alertbox_yellow(text)`
#### `alertbox_purple(text)`
#### `alertbox_orange(text)`
#### `alertbox_pink(text)`
#### `alertbox_cyan(text)`
#### `alertbox_lime(text)`
#### `alertbox_brown(text)`
#### `alertbox_gray(text)`
#### `alertbox_black(text)`

You can use the `alertbox_*()` functions to display alert boxes. Each function takes a text argument, which is the message to be displayed in the alert box. The alert boxes have different colors and styles, making them visually distinct from each other.

### Example
```python
import pytpro as py
py.alertbox_red("Hello World!")
```
#### Output
```HTML
    <div style='
        padding: 16px;
        margin: 10px 0;
        background-color: #fdecea;
        color: #b00020;
        border-left: 6px solid #b00020;
        border-radius: 4px;
        font-family: sans-serif;
    '>
        Hello World!
    </div>
```

  <p align="left">
  <img src='https://i.postimg.cc/MTQNyRsJ/pypi.png' border='0' alt='pypi'/></a>
  </p>


### Toast Notifications (auto-fade)
- `toast(text)` – white default
- `toast_red(text)`
- `toast_green(text)`
- `toast_blue(text)`
- `toast_black(text)`
- `toast_pink(text)`

You can use the `toast()` function to display a toast notification with a default color of white. The function takes a text argument, which is the message to be displayed in the toast notification. The toast notification will automatically fade out after a few seconds.

Disclaimer: This feature is experimental and may not work as expected in all cases. It is not recommended to use this yet, as it is still being developed and may have bugs or issues. Fixes will be applied in future updates.

---

# Markdown Preview

### `markdown(text)`

You can use the `markdown()` function to display markdown text.

### Example:
```python
import pytpro as py
py.markdown("""
# Hello World!
This is a paragraph with **bold**, *italic*, and `inline code`.
""")
```
```HTML
<h1> Hello World!</h1>
<p>This is a paragraph with <strong>bold</strong>, <em>italic</em>, and <code>inline code</code>.</p>
```
- <p style="font-size: 30px;font-weight: 2905; ">Hello World!</p>

  This is a paragraph with **bold**, *italic*, and `inline code`.

For more information about Markdown formatting and its syntax, see the [Markdown documentation](https://www.markdownguide.org/), [cheat sheet](https://www.markdownguide.org/cheat-sheet/), [basic syntax](https://www.markdownguide.org/basic-syntax/), or [extended syntax](https://www.markdownguide.org/extended-syntax/).
---
<p style="text-align: center !important;
           font-size: 50px;
              color: #838383ff;
              font-weight: bold;
              font-family: sans-serif;
              text-align: center ">Pytpro</p>

# 🖥️ Example Usage

```python
import pytpro

pytpro.add(2, 3)
pytpro.square(6)
pytpro.pi()
pytpro.htmlcssjs("<h1>Hello!</h1><p>This is raw HTML.</p>")
```

# 🖥️ Instructions to install:

To install locally from your project directory, open PowerShell or terminal and run:

```bash
pip install pytpro
```
<pre>
 _______  ___    ___ ________  _______    _________    ________
|   ___  \\  \  /  /|__    __||   ___  \ |   ___   | /  ______  \
|  |___|  |\  \/  /    |  |   |  |___|  ||  |___|  ||  /      \  |
|   _____/  \    /     |  |   |   _____/ |    ____/ |  |      |  |
|  |         \  /      |  |   |  |       |    \___  |  |      |  |
|  |         |  |      |  |   |  |       |  |\__  \_|  \______/  |
|__|         |__|      |__|   |__|       |__|   \____\ ________ /
</pre>

__version:0.3.0__
