This guide explains how to set up the development environment and package the FileUtils project.
FileUtils/
├── src/
│ └── FileUtils/
│ ├── core/ # Core functionality
│ ├── storage/ # Storage implementations
│ ├── config/ # Configuration handling
│ └── utils/ # Utility functions
├── tests/
│ ├── unit/ # Unit tests
│ └── integration/ # Integration tests
├── docs/ # Documentation
├── scripts/ # Build and utility scripts
├── pyproject.toml # Project configuration
└── README.md # Project overview
-
Clone the repository:
git clone https://github.com/yourusername/FileUtils.git cd FileUtils
-
Create a Conda environment:
# Create new environment with Python 3.9+ conda create -n fileutils python=3.9 # Activate the environment conda activate fileutils # Optional: Install common development tools conda install pytest pytest-cov build twine
-
Install the package in development mode:
# Install in editable mode with all optional dependencies pip install -e ".[all]"
-
Verify the installation:
# Run a simple import test python -c "from FileUtils import FileUtils" # Run the test suite pytest tests/
# Install core dependencies
conda install pandas pyyaml python-dotenv
# Azure support
conda install -c conda-forge azure-storage-blob azure-identity
# Parquet support
conda install pyarrow
# Excel support
conda install openpyxl
# Install development tools
conda install pytest pytest-cov build twine
# Optional: Install documentation tools
conda install -c conda-forge sphinx sphinx_rtd_theme
The project uses pyproject.toml
for package configuration. Key sections include:
- Build System: Uses
setuptools
for building - Project Metadata: Name, version, description, etc.
- Dependencies:
- Core dependencies (pandas, pyyaml, etc.)
- Optional dependencies (azure, parquet, excel)
- Development dependencies
The project includes a comprehensive build script (scripts/build_package.py
) that:
- Cleans previous builds
- Verifies directory structure
- Checks version consistency
- Validates dependencies
- Builds the package
- Tests the installation
To build the package:
python scripts/build_package.py
Or manually:
python -m build
The package can be installed directly from GitHub using pip:
pip install git+https://github.com/yourusername/FileUtils.git
With optional dependencies:
# Install with Azure support
pip install "git+https://github.com/topij/FileUtils.git#egg=FileUtils[azure]"
# Install with all optional dependencies
pip install "git+https://github.com/topij/FileUtils.git#egg=FileUtils[all]"
Version numbers are maintained in:
src/FileUtils/version.py
pyproject.toml
When updating the version:
- Update the version in
src/FileUtils/version.py
- Update
pyproject.toml
- Run the build script to verify version consistency
Run tests using pytest:
pytest tests/
With coverage:
pytest tests/ --cov=FileUtils
The package uses optional dependency groups:
- azure: Azure Blob Storage support
- azure-storage-blob
- azure-identity
- parquet: Parquet file support
- pyarrow
- excel: Excel file support
- openpyxl
- all: All optional dependencies
- Version Mismatch: Ensure versions match in all files
- Missing Dependencies: Install all required dependencies
- Build Failures: Check the build script output for details
- Test Failures: Run tests with
-v
flag for verbose output - Conda Environment Issues:
- Use
conda list
to verify installed packages - If experiencing conflicts, try creating a fresh environment
- For package conflicts, try installing with
conda-forge
:conda install -c conda-forge package_name
- Use
conda env export > environment.yml
to save your environment configuration - Restore environment with
conda env create -f environment.yaml
- Use