Skip to content

πŸš€ SFPPy - Python Framework for Food Contact Compliance & Risk Assessment 🍏⏩🍎

Latest

Choose a tag to compare

@ovitrac ovitrac released this 12 Oct 13:07
· 6 commits to main since this release

SFPPy 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 clone instructions 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.

    πŸ§ͺ Try it online!

πŸ”„ 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 script

Important

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 script

For 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:

πŸš€ 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

SFPPy main
The official development hub for SFPPy, including installation, examples, and documentation.

SFPPyLite in your browser
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.


🍏⏩🍎 SFPPy for Food Contact Compliance and Risk Assessment
Contact Olivier Vitrac for questions | Website | Documentation