My intention is to share a script tool. The help docs explaining the Execution Tab don't go into detail. I've shared a script tool before by putting the python file and tool in the same shared directory. I'm wondering now about embedding it. This seems like a better way because you only have to worry about where the tool is located, and not both the tool and the script. I've tested this method and it seems doable. Is embed intended for sharing?
Yes. I sell a toolbox RivEX where all the tools are embedded into the toolbox. It works well and simplifies distribution. The only thing external is the help file, license file, shared modules and some sample data.
I have come across an annoying quirk and I think it specific to VSCode. When you associate an IDE, in my case VSCode, with the arcpro it can open your code in VSCode and you have the full editing functionality of VSCode. This works about 95% of the time and when you close VSCode all your edits are transferred back into the embedded script. Nice! But... 5% of the time when you shut down VSCode it complete nukes your code and you loose everything! So imagine you are not working from a backup and all that new coding you've done is also lost! I've taught myself to select all the code and copy it, then close VSCode, then check the toolbox!
The *.atbx toolbox - Esri Community
7Zip standard can be used to explore/edit embedded scripts.
My preference is keep scripts in a separate folder located in the same folder as the *.atbx since I package things as a module and it is often shared with other toolboxes (which I keep those other *.atbx files).
encrypting/embedding is a matter of choice, but you can distribute both formats by using a simple zip of either the atbx or the atbx and associated folders/scripts/documentation