Use jupyterlab and hide code Le 16/10/2019 à 21:37, Dima Pasechnik a écrit :
On Wed, 16 Oct 2019, 20:09 pong, <[email protected] <mailto:[email protected]>> wrote:That's exactly what I want (hiding sources codes from users). I'm teaching a class where the students need to implement some algorithms on graphs but I would like to distribute those functions in advance so that they can play with it and see what's the expected output before writing their owns. So how can I save those pyc files generated by sage separately and have them run inside a session?I think if you make your *.sage scripts more "pytonic", so that they can be imported by Python "import" statements, then it would suffice to supply *.pyc files only.Thanks in advance On Wednesday, October 16, 2019 at 12:02:00 PM UTC-7, Dima Pasechnik wrote: On Wed, Oct 16, 2019 at 6:18 PM pong <[email protected]> wrote: > > I have a bunch of old scripts in .sage files. They were compiled into .pyc files years ago. *.sage files are preparsed by sage preparser, and converted into *.py files. Conversion into *.pyc files is done automatically, as *.py files are loaded into Sage's Python interpreter. One cannot load() or attach() *.pyc files, as far as I know - but why would you need this? (unless you want to hide the source of your *.sage scripts from the user) HTH Dima > > Unfortunately, I only remember that I ran sage --preparse on the .sage files and got them into .py files but forgot what next. > > I tried import py_compile in sage then ran py_compile.compile('xxx.py') which gave me a .pyc file but I couldn't load it or attach it to sage. > > I understand one can change the file extension to .spyx and have sage to compile it by loading it into a session but I would like the pyc files by themselves. > > Can I get some help on this? > > -- > You received this message because you are subscribed to the Google Groups "sage-support" group. > To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. > To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/f28af744-043a-4100-b965-ce5642887512%40googlegroups.com.-- You received this message because you are subscribed to the GoogleGroups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/50e388e8-49e4-41f7-b042-708700c3e653%40googlegroups.com <https://groups.google.com/d/msgid/sage-support/50e388e8-49e4-41f7-b042-708700c3e653%40googlegroups.com?utm_medium=email&utm_source=footer>. --You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/CAAWYfq3ChRDHD1-tM4qqZ%2BczBtT_OhCotXFH%3DYeW_do%2B%2B3UvWQ%40mail.gmail.com <https://groups.google.com/d/msgid/sage-support/CAAWYfq3ChRDHD1-tM4qqZ%2BczBtT_OhCotXFH%3DYeW_do%2B%2B3UvWQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.
-- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/392895b1-1fef-c262-5c8c-2385dbb477ac%40gmail.com.
