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
- Collection of Python files:
harvester = FileHarvester(
source_dirs=['src'],
destination_dir='dist',
file_extensions=['.py']
)
harvester.copy_files()
- 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:
- Clone the repository
- Install development dependencies:
pip install -e ".[dev]"
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
715a861431334184141adf7a709050bb66a8473668e7e46d985d9d1da5e4c95a
|
|
| MD5 |
4f880c8beed4e9350e2a1eee7befd9cd
|
|
| BLAKE2b-256 |
2818b07ef4f654b202bc156e4e088c8dddfa940a538eed96ea7b7cc5751bf1ef
|
Provenance
The following attestation bundles were made for fharvest-0.1.1.tar.gz:
Publisher:
python-publish.yml on KYONY/fharvest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fharvest-0.1.1.tar.gz -
Subject digest:
715a861431334184141adf7a709050bb66a8473668e7e46d985d9d1da5e4c95a - Sigstore transparency entry: 169800592
- Sigstore integration time:
-
Permalink:
KYONY/fharvest@7a85ac3db855042593855f5131a27ffc1d5d14f0 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/KYONY
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@7a85ac3db855042593855f5131a27ffc1d5d14f0 -
Trigger Event:
workflow_dispatch
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75146613dc54d524cb0e35639732b836e68b0ce24b915592252ae124c5a673de
|
|
| MD5 |
f2e49b7c8422542ba7146a75f41b0253
|
|
| BLAKE2b-256 |
36794332b65fd060bb4118a46cec58d0bfa167a6ecb771ef1c886c64ad7dddd5
|
Provenance
The following attestation bundles were made for fharvest-0.1.1-py3-none-any.whl:
Publisher:
python-publish.yml on KYONY/fharvest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fharvest-0.1.1-py3-none-any.whl -
Subject digest:
75146613dc54d524cb0e35639732b836e68b0ce24b915592252ae124c5a673de - Sigstore transparency entry: 169800594
- Sigstore integration time:
-
Permalink:
KYONY/fharvest@7a85ac3db855042593855f5131a27ffc1d5d14f0 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/KYONY
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@7a85ac3db855042593855f5131a27ffc1d5d14f0 -
Trigger Event:
workflow_dispatch
-
Statement type: