🍏⏩🍎 SFPPy on Colab☁️
GitHub SFPPy
v1.37 πŸ“©

πŸš€ Run your own SFPPy on Google Colab ⋆.Λšβ˜οΈβ‹† in Just 2 Minutes! πŸŽ‰

SFPPy is fully compatible with Google Colab and AI tools! πŸš€ This quick setup provides full functionality while ensuring privacy and confidentiality. In just a few clicks πŸ–±οΈ, you'll have the entire SFPPy framework cloned into your private workspace. πŸ›‘οΈβœ¨

πŸ”Ή Why Google Colab ❓

Google Colab (colab.research.google.com) is a free, cloud-based Python environment πŸ†“β˜οΈπŸπŸ‘¨πŸ»β€πŸ’» that enables seamless execution of computational workflows πŸ”€ without requiring local installation. When combined with the SFPPy framework 🍏⏩🍎, Colab offers a powerful and flexible platform for running simulations, analyzing chemical migration data, and leveraging AI-driven tools πŸ€–.

⚑ Why AI? πŸ€–πŸ‘

SFPPy is designed with a highly modular and Pythonic architecture, making it seamlessly compatible with advanced AI systems such as:

πŸ“Œ Bottom line: AI can assist in code generation, optimization, documentation, debugging, and even regulatory compliance analysis when working with SFPPy. πŸš€

πŸ” Why AI Works So Well with SFPPy ❓

  • 1️⃣ Open & Readable Codebase – The well-structured, clean design makes it easy for AI to parse and manipulate.
  • 2️⃣ Extensive Inline Documentation – AI can understand, explain, and modify SFPPy functions effortlessly.
  • 3️⃣ Clear Interfaces & APIs – Defined methods and structured classes ensure smooth interaction with AI tools.
  • 4️⃣ Automatic Code Generation & Explanation – AI can generate, complete, or refactor SFPPy scripts using its class-based approach.
  • 5️⃣ Modular & Extensible Design – SFPPy’s architecture (layer objects, food-contact classes, Patankar-based solvers) breaks down complex operations into small, well-labeled steps, making it easy to extend or debug with AI assistance.

 


πŸ“Œ 1 | Quick Setup Guide

Tip

With Colab, SFPPy can be accessed from any device, including:

  • Windows, macOS, Linux (no installation needed)

  • Tablets or mobile devices (for quick analysis on the go)

This makes it ideal for:

βœ… Academics & Researchers conducting chemical migration studies βœ… Regulatory Experts analyzing EU 10/2011 compliance and others βœ… Industry Professionals performing safety assessments

 

Follow these simple steps to get SFPPy running in Google Colab:

Instructions Demo
πŸ”ΉStep 1: Open Google Colab.
πŸ”Ή Connect using your Google Account (free). βœ…
πŸ”Ή Step 2: Open a Notebook from GitHub.
πŸ”Ή In Google Colab, select "Open Notebook" ➝ Click the GitHub tab.
πŸ”Ή Paste this repository URL: πŸ‘‰ https://github.com/ovitrac/SFPPy
πŸ”Ή Select index.ipynb and open it. πŸ“‚
πŸ”Ή Step 3: Scroll to "Minimal Setup for SFPPy Core".
πŸ”Ή Run the cell by clicking ▢️ or pressing Ctrl+Enter.
πŸ”Ή The entire SFPPy framework will be cloned into your private workspace.
πŸ”Ή Once you see the SFPPy banner, everything is ready! πŸŽ¨βœ…
πŸ”Ή Step 4: Run the next cells one by one.
πŸ”Ή This will activate the graphical interface to explore examples and notebooks. πŸ–₯️✨
πŸ”Ή Step 5: The interface provides interactive widgets to explore examples and notebooks. πŸ“ŠπŸ”§
πŸ”Ή Step 6: Run examples directly inside the notebook. πŸƒπŸ’‘
πŸ”Ή Step 7: Google Colab allows one notebook open per session.
πŸ”Ή Use the final widget to browse other notebooks and find relevant code snippets. πŸ“šπŸ”
πŸ”Ή Step 8: The left panel gives access to all cloned SFPPy files.
πŸ”Ή You can open and edit Python scripts directly in Google Colab! πŸ“πŸ‘¨β€πŸ’»

Note

The videos were recorded using a Dark Theme. You can enable or switch themes by navigating to Tools β†’ Settings β†’ Site β†’ Theme in the top menu.

 

🎯 Congratulations! SFPPy is running in Google Colab! πŸŽ‰πŸš€


πŸ€– 2 | AI-Powered Code Assistance!

Colab AI can generate and modify Python code based on SFPPy.

Example prompt:
"Generate a list of properties for BHT, Irganox 1076, Irganox 1010, Irgafos 168, and DEHP using migrant."

Colab AI SFPPy Example



## πŸ— 3 | **Advanced Features & Installation**

Important

SFPPy on Collab includes Toxtree, PubChem integration, and πŸ‡ͺπŸ‡Ί EU 10/2011 positive list support.

Lists from πŸ‡ΊπŸ‡Έ and πŸ‡¨πŸ‡³ are pending.

SFPPy Chemical Analysis


 


πŸ“ 4 | Using Forms in Google Colab

Tip

Google Colab supports interactive forms for structured data input.

Colab Form Example


 


🎯 5 | Tips & Best Practices with Cloud Resources

Tip

Colab provides free CPU and GPU access, which can be leveraged for:

  • Complex chemical migration modeling

  • Monte Carlo simulations with fast execution

  • Machine learning applications in regulatory compliance

 

βœ… 5.1 | Running All Cells

Execute all notebook cells via Runtime β†’ Run All.
Run All Cells


⚑ 5.2 | Resource Optimization

Even without a GPU, SFPPy runs efficiently on Colab’s CPU-optimized environment, completing most calculations in typically under one or two seconds 🏎️. Colab CPU Usage

Note

According to Google Colab FAQs. β€œIn the version of Colab that is free of charge notebooks can run for at most 12 hours, depending on availability and your usage patterns.”


πŸ“‚ 5.3 | Managing Notebooks

Open additional SFPPy notebooks from index.ipynb.
Each notebook runs in an isolated session (Google policy).
Open Notebooks


CSV Export ExampleExcel Export Example

Since the notebook contains all assumptions used for the simulation, it is recommended to download it as a Python script (.py) or as a Jupyter Notebook (.ipynb) for reproducibility.

πŸ“Œ Example Notebook Export Options:

Notebook Export Options


πŸ”„ 5.6 | Collaborative & Shareable

Google Colab enables real-time collaboration, making it easy to:

βœ… Share SFPPy notebooks with colleagues
βœ… Work together on chemical safety analyses
βœ… Use GitHub for version control
βœ… Enable one-click access to SFPPy workflows via shared links

 

Warning

Colab notebooks can be accessed and edited by multiple users in real time. Changes made by one user will automatically sync after a short delay.

However, if two users edit the same cell at the same time, one set of changes may be lost upon refresh. To avoid conflicts, it is recommended to coordinate edits or use GitHub versioning.

 


 

πŸ’Ύ 6 | Persistent Storage via Google Drive

Caution

Google Colab runs in a temporary environment, meaning files and changes πŸ“‚ will be lost once the session ends.

Tip

πŸ“₯ You can download your scripts, images and text from your browser, but saving files to Google Drive is the best option. This tutorial will guide you through:

βœ… Mounting Google Drive in Google Colab
βœ… Saving specific files (scripts, results) or datasets
βœ… Saving an entire GitHub repository


πŸš€ 6.1 - Step 1 | Mount Google Drive

Before saving any data, you need to connect Google Drive to Google Colab.

πŸ“Œ Run the following code:

πŸ”Ή This will prompt you to authorize access to your Google Drive.
πŸ”Ή Follow the on-screen instructions, copy the authentication code, and paste it into the prompt.
πŸ”Ή Once authenticated, Google Drive will be available under the /content/drive/My Drive/ path.


πŸ“‚ 6.2 - Step 2 | Create a Folder in Google Drive

To keep your files organized, create a dedicated folder in your Google Drive. You can do this manually or using Python:

πŸ”Ή This code will create a folder named "Colab_Files" inside Google Drive.
πŸ”Ή If the folder already exists, the script will not overwrite it.


πŸ“œ 6.3 - Step 3 | Save a File to Google Drive

To save a simple text file or any generated data:

πŸ”Ή This saves "sample.txt" in Colab_Files inside Google Drive.
πŸ”Ή You can open Google Drive and check My Drive > Colab_Files > sample.txt.


πŸ—‚ 6.4 - Step 4 | Save an Entire Repository to Google Drive

To save a GitHub repository or any directory to Google Drive, follow these steps:

6.4.1 | Clone the Repository to Colab

First, clone your GitHub repo inside Colab:

This will create a local copy of the repository in Colab under /content/SFPPy/.

6.4.2 | Copy the Repository to Google Drive

Now, move the entire repository to Google Drive:

πŸ”Ή This copies the entire SFPPy repository to your Google Drive under My Drive > SFPPy_Backup.


πŸ”„ 6.5 - Step 5 | Load Files Back from Google Drive

If you need to reload a saved file in a future Colab session:

Similarly, to restore the full repository:


βœ… 6.6 | Final Notes

πŸ”Ή Google Colab's storage is temporary – always save important work to Google Drive.
πŸ”Ή Use shutil.copytree to back up and restore large folders.
πŸ”Ή Google Drive syncs automatically, so you can access files from anywhere.

πŸ”— Now your files and repository are safe inside Google Drive! πŸš€


πŸŽ‰ You're now ready to explore SFPPy, run examples, and customize scripts!

Do not forget to download your scripts on Google Drive on your local disk.πŸ’‘πŸ”¬

 


 

πŸŽ“ 7 | Learning with External Resources

To deepen your understanding of Jupyter Notebooks and Google Colab, here are some highly recommended tutorials and learning resources from reputable sources.


🐍 7.1 | Jupyter Notebook Tutorials

1️⃣ Dataquest's Beginner Tutorial

2️⃣ DataCamp's Ultimate Guide

3️⃣ GeeksforGeeks: How to Use Jupyter Notebook

4️⃣ YouTube Video: Jupyter Notebook Tutorial


☁️ 7.2 | Google Colab Tutorials

1️⃣ Google's Official Colab Guide

2️⃣ GeeksforGeeks: How to Use Google Colab

3️⃣ Marqo’s Beginner Guide to Google Colab

4️⃣ YouTube Video: Google Colab for Beginners


πŸ”Ή 7.3 | Key Takeaways

βœ… Jupyter Notebooks are great for local Python development with high flexibility.
βœ… Google Colab provides a cloud-based alternative with free resources and easy sharing.
βœ… Both platforms support interactive computing, data visualization, and AI workflows.

With these resources, you can quickly master Jupyter and Colab to enhance your SFPPy experience! πŸš€


⋆.ΛšπŸ¦‹ΰΌ˜β‹†πŸƒΒ°.☁️ β€’ ΰΉ‘ Λ™β˜•

πŸ”— More details πŸ‘‰ SFPPy GitHub Repository


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