Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
*.manifest
*.spec

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Virtual environments
venv/
ENV/
env/
.venv

# IDEs
.vscode/
.idea/
*.swp
*.swo
*~

# OS
.DS_Store
Thumbs.db
70 changes: 70 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Contributing to general_utils

Thank you for considering contributing to general_utils! This document provides guidelines for adding new utility functions to the package.

## Adding New Utility Functions

1. **Create a new module** (optional if adding to existing module):
```bash
cd general_utils
touch your_module_name.py
```

2. **Write your utility function with proper documentation**:
```python
def your_function(arg1, arg2):
"""
Brief description of what the function does.

Args:
arg1 (type): Description of arg1
arg2 (type): Description of arg2

Returns:
type: Description of return value

Example:
>>> from general_utils.your_module_name import your_function
>>> your_function(1, 2)
3
"""
# Your implementation here
return result
```

3. **Optionally expose the function in `__init__.py`**:
```python
from .your_module_name import your_function
```

4. **Test your function**:
```bash
python3 -c "from general_utils.your_module_name import your_function; print(your_function(test_args))"
```

5. **Commit and push your changes**:
```bash
git add .
git commit -m "Add your_function to your_module_name"
git push
```

## Best Practices

- Write clear, descriptive docstrings for all functions
- Include type hints where appropriate
- Add usage examples in docstrings
- Keep functions focused and single-purpose
- Use meaningful variable and function names
- Follow PEP 8 style guidelines

## Code Style

- Use 4 spaces for indentation
- Keep lines under 100 characters when possible
- Use descriptive variable names
- Add comments for complex logic

## Questions?

If you have questions or need help, please open an issue on GitHub.
70 changes: 69 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,70 @@
# general_utils
Common costum functions across projects

Common custom functions across projects

## Description

This repository contains reusable Python utility functions that can be shared across multiple projects. It is designed to be installed directly from GitHub and used as a Python package.

## Installation

You can install this package directly from GitHub using pip:

```bash
pip install git+https://github.com/DaveCacci/general_utils.git
```

Or if you want to install a specific branch:

```bash
pip install git+https://github.com/DaveCacci/general_utils.git@branch-name
```

For development installation (editable mode):

```bash
git clone https://github.com/DaveCacci/general_utils.git
cd general_utils
pip install -e .
```

## Usage

After installation, you can import and use the utility functions in your projects:

```python
from general_utils.example_utils import greet, add_numbers

# Use the functions
print(greet("World")) # Output: Hello, World!
print(add_numbers(2, 3)) # Output: 5
```

## Adding New Utilities

To add new utility functions to this package:

1. Create a new Python module in the `general_utils/` directory (e.g., `string_utils.py`)
2. Define your functions with proper docstrings
3. Optionally, import them in `general_utils/__init__.py` for easier access
4. Commit and push your changes

## Structure

```
general_utils/
├── README.md
├── setup.py
├── .gitignore
└── general_utils/
├── __init__.py
└── example_utils.py
```

## Requirements

- Python >= 3.6

## License

This project is licensed under the MIT License.
11 changes: 11 additions & 0 deletions general_utils/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""
general_utils - Common custom functions across projects

This package provides utility functions that can be reused across multiple projects.
"""

__version__ = "0.1.0"
__author__ = "DaveCacci"

# Import utility functions here as the package grows
# Example: from .string_utils import *
43 changes: 43 additions & 0 deletions general_utils/example_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
"""
Example utility functions

This module contains example utility functions that demonstrate
how to add custom functions to this package.
"""


def greet(name):
"""
Simple greeting function as an example.

Args:
name (str): The name to greet

Returns:
str: A greeting message

Example:
>>> from general_utils.example_utils import greet
>>> greet("World")
'Hello, World!'
"""
return f"Hello, {name}!"


def add_numbers(a, b):
"""
Add two numbers together.

Args:
a (int/float): First number
b (int/float): Second number

Returns:
int/float: Sum of a and b

Example:
>>> from general_utils.example_utils import add_numbers
>>> add_numbers(2, 3)
5
"""
return a + b
21 changes: 21 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from setuptools import setup, find_packages

with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()

setup(
name="general_utils",
version="0.1.0",
author="DaveCacci",
description="Common custom functions across projects",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/DaveCacci/general_utils",
packages=find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires=">=3.6",
)