Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protect main script from being executed outside the main process #986

Closed
2 tasks
Assignees
Labels
Core Related to Taipy Core 📄 Documentation Internal or public documentation 📈 Improvement Improvement of a feature. 🟧 Priority: High Stalls work on the project or its dependents 🔒 Staff only Restricted to CC staff members
Milestone

Comments

@jrobinAV
Copy link
Member

Taipy can start subprocesses using a 'spawn' method. Because of that, the main module is re-executed every time a sub-processed is spawned. In order NOT to re-execute some code that should not be re-executed, the good practice Taipy wants to enforce is to add the boilerplate
condition if __name__ == "__main" at the top of the main script.

  • Ensure the if __name__ == "__main" condition is explicitly documented and explained in the standalone execution mode documentation (user, ref, tuto, etc.) The motivation should be explicit.
  • Ensure every complete example includes the if __name__ == "__main" in all chapters
@jrobinAV jrobinAV added 📈 Improvement Improvement of a feature. 🔒 Staff only Restricted to CC staff members 🟧 Priority: High Stalls work on the project or its dependents 🟥 Priority: Critical Must be fixed ASAP Core Related to Taipy Core 📄 Documentation Internal or public documentation and removed 🟥 Priority: Critical Must be fixed ASAP labels Jun 12, 2024
@trgiangdo trgiangdo added this to the Community 3.2 milestone Jun 18, 2024
@trgiangdo trgiangdo self-assigned this Jul 23, 2024
@jrobinAV jrobinAV reopened this Jul 27, 2024
trgiangdo added a commit that referenced this issue Aug 14, 2024
…ice-on-main-script

Feature/#986 - Document best practice on main script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment