updated documentation for sandbox-2; README renamed to README.rst for better display in gitLab
Documentation for Sandbox-2 usage was finally updated (after cleaning up this webpage repository). Please review.
Merge request reports
Activity
@arigo ping
@markdoerr is this ready for review? It has a WIP in the title...
I'm not sure I understand the changes to pages/download.rst. You should run
pypy ../../rpython/bin/rpython -O2 --sandbox
wherepypy
is, like in all other cases, either a pypy that you got from elsewhere (e.g. from your Linux distribution, or downloaded as a binary release from pypy.org), or just CPython 2.7. It's already written in the paragraph before: if you don't have a pypy to start with, then use CPython 2.7. I think there is no point in first building a complete pypy with CPython and then use it to build pypy-c-sandbox. I just tried, and it works fine to translate a pypy-c-sandbox directly with CPython 2.7.You are right, that the sandbox would also compile with CPython2.7, but for packaging one needs a pypy-c with its libs in the goal directory (and there is no pypy-c when you just pulled the sources). As far as I understood, you need to make this package to install everything somewhere in your PYTHON_PATH - or have I missed something here ? Otherwise, which lib-path shall people use for calling pypy_interact, like in:
pypy_interact.py --lib-path=path/to/my_pypy_sandbox_package path/to/pypy-c-sandbox -i
We should explain this step for beginners, don't you thinks so ?
You simply run
pypy_interact.py
with--lib-path
pointing to a directory where the two subdirectorieslib_pypy
andlib-python
are. It can be directly the working copy.If you want an extra installation step, then you make a directory anywhere else containing a copy of
lib_pypy
andlib-python
, and you put thepypy-c-sandbox
with the correspondinglibpypy-c*.so
s file inside this directory, maybe in abin
subdirectory. It's up to you. That should be all that is needed for a separate installation, because there is no cffi in the sandbox, which is what normally requires extra steps.We can describe this as I just did above, and/or turn this simple logic into a script, maybe
pypy/tool/release/package_sandbox.py
.Edited by Armin RigoI tried to reproduce, what you explained and am very happy :) , that I have now a pypy-sandbox 3.6 running:
python2.7 interact.py --lib-path=temp/pypy_sandbox temp/pypy_sandbox/bin/pypy3-c-sandbox -i 'import site' failed Python 3.6.9 (87100c8230f4, Apr 19 2020, 16:48:09) [PyPy 7.2.0-alpha0 with GCC 7.5.0] on linux Type "help", "copyright", "credits" or "license" for more information. And now for something completely different: ``forward compatibility with optimizations that haven't been invented yet'' >>>>
I am just wondering, what this "import site" failed means ... any ideas ?
This is good to know - it would have taken me much longer to figure out, what finally is necessary to run everything. For people who start with sandbox, a package script in pypy/tool/release/package_sandbox.py is a very good idea... :) it would make installation a lot easier. I will try, what you proposed.
Regarding maintaining 2 sandbox versions (2.7 and 3.7): how long are you planning to do this parallel development ? It sounds like taking a lot of effort, energy and time to keep two versions up-to-date. (python2.7 reached it lifetime's end anyway - I know, that many older systems esp. in the HPC world still rely on it, but eventually they should also migrate their scripts).
"forever" is quite some time ;) - what about the the interfaces to the sandbox (sandboxlib) / interact.py do you also want to have "host compatibility" to python2.7 and python3.6 "forever" ? (there could be more volunteers to develop code, if one focuses on modern python3 for the interface part ...)
Hello Armin,
I would try to find some time working on the interface, but I personally would prefer to code in python3. We need to see, how far I get. I am planning to define some simple tasks with you during the course of this week.
postscriptum: I think, I ran into the hexapod update process ... there is no answer from the server anymore ....
site.py
is a standard Python module that is automatically imported. You can stop that by passing the flag-S
to the sandboxed pypy. If it always fails on py3.6-sandbox-2 then it's probably a good idea to document that we should always pass this flag. Otherwise we can try to debug by typingimport site
explicitly and seeing where it fails, but I bet it's related to not finding some non-essential files.Yes, Armin, the
-S
option omits the output, interestingly animport site
does not throw any error. The documentation about site.py says:Append module search paths for third-party packages to sys.path. This will append site-specific paths to the module search path. On Unix (including Mac OSX), it starts with sys.prefix and sys.exec_prefix (if different) and appends lib/python<version>/site-packages.
It sounds relevant ... or can't the sandbox read these modules anyway ?
There are two more things I noticed: One cannot execute 'exit()' running the sandbox in interactive mode and also there is no command line history (cursor keyes do not work). I is not a too serious issue, right now, but just to mention ...
Edited by Mark DoerrTry to run the sandbox with
-S
and then typingimport site
in it. I'm seeing an error (with the 2.7 version).NameError: global name 'exit' is not defined
is becauseexit
is a function defined insite.py
, precisely.The command-line history issue is mentioned at the end of the docstring in
interact.py
with a workaround.Yes, you are welcome to try to improve
interact.py
.I was was wondering for some time, why you mentioned this
ledit
remark in your docstring - now I understand (it should be explained, what this workaround is good for) - I did not not try it, because ledit is not pre-installed on my linux distribution (mint). What would be the best way to provide interactivity with build-in tools ? Or in other words - why is command line editing not working in sandbox (you know the system much better) ? What would be required to enable it again (since in normal pypy it works) ?Regarding site.py: my pypy3.6-sandbox does not throw an error, when you run
import site
, but exit() is still not working ... I guess it should be made working, since some modules might needexit()
....Indeed, I see the same thing as you do on py3.6-sandbox. I don't know the answer like that. You'll have to debug to figure out why there is no
exit()
.The point of command line editing is that it is not part of the sandboxed pypy.
ledit
is a tool that adds it from outside, i.e. safely. If you want to look around, maybe there is already a similar tool written in Python that we could reuse directly frominteract.py
. Otherwise, make your own, if you know enough about ANSI escape sequences.