Skip to main content

A tool for harvesting files from project directories

Project description

File Harvester (fharvest)

A Python utility for harvesting files from project directories. This tool helps you collect specific files from different project directories into a single destination directory.

Installation

pip install fharvest

Quick Start

from fharvest import FileHarvester

# Initialize harvester
harvester = FileHarvester(
    source_dirs=['app'],
    destination_dir='harvested_files'
)

# Copy files with default settings
harvester.copy_files()
Main Features
  • Collect files with specific extensions (.py, .js, .css, .json) from multiple source directories
  • Exclude specified files (e.g., init.py)
  • Support for additional file copying (.env, docker files, etc.)
  • Configurable file extensions and exclusion rules

Detailed Usage

Basic File Collection
# Default configuration
harvester = FileHarvester(
    source_dirs=['app'],
    destination_dir='harvested_files'
)

# Copy all supported files
harvester.copy_files()
Custom Configuration
# Custom extensions and exclusions
harvester = FileHarvester(
    source_dirs=['app', 'src'],
    destination_dir='output',
    excluded_files=['__init__.py', 'config.py'],
    file_extensions=['.py', '.yml', '.env']
)

# Include additional files
additional_files = [
    '.env',
    'docker-compose.yml',
    'Dockerfile',
    'requirements.txt',
]

harvester.copy_files(additional_files)

API Reference

FileHarvester Class

class FileHarvester:
    def __init__(
        self, 
        source_dirs: List[str], 
        destination_dir: str,
        excluded_files: Optional[List[str]] = None,
        file_extensions: Optional[List[str]] = None
    ):
        """
        Initialize the FileHarvester.

        Args:
            source_dirs: List of directories to search for files
            destination_dir: Directory where files will be copied
            excluded_files: List of files to exclude (default: ['__init__.py'])
            file_extensions: List of file extensions to copy 
                           (default: ['.py', '.js', '.css', '.json'])
        """

    def copy_files(self, additional_files: Optional[List[str]] = None) -> None:
        """
        Copy files from source directories to destination directory.

        Args:
            additional_files: Optional list of additional files to copy
        """
Examples

Common Use Cases

  1. Collection of Python files:
harvester = FileHarvester(
    source_dirs=['src'],
    destination_dir='dist',
    file_extensions=['.py']
)
harvester.copy_files()
  1. Docker project files:
harvester = FileHarvester(
    source_dirs=['app'],
    destination_dir='docker_build'
)
harvester.copy_files([
    'Dockerfile',
    'docker-compose.yml',
    '.dockerignore'
])
Development

To contribute to FHarvest:

  1. Clone the repository
  2. Install development dependencies:
pip install -e ".[dev]"
  1. Run tests:
pytest

Links

GitHub: github.com/kyony/fharvest Issues: github.com/kyony/fharvest/issues

License This project is licensed under the MIT License. Author Viktor Pryima (pryima.viktor@gmail.com)

This documentation:
- Provides clear installation instructions
- Shows quick start examples
- Details all main features
- Includes comprehensive API reference
- Demonstrates common use cases
- Includes development setup instructions
- Lists important links and license information

The format is optimized for both PyPI and GitHub display, with proper markdown formatting and code highlighting.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fharvest-0.1.1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fharvest-0.1.1-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file fharvest-0.1.1.tar.gz.

File metadata

  • Download URL: fharvest-0.1.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for fharvest-0.1.1.tar.gz
Algorithm Hash digest
SHA256 715a861431334184141adf7a709050bb66a8473668e7e46d985d9d1da5e4c95a
MD5 4f880c8beed4e9350e2a1eee7befd9cd
BLAKE2b-256 2818b07ef4f654b202bc156e4e088c8dddfa940a538eed96ea7b7cc5751bf1ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for fharvest-0.1.1.tar.gz:

Publisher: python-publish.yml on KYONY/fharvest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fharvest-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: fharvest-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for fharvest-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 75146613dc54d524cb0e35639732b836e68b0ce24b915592252ae124c5a673de
MD5 f2e49b7c8422542ba7146a75f41b0253
BLAKE2b-256 36794332b65fd060bb4118a46cec58d0bfa167a6ecb771ef1c886c64ad7dddd5

See more details on using hashes here.

Provenance

The following attestation bundles were made for fharvest-0.1.1-py3-none-any.whl:

Publisher: python-publish.yml on KYONY/fharvest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page