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.10.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.10-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fharvest-0.1.10.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.10.tar.gz
Algorithm Hash digest
SHA256 4a409d12445c89c5a743c1d6dfe4dbd4c384341e33a4053ade686fd049ab5e3a
MD5 8ab7dc8d6ca1bed653565b39caac0c7d
BLAKE2b-256 8a6718bc4a14f6fd0863fe621f245396599a779d80d3fef04e924ca6c36ae3a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for fharvest-0.1.10.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.10-py3-none-any.whl.

File metadata

  • Download URL: fharvest-0.1.10-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.10-py3-none-any.whl
Algorithm Hash digest
SHA256 bc962302925779b53c6e1f770aa72599bb9e84996cd32cfb9e785754eacbd063
MD5 5f963b332d5078f69a7a8d64443883b7
BLAKE2b-256 53f74ea4d51e1d217f3fefed3f618f2b7f534c73a445c5f117b1da1bffb54c31

See more details on using hashes here.

Provenance

The following attestation bundles were made for fharvest-0.1.10-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