Skip to content
Snippets Groups Projects

updated documentation for sandbox-2; README renamed to README.rst for better display in gitLab

Open Mark Doerr requested to merge topic/default/sandbox-2-fix-documentation into branch/default

Documentation for Sandbox-2 usage was finally updated (after cleaning up this webpage repository). Please review.

Edited by Mark Doerr

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • @arigo ping

    @markdoerr is this ready for review? It has a WIP in the title...

  • Mark Doerr unmarked as a Work In Progress

    unmarked as a Work In Progress

  • Author Developer

    Hi @mattip and @arigo, I kept it in WIP state, because I had to check for typos. I think it is ready for reviewing now.

  • I'm not sure I understand the changes to pages/download.rst. You should run pypy ../../rpython/bin/rpython -O2 --sandbox where pypy 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.

    • Author Developer

      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 subdirectories lib_pypy and lib-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 and lib-python, and you put the pypy-c-sandbox with the corresponding libpypy-c*.sos file inside this directory, maybe in a bin 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 Rigo
    • Author Developer

      I 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 ?

    • Please register or sign in to reply
  • Author Developer

    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.

  • Author Developer

    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).

  • Author Developer

    "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 ...)

    • Right, yes, for sandboxing we could drop the 2.7 compatibility at some point. Possibly even now, if you or someone feels like contributing to sandboxlib but not worrying about python 2.7.

    • Author Developer

      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 ....

    • Please register or sign in to reply
  • Author Developer

    When I resolved the "import site" error (s.o.), I am planning to update the documentations in my merge requests ... things start to clear out :)

  • 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 typing import site explicitly and seeing where it fails, but I bet it's related to not finding some non-essential files.

  • Author Developer

    Yes, Armin, the -S option omits the output, interestingly an import 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 Doerr
  • Author Developer

    I would propose that I convert a proof-of-concept version of interact.py for python3.6. I would create a new feature branch for that - it that OK with you ? Or do you have other plans ?

  • Try to run the sandbox with -S and then typing import site in it. I'm seeing an error (with the 2.7 version).

    NameError: global name 'exit' is not defined is because exit is a function defined in site.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.

  • Author Developer

    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 need exit() ....

  • 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 from interact.py. Otherwise, make your own, if you know enough about ANSI escape sequences.

  • Note that a similar tool written in Python is pyrepl (a version of which is also used by the normal PyPy). Maybe you can integrate the normal pyrepl as a dependency of interact.py.

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
Please register or sign in to reply
Loading