semvec/pypi-packages huggingface dataset:
cppvalidate 0.0.2
A small example package
Requires Python: >=3.6

# Example Package

This is a simple example package. You can use
[GitHub-flavored Markdown](https://guides.github.com/features/mastering-markdown/)
to write your content.

This package provides a set of validation utilities 
- Email validation 
- Strong password validation
- phone number validation

## Installation
You can install this package using pip
simple-kmeans 0.1.2
Implementation of K-means algorithm from scratch with adaptive distance metrics
Requires Python: >=3.6

# Custom K-Means Clustering

This repository contains an implementation of the K-Means clustering algorithm from scratch, designed to work similarly to `sklearn.cluster.KMeans`. However, it uses a **custom distance metric** based on the dimensionality of the input data:

- **1D Data** → Uses **Manhattan Distance** (L1 norm)
- **2D Data** → Uses **Euclidean Distance** (L2 norm)
- **3D and above** → Cosine Distance


## Example Output
when `k=3`
![Clustered Data](example/example_graph.png)

## Features
✅ Fully implemented from scratch
✅ Supports multiple distance metrics based on input dimensionality
✅ Works like Scikit-learn’s KMeans



## Installation
You can install this package by cloning the repository and using `pip`:
```sh
pip install .
```
Or you can install it from pypi
```
pip install simple-kmeans
```


## Usage
Here’s an example of how to use the custom K-Means implementation:

```python
from simple_kmeans import KMeans
import numpy as np
import matplotlib.pyplot as plt

# Generate sample data
X = np.array([[1, 2], [1.5, 1.8], [5, 8], [8, 8], [1, 0.6], [9, 11]])

# Initialize and fit the model
kmeans = KMeansCustom(k=2, max_iters=100)
kmeans.fit(X)

# Get cluster centers and labels
print("Cluster Centers:", kmeans.centroids)
print("Labels:", kmeans.labels)

# Plot results
plt.scatter(X[:, 0], X[:, 1], c=kmeans.labels, cmap='viridis')
plt.scatter(kmeans.centroids[:, 0], kmeans.centroids[:, 1], marker='x', c='red', s=200, label='Centroids')
plt.legend()
plt.title("Custom K-Means Clustering")
plt.show()
```


## License
This project is open-source and available under the **MIT License**.



## Contributions
Contributions, issues, and feature requests are welcome! Feel free to fork this repository and submit a pull request.
crimson-tracer 0.1.5
A lightweight Python tracer for capturing and analyzing function call events with tree visualization and JSON serialization support.
Requires Python: >=3.9

# Crimson Tracer

Crimson Tracer is a lightweight Python tracing utility that records function call events and provides useful insights into your code execution. It captures details such as function inputs, file names, line numbers, and more, allowing you to analyze the call flow. Additionally, you can convert raw trace events into a nested tree structure and serialize them to JSON for further processing.

## Features

- **Function Call Tracing:** Automatically capture call, line, and return events during execution.
- **Tree Generation:** Convert a linear list of trace events into a nested tree structure for easy visualization.
- **JSON Serialization:** Serialize trace data to JSON, ensuring all dictionary keys are strings.
- **Frame Filtering:** Include or exclude specific frames based on filename patterns using the built-in `FrameFilter`.
- **Customizable Event Editing:** Modify trace events on the fly with an optional custom event editor.

## Install

```sh
pip install crimson-tracer
```

## Example

### Tracer

The `TraceManager` collects all called functions along with valuable details such as function inputs and execution context.  
For a complete example, see [tracer.ipynb](./example/tracer.ipynb).

```python
from crimson.tracer import TraceManager

def sample_function():
    # Your function logic here
    return "result"

# Run the tracer on the sample function
TraceManager.run_trace(sample_function, name="sample_trace")
trace_events = TraceManager.get_trace("sample_trace")
```

### Node

Convert the traced result into a nested tree structure for a clearer view of the call hierarchy using `generate_trace_tree`.  
For more details, refer to [node.ipynb](./example/node.ipynb).

```python
from crimson.tracer import generate_trace_tree, TraceManager

trace_events = TraceManager.get_trace("sample_trace")
trace_tree = generate_trace_tree(trace_events)
```

## API Overview

- **TraceManager:**  
  Manages the tracing process, collects trace events, and provides methods to run and retrieve traces.
  
- **TraceEvent:**  
  A Pydantic model that represents a trace event with details like function name, filename, line number, event type, local variables, and more.
  
- **generate_trace_tree:**  
  Transforms a list of trace events into a nested tree structure to reflect the call hierarchy.
  
- **dumps:**  
  Serializes trace data into a JSON-formatted string with all dictionary keys as strings.
  
- **FrameFilter:**  
  Allows filtering of stack frames based on inclusion and exclusion rules to refine the tracing process.

Crimson Tracer offers a flexible and efficient way to monitor and analyze function calls in your Python applications. Enjoy exploring your code's execution flow with ease!