Skip to content

Commit bb64bb1

Browse files
author
flywire
committed
Initial commit
0 parents  commit bb64bb1

43 files changed

Lines changed: 4083 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Create Tag & Publish Package
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: write
8+
packages: write
9+
id-token: write
10+
11+
jobs:
12+
tag_and_release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0 # Full history to check tags
19+
20+
- name: Setup Python 3.11
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: 3.11
24+
25+
- name: Determine today's tag
26+
id: vars
27+
run: |
28+
TAG="v$(date +'%Y.%m.%d')"
29+
echo "tag=$TAG" >> $GITHUB_OUTPUT
30+
31+
- name: Check if tag exists
32+
id: check_tag
33+
run: |
34+
if git rev-parse "${{ steps.vars.outputs.tag }}" >/dev/null 2>&1; then
35+
echo "exists=true" >> $GITHUB_OUTPUT
36+
else
37+
echo "exists=false" >> $GITHUB_OUTPUT
38+
fi
39+
40+
- name: Fail if tag exists (skip release)
41+
if: ${{ steps.check_tag.outputs.exists == 'true' }}
42+
run: |
43+
echo "Tag ${{ steps.vars.outputs.tag }} already exists; skipping tag creation and release."
44+
exit 1
45+
46+
- name: Create date-based tag
47+
run: |
48+
git config user.name "github-actions[bot]"
49+
git config user.email "github-actions[bot]@users.noreply.github.com"
50+
git tag -a "${{ steps.vars.outputs.tag }}" -m "Tag created by GitHub Actions on $(date)"
51+
git push origin "${{ steps.vars.outputs.tag }}"
52+
53+
- name: Update version in pyproject.toml
54+
run: |
55+
VERSION="${{ steps.vars.outputs.tag }}"
56+
VERSION="${VERSION#v}"
57+
sed -i "s/^version = .*/version = \"$VERSION\"/" pyproject.toml
58+
59+
- name: Commit version bump
60+
run: |
61+
VERSION="${{ steps.vars.outputs.tag }}"
62+
VERSION="${VERSION#v}"
63+
git add pyproject.toml
64+
git commit -m "ci: set version to $VERSION" || echo "No changes to commit"
65+
git push origin HEAD:main || true
66+
67+
- name: Build package
68+
run: |
69+
pip install build
70+
rm -rf dist/*
71+
python -m build
72+
73+
- name: Publish to PyPI
74+
uses: pypa/gh-action-pypi-publish@release/v1
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Deploy MkDocs
2+
on:
3+
push:
4+
branches:
5+
- main
6+
jobs:
7+
deploy:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- uses: actions/setup-python@v5
12+
with:
13+
python-version: 3.x
14+
- run: pip install mkdocs mkdocs-material mkdocstrings[python]
15+
- run: mkdocs gh-deploy --force

.github/workflows/python-tests.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Python Tests
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
python-version: [3.9, 3.12, 3.13]
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- name: Set up Python ${{ matrix.python-version }}
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install tox
27+
28+
- name: Run tests with tox
29+
shell: bash
30+
run: |
31+
PYTHON_VERSION=${{ matrix.python-version }}
32+
TOX_ENV="py${PYTHON_VERSION//./}"
33+
echo "Running tox environment: $TOX_ENV"
34+
tox -e $TOX_ENV

.gitignore

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
site/
10+
11+
# Distribution / packaging
12+
.Python
13+
build/
14+
develop-eggs/
15+
dist/
16+
downloads/
17+
eggs/
18+
.eggs/
19+
lib/
20+
lib64/
21+
parts/
22+
sdist/
23+
var/
24+
wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
pip-wheel-metadata/
29+
30+
# PyInstaller
31+
*.manifest
32+
*.spec
33+
34+
# Installer logs
35+
pip-log.txt
36+
pip-delete-this-directory.txt
37+
38+
# Unit test / coverage reports
39+
htmlcov/
40+
.tox/
41+
.nox/
42+
.coverage
43+
.cache
44+
.pytest_cache/
45+
.coverage.*
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
52+
# Jupyter Notebook
53+
.ipynb_checkpoints
54+
55+
# pyenv
56+
.python-version
57+
58+
# Environments
59+
env/
60+
venv/
61+
ENV/
62+
env.bak/
63+
venv.bak/
64+
65+
# IDEs and editors
66+
.vscode/
67+
.idea/
68+
*.sublime-project
69+
*.sublime-workspace
70+
71+
# macOS
72+
.DS_Store
73+
74+
# Logs and databases
75+
*.log
76+
*.sqlite3
77+
78+
# System files
79+
Thumbs.db

LICENSE

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
flyfield is licensed under the GNU General Public License version 3 or later (GPL-3.0-or-later).
2+
3+
Full license text available at: https://www.gnu.org/licenses/gpl-3.0.html

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
include README.md
2+
include LICENSE
3+
recursive-include flyfield *.py

README.md

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# flyfield
2+
3+
Transform static white box PDF forms into interactive forms for fast automation.
4+
5+
***
6+
## Overview
7+
8+
**flyfield** automatically analyzes static PDF forms, creates fillable fields, marks field locations for verification, fills and extracts data, and seamlessly converts money values between PDF text and spreadsheet/database numeric formats.
9+
10+
***
11+
## Key Features
12+
13+
- Generate interactive form fields and marked-up PDFs from PDF white box forms
14+
- Fill and export form data using CSV files
15+
- Seamlessly convert money values between PDF text and CSV number formats
16+
- Simple command-line interface for efficient workflows
17+
- Open source and flexible for diverse PDF automation needs
18+
19+
***
20+
## Installation
21+
22+
Install with pipx:
23+
24+
```
25+
pipx install flyfield
26+
```
27+
28+
Check version:
29+
30+
```
31+
flyfield --version
32+
```
33+
34+
Or install via pip:
35+
36+
```
37+
pip install flyfield
38+
```
39+
40+
41+
***
42+
## Usage
43+
44+
Run commands on PDF files as needed:
45+
46+
```
47+
flyfield --input-pdf myfile.pdf --markup
48+
```
49+
50+
51+
### Options:
52+
53+
- `--markup` Generate a PDF highlighting white boxes
54+
- `--fields` Add interactive form fields
55+
- `--fill` Fill form fields using data from a CSV file
56+
- `--capture` Export filled form data to CSV
57+
- `--input-csv` Load field data from a CSV instead of extracting
58+
- `--debug` Show detailed processing logs
59+
60+
61+
### Example workflow:
62+
63+
```
64+
flyfield --input-pdf form.pdf --markup --fields
65+
flyfield --input-pdf form-fields.pdf --input-csv form.csv --fill form-fill.csv
66+
flyfield --input-pdf form-filled.pdf --capture
67+
```
68+
69+
70+
***
71+
## For Developers
72+
73+
Clone and install development tools:
74+
75+
```
76+
git clone https://github.com/flywire/flyfield.git
77+
cd flyfield
78+
pip install -e .[dev]
79+
```
80+
81+
Run tests:
82+
83+
```
84+
tox
85+
```
86+
87+
Modules:
88+
89+
- `extract` — box detection
90+
- `layout` — analyse, group and filter fields
91+
- `markup_and_fields` — generate fields and markings
92+
- `io_utils` — data I/O
93+
- `utils` — utility functions
94+
95+
For CLI help:
96+
97+
```
98+
python -m flyfield.cli --help
99+
```
100+
101+
102+
***
103+
## License
104+
105+
GNU GPL v3.0 or later. See [LICENSE](LICENSE).
106+
107+
***
108+
## Contributing
109+
110+
Contributions welcome via issues and pull requests.
111+
112+
***
113+
## Acknowledgements
114+
115+
- Powered by [PyMuPDF](https://pymupdf.readthedocs.io).
116+
- Uses [PyPDFForm](https://pypdfform.readthedocs.io).
117+
- Designed to simplify workflows involving white boxed PDF form fields.
118+
119+
***

__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"""Top-level package for flyfield.
2+
3+
This package contains modules for PDF field extraction,
4+
layout processing, and form field automation.
5+
"""

0 commit comments

Comments
 (0)