diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9b9eb92 --- /dev/null +++ b/.gitignore @@ -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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..79f7c53 --- /dev/null +++ b/CONTRIBUTING.md @@ -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. diff --git a/README.md b/README.md index a5a10a0..36a161c 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/general_utils/__init__.py b/general_utils/__init__.py new file mode 100644 index 0000000..504d656 --- /dev/null +++ b/general_utils/__init__.py @@ -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 * diff --git a/general_utils/example_utils.py b/general_utils/example_utils.py new file mode 100644 index 0000000..e637f53 --- /dev/null +++ b/general_utils/example_utils.py @@ -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 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..594c3d7 --- /dev/null +++ b/setup.py @@ -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", +)