Contributing
Contributions are welcome! Here's how to set up the project for development.
Development Setup
-
Clone the repository:
-
Create a virtual environment and install dependencies:
-
Install pre-commit hooks:
Running Tests
The project uses pytest for testing. You'll also need qpdf installed for PDF comparison tests:
# Install qpdf (Ubuntu/Debian)
sudo apt-get install qpdf
# Run all tests
pytest
# Run with coverage
pytest --cov=./brazilfiscalreport --cov-branch
# Run tests for a specific document type
pytest tests/test_danfe.py
Code Style
The project uses Ruff for linting and formatting. Pre-commit hooks will automatically check your code before each commit.
Regenerating Reference PDFs
When making changes to PDF output, you can regenerate the reference PDFs used in tests:
Warning
Only regenerate reference PDFs when you intentionally changed the PDF output. Always review the visual diff before committing.
Submitting Changes
- Fork the repository
- Create a feature branch (
git checkout -b my-feature) - Commit your changes
- Push to your fork and open a Pull Request
Make sure all tests pass and pre-commit hooks are clean before submitting.