π SFPPy - Python Framework for Food Contact Compliance & Risk Assessment πβ©π
LatestSFPPy v1.50 Release πβ©π
Important
This page provides the latest stable version of SFPPy for local installation on your machine.
If you're looking for an online experience, there are two alternatives:
-
π’ Google Colab: No packaging needed β follow the
git cloneinstructions shown on the main project page or watch the video walkthrough. -
π SFPPyLite: Use SFPPy directly in your browser with no setup at all. Powered by WebAssembly and JupyterLite, it gives you access to most of SFPPyβs core capabilities in a single click.
π Both SFPPy and SFPPyLite are aligned and current in version 1.44.
About SFPPy
SFPPy is a Python-based framework for πβ―π compliance testing of food contact materials and π’β¬β»οΈ recycled plastic safety assessment. It supports regulations from:
- πΊπΈ US FDA regulations
- πͺπΊ European Union (EFSA, EU 10/2011, etc.)
- π¨π³ Chinese GB standards
- π Other international guidelines
Release Notes
π SFPPy is AI-ready. Yes, GPT robots can develop chemical migration scenarios using the Pythonic language, operator and class models using the SFPPy frameworks. The limitations are discussed here. Example5.py demonstrates how a scientific agent can be built with ollama, RAG, and a proper knowledge base (provided as docs/KP.zip).
π SFPPy is integrated in notebooks that keep records of the entire evaluation process. Starting from v1.37, a compliance template notebook for compliance is shipped with SFPPy.
π SFPPy is equipped with a graphical interface. SFPPy-GUI supports many of the capabilities of SFPPy and can easily be extended with forms or customized widgets. The manual is available here.
π SFPPy can be used in hybrid environments (online/offline), scripts/notebooks, Windows/Linux. All examples are provided as exampleX.py and notebooks/exampleX.ipynb, with X = 1β4.
π Starting from version 1.3, SFPPy starts all simulations from the sole knowledge of the chemical name of the substance, inferring the diffusivities (ποΈπ¨, ππ¨π»π¨ππ¨) and partitioning (π§²) from the best models applicable. The collection of models can be augmented as shown in patankar.properties.
π SFPPy uses PubChem as the primary source of chemical information, including chemical structure. An internet connection enables SFPPy to retrieve information automatically. The information is cached locally to avoid overloading PubChem servers.
π Starting from version 1.37, SFPPy is shipped with all substances of Annex I of the Regulation (EU) 10/2011 and provides toxicological alerts (if found) for all substances used as inputs. It uses ToxTree for that.
π SFPPy is agnostic to the system considered and runs indifferently on πͺ Windows, π§ Linux, π macOS. SFPPy depends exclusively on standard libraries: SciPy, NumPy, Matplotlib, Pandas, PIL.
π SFPPy is very fast and designed to test chained complex scenarios involving one or several substances.
π As of version 1.40, SFPPy and SFPPyLite offer similar functionality. Users are encouraged to work through Jupyter notebooks rather than standalone Python scripts, as notebooks offer a more interactive and reproducible workflow. Global behaviorβsuch as discretization resolution, plotting preferences, and moreβcan be customized via user overrides using:
from patankar.useroverride import useroverride
π *As of version 1.41, SFPPy and SFPPyLite are shipped with US FCN (πΊπΈ), EU Annex I (πͺπΊ), and GB Appendix A (π¨π³) databases, all managed independently with their database manager and updater. All individual substances and their toxicological assessment are shipped with SPFPPy.
π Version 1.44 brings several fixes and additions identified/requested by users.
π *As of version 1.50, SFPPy brings design-for-compliance to packaging with tiers M0βM3 , explicit performance indicators, open data, AI-assisted reasoning. It automates risk assessment for the 100s of chromatogram peaks in recycled-material extracts. Read our π technical paper here.
ποΈ Download SFPPy v1.50 β Stable Release
| Feature / Content | β
Full Version 129 MB |
βͺ Light Version 66 MB |
|---|---|---|
π§ͺ Includes Toxtree integration |
β Yes | β No |
| π Full documentation | β Yes | β Yes |
𧬠Advanced risk assessment (migrantToxtree) |
β Supported | β Not supported |
π¬ Routine migration modeling (migrant) |
β Supported | β Supported |
| π₯ Download ZIP | Download SFPPy | Download SFPPymin |
| π¦ View all versions | Releases | Releases |
π‘ Note: The light version does not include a private installation of Toxtree, used by patankar.loadpubchem.migrantToxtree for advanced risk assessment. However, patankar.loadpubchem.migrant remains fully functional for routine migration simulations.
Warning
β Toxtree requires a Java runtime environment (JRE) if Java β is not already installed. If needed, Toxtree can be manually installed in patankar/private/toxtree/ as described in patankar/private/toxtree/README.md.
π Example Files
SFPPy includes four example scripts (and more notebooks) to help you get started:
| Example file (located in the root folder π ) | Description (see π Wiki Pages) |
|---|---|
example1.py |
Monolayer materials |
example2.py |
Recycled bottles with functional barriers |
example3.py |
Chained simulations with variations |
example4.py |
Fitting experimental curves to extract diffusion and partition coefficients |
example5.py |
Retrieval-Augmented Generation (RAG) over Legal Knowledge Base |
Tip
β¨ All scripts in the root folder π can be executed directly without modifying the Python path.
If running from another location, use the CLI:
sfppy example1.py # Replace example1.py with your scriptImportant
Notebooks: Keep code, assumptions, results, and interpretations together β ideal for regulatory workflows. If you run notebooks/example1.ipynb, you can save automatically all results and code with:
export_notebook(filename="example1",outputfolder="reports");π οΈ Running SFPPy from Anywhere π
To test releases effortlessly:
# Navigate to the extracted SFPPy folder
cd /path/to/SFPPy # π Unzipped folder
# Install SFPPy in editable mode (dependencies included)
pip install -e .
# Run example1 from anywhere
sfppy example1.py # Replace example1.py with your scriptFor detailed installation instructions, refer to the installation guide π§βπ§.
Note
All notebooks located in πnotebooks/ are equipped with a bootstrap mechanism enabling them to start without any installation.
π Quick Start & Exploration
π Read the Online Documentation:
- π SFPPy Documentation
- π SFPPy Wiki Pages
- π Migration Modeling Guide
- π FitNESS E-learning Platform (Details)
π Try SFPPy now and streamline your food safety assessments!
π Additional Resources
π Publication on Chained Simulation
𧬠AIChE Journal: Migration Modeling with SFPPy
A peer-reviewed reference for the core modeling engine and chaining logic implemented in SFPPy.
π GitHub Pages
The official development hub for SFPPy, including installation, examples, and documentation.
SFPPyLite is a sister project that runs entirely in-browser, without installation or servers. Most use casesβsetup, simulation, visualization, and exportβcan be handled interactively in JupyterLite.
See wiki pages for more.
Tip
π§ Why is SFPPy AI-ready?
Read more on Generative Simulation.
GPTs and modern AI tools understand and generate Python code natively. The SFPPy API is designed for semantic modelingβusing intuitive structures like operator chaining (>>), integrated unit handling, and chemical object orientation.
Contact Olivier Vitrac for questions | Website | Documentation