semvec/pypi-packages huggingface dataset:
refvars 0.7
Solving one of Python's biggest problems. Reference types (output variables) are not implemented.
Keywords: python, reference, variables, pointers, output, return, types, reference types, refvars

# Python Reference Variables `refvars`

This repository contains but two simple but extremely useful Python class, `new` and `Reference`.

**ALSO:** [C Pointers in Python](#c-pointers-in-python).

This holy grail of simple python hacks, `refvars` provides a convenient way to work with references to objects.
It allows you to set and get the value of the reference using simple `get` and `set` methods.

## Usage

To use the `refvars` class, simply import it into your Python script:

```python
import refvars
```

Then use `new` to create a reference to an object:

```python
# Create a reference.
ref = refvars.new[int](0).get_ref()
```

**Note**: that `new` will run a variety of runtime checks to ensure that the reference is being used correctly.

* The way these checks work is by very basic checking of source code.
* This can lead to some problems when trying to open your source code file with `inspect` module.

To fix this:

```python
refvars.disable_runtime_usage_checks()
```

Now, you can use the `Reference` to `get` and `set` the value of the reference:

```python
# To ensure that the initial value does actually change.
print(ref.get())  # 0

# If we want a function to modify the reference, we can pass the reference to the function.
def modify_reference(ref:"refvars.Reference[int]"):
    ref.set(1)

modify_reference(ref)

print(ref.get())  # 1
```

## Installation

To install the `refvars`, use pip:

```bash
pip install refvars
```

## C Pointers in Python

Yes, you heard it right. You can use `refvars` to access memory created by C code in Python.

```python
from refvars import alloc
```

The `alloc` is much the same to the `new` class. But instead we use `safe_access(< your cb >)` to safely access the memory.

```python
from refvars import alloc, Pointer

def callback(ptr:"Pointer") -> None:
	print(f"Address: {ptr.address}")
	# We even have basic error handling to stop you from writing more than 64 bytes.
	more_than_64 = b"X" * 65
	ptr.write(more_than_64)  # This will raise an error.
	
# This allocates 64 bytes of memory.
# Your callback will be called with a `Pointer` object as the only argument.
# On function return, the memory will be freed.
# Meaning that we are (hopefully) safe from memory leaks and cyber attacks.
alloc(64).safe_access(callback)
```

A working version you can use is:

```python
from refvars import alloc, Pointer

def callback(ptr:"Pointer") -> None:
	print(f"Address: {ptr.address}")
	data = b"Hello, World!"
	ptr.write(data)
	print(ptr.read(len(data)))  # b"Hello, World!"

alloc(1024).safe_access(callback)
```

## Confirmed versions of Python

* [x] 3.11 - Works perfectly on the old version (before c pointer update).
* [x] 3.12 - Works perfectly.

## License

Covered under the GNU General Public License v2.0.

## V0.7 released on 29th/5/2024

Redesign and added accessing c pointers from Python.
w3ml 1.0b20240529
Personal library using W3
Requires Python: >=3.7

## w3ml

### w3ml: Simplify Your Machine Learning Workflow 

**Introduction:**
Welcome to **w3ml**, the ultimate machine learning library designed specifically! Whether you are a seasoned data scientist or a business analyst venturing into the world of machine learning, w3ml offers an intuitive and powerful platform to streamline your model development process.

**Key Features:**
- **User-Friendly Interface:** w3ml provides a simple, yet powerful interface that allows users to build and deploy machine learning models with minimal coding.
- **Comprehensive Preprocessing Tools:** From data cleaning to feature engineering, our library includes a wide array of preprocessing tools to prepare your data efficiently.
- **Model Selection and Evaluation:** Easily compare multiple algorithms and choose the best-performing model with our built-in evaluation metrics and visualizations.
- **Automation and Hyperparameter Tuning:** Automate repetitive tasks and optimize model performance with advanced hyperparameter tuning techniques.
- **Scalability:** Designed to handle large datasets and integrate seamlessly with big data platforms, ensuring models are ready for enterprise-level deployment.
- **Support:** Dedicated support developer to assist you in every step of your machine learning journey.

**Why Choose w3ml?**
1. **Efficiency:** Save time and resources with automated workflows and optimized processes.
2. **Accessibility:** Make machine learning accessible to a broader audience within your organization.
3. **Flexibility:** Adaptable to various business needs and industry-specific applications.
4. **Integration:** Compatible with popular data science tools and frameworks, allowing for smooth integration into existing workflows.

**Getting Started:**
1. Install w3ml using pip:
    ```bash
    pip install w3ml
    ```
2. Training Model
    ```
    test_model = AutoBinaryML(
        model_name= 'test_model'
        , model_version = 'v1'
        , train_data = data
        , label = 'target'
        , time_limit = 60*5 
    )
    test_model.fit()
    ```
3. Predict 
    ```
    predicts = test_model.batch_prediction(data, 'predict')
    ```

Transform data into actionable insights with w3ml. Start your machine learning journey today and see the difference!

---

Elevate machine learning capabilities with w3ml, where simplicity meets power.