Skip to content

Commit

Permalink
Add initial project structure and configuration files
Browse files Browse the repository at this point in the history
- Created MANIFEST.in to include necessary files for packaging.
- Added pyproject.toml for build system configuration and tool settings (Black, isort, mypy, pytest).
- Updated README.md with installation instructions and development setup.
- Introduced setup.py for package distribution.
- Added GitHub Actions workflows for testing and publishing to PyPI.
- Initialized argilla_dataset_manager package with core components.
  • Loading branch information
jordanrburger committed Dec 1, 2024
1 parent 979ac24 commit 8ee1a0e
Show file tree
Hide file tree
Showing 7 changed files with 224 additions and 38 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish to PyPI

on:
push:
tags:
- 'v*' # Trigger on version tags

jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build package
run: python -m build

- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
twine check dist/*
twine upload dist/*
46 changes: 46 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
pip install pytest pytest-cov black isort mypy
- name: Check code formatting
run: |
black . --check
isort . --check
- name: Type check
run: mypy .

- name: Run tests
run: |
pytest tests/ --cov=argilla_dataset_manager --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
fail_ci_if_error: true
8 changes: 8 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
include LICENSE
include README.md
include requirements.txt
include pyproject.toml
recursive-include argilla_dataset_manager *.py
recursive-include argilla_dataset_manager py.typed
recursive-include examples *.py
recursive-include tests *.py
102 changes: 64 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,30 @@ A Python-based tool for managing and uploading datasets to Argilla, specifically
- Workspace management
- Robust error handling and logging

## Prerequisites
## Installation

- Python 3.x
- Argilla server access
- Required CSV data files
### From PyPI (Recommended)

## Installation
```bash
pip install argilla-dataset-manager
```

### From Source

1. Clone the repository:
```bash
git clone https://github.com/jordanrburger/argilla_dataset_manager.git
cd argilla-dataset-manager
```

2. Install dependencies:
2. Install in development mode:
```bash
pip install -r requirements.txt
pip install -e .
```

3. Create a `.env` file in the root directory with your Argilla credentials:
## Configuration

Create a `.env` file in your project directory with your Argilla credentials:
```env
ARGILLA_API_URL=your_argilla_api_url
ARGILLA_API_KEY=your_api_key
Expand All @@ -40,8 +44,7 @@ ARGILLA_API_KEY=your_api_key
### 1. Create a Text Classification Dataset

```python
from utils import DatasetManager, get_argilla_client
from datasets import SettingsManager
from argilla_dataset_manager import DatasetManager, get_argilla_client, SettingsManager

# Initialize
client = get_argilla_client()
Expand Down Expand Up @@ -158,19 +161,58 @@ The `SettingsManager` provides several predefined templates:
- Create datasets with custom fields
- Flexible metadata configuration

## Development

### Setup Development Environment

1. Clone the repository:
```bash
git clone https://github.com/jordanrburger/argilla_dataset_manager.git
cd argilla-dataset-manager
```

2. Create a virtual environment:
```bash
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
```

3. Install development dependencies:
```bash
pip install -e ".[dev]"
```

### Running Tests

```bash
pytest tests/
```

### Code Style

This project uses:
- Black for code formatting
- isort for import sorting
- mypy for type checking

To format code:
```bash
black .
isort .
mypy .
```

## Project Structure

```
├── main.py # Main application entry point
├── config.py # Configuration settings
argilla_dataset_manager/
├── __init__.py # Package initialization
├── utils/
│ ├── argilla_client.py # Argilla API interaction
│ ├── dataset_manager.py # Dataset management
│ ├── data_loader.py # Data loading utilities
│ └── logger.py # Logging configuration
├── datasets/
│ └── settings_manager.py # Dataset settings and templates
└── examples/ # Usage examples and tutorials
└── datasets/
└── settings_manager.py # Dataset settings and templates
```

## Error Handling
Expand All @@ -183,28 +225,12 @@ The library includes comprehensive error handling:

## Contributing

Feel free to submit issues and enhancement requests.
1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## License

MIT License

Copyright (c) 2023 Jordan Burger

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
MIT License - see the [LICENSE](LICENSE) file for details
10 changes: 10 additions & 0 deletions argilla_dataset_manager/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""
Argilla Dataset Manager - A tool for managing and uploading datasets to Argilla.
"""

from argilla_dataset_manager.utils.dataset_manager import DatasetManager
from argilla_dataset_manager.utils.argilla_client import get_argilla_client
from argilla_dataset_manager.datasets.settings_manager import SettingsManager

__version__ = "0.1.0"
__all__ = ["DatasetManager", "get_argilla_client", "SettingsManager"]
26 changes: 26 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[build-system]
requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2"]
build-backend = "setuptools.build_meta"

[tool.black]
line-length = 100
include = '\.pyi?$'

[tool.isort]
profile = "black"
multi_line_output = 3
line_length = 100

[tool.mypy]
python_version = "3.8"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
disallow_incomplete_defs = true

[tool.pytest.ini_options]
minversion = "6.0"
addopts = "-ra -q"
testpaths = [
"tests",
]
37 changes: 37 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from setuptools import setup, find_packages

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

with open("requirements.txt", "r", encoding="utf-8") as fh:
requirements = [line.strip() for line in fh if line.strip() and not line.startswith("#")]

setup(
name="argilla-dataset-manager",
version="0.1.0",
author="Jordan Burger",
author_email="jordanrburger@gmail.com",
description="A tool for managing and uploading datasets to Argilla",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/jordanrburger/argilla_dataset_manager",
packages=find_packages(exclude=["tests*", "examples*"]),
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
],
python_requires=">=3.8",
install_requires=requirements,
include_package_data=True,
package_data={
"argilla_dataset_manager": ["py.typed"],
},
)

0 comments on commit 8ee1a0e

Please sign in to comment.