PYPY(1)

πŸ“¦ version 7.3.9, in ubuntu jammy

✨ PYPY ✨ (section 1 of the manual, bestie πŸ’–)

okay so listen. pypy is a fast, compliant alternative implementation of the Python language. that's it, that's the whole vibe. it's Python but it goes zoom. 🏎️✨


🌸 SYNOPSIS 🌸

pypy [options] [-c cmd|-m mod|file.py|-] [arg...]

like… you give it some options, you give it a script or a command or a module (or a - for stdin, we love a mysterious little dash πŸŽ€), and then some args for that script. iconic behavior.


πŸ’… OPTIONS πŸ’…

okay this is the main event, buckle up 🫢

  • -i β€” drops you into interactive inspection after the script runs. like the script finishes and it's not done talking to you yet. main character energy.
  • -O β€” skips assert statements. assert? don't know her. πŸ™ˆ
  • -OO β€” does everything -O does, plus it rips out docstrings when importing modules. brutal. lowkey efficient tho.
  • -c CMD β€” the program is passed in as CMD. heads up bestie: this terminates the option list, so nothing after it counts as an option. periodt.
  • -S β€” do NOT import site on initialization. we're going minimal, we're going feral. ✨
  • -s β€” don't add the user site directory to sys.path. keeping it clean πŸ’…
  • -u β€” unbuffered binary stdout and stderr. no waiting around, everything comes out immediately. we are not patient girls.
  • -h, --help β€” shows a help message and then exits. the classic. the blueprint. πŸŽ€
  • -m MOD β€” runs a library module as a script. and yep, this terminates the option list too. sorry babes, that's just how it is.
  • -W ARG β€” warning control. the arg format is action:message:category:module:lineno. get into it.
  • -E β€” ignores environment variables (like PYTHONPATH). we're pretending they don't exist, gaslight gatekeep girlboss. πŸ’€
  • -B β€” disables writing bytecode (.pyc) files. no little cache files cluttering up your vibe.
  • -X track-resources β€” produces a ResourceWarning whenever a file or socket gets closed by the garbage collector. so you know when things are getting cleaned up behind your back. πŸ‘€
  • --version β€” prints the PyPy version. show me what you're working with bestie.
  • --info β€” prints translation information about this PyPy executable. the behind-the-scenes lore. πŸ“–
  • --jit ARG β€” low level JIT parameters. mostly internal, ngl. run --jit help for more info if you're feeling brave. πŸ”₯

🌈 ENVIRONMENT 🌈

environment variables, aka the invisible hands shaping your whole Python experience. let's go. 🧚

  • PYTHONPATH β€” adds directories to pypy's module search path. same format as the shell's PATH, so you already know the drill.
  • PYTHONSTARTUP β€” whatever script this points to gets executed before the first prompt shows up, in interactive mode. a little pregame ritual. ✨
  • PYTHONDONTWRITEBYTECODE β€” set it to a non-empty value and it's basically the -B option. disables writing .pyc files. same vibe, different name.
  • PYTHONINSPECT β€” non-empty value = it's the -i option. inspect interactively after running the specified script. πŸŽ€
  • PYTHONIOENCODING β€” if set, it overrides the encoding used for stdin/stdout/stderr. syntax is encodingname:errorhandler, and the errorhandler part is optional β€” it means the same thing it does in str.encode.
  • PYTHONNOUSERSITE β€” non-empty value = it's the -s option. don't add the user site directory to sys.path. πŸ’…
  • PYTHONWARNINGS β€” if set, it's equivalent to the -W option (warning control). the value should be a comma-separated list of -W parameters.
  • PYPYLOG β€” set it to a non-empty value and you get logging enabled. the format is a whole menu, so here it is:
    • fname or +fname β€” logging for profiling: includes all debug_start/debug_stop but not any nested debug_print. fname can be - to log to stderr. the +fname form is the one you want if there's a : in fname. πŸŽ€
    • :fname β€” full logging, including debug_print.
    • prefix:fname β€” conditional logging. you can stack multiple prefixes, comma-separated. only sections whose name matches the prefix will get logged.
    • and like, a real one: PYPYLOG=jit-log-opt,jit-backend:logfile will generate a log suitable for jitviewer, a tool for debugging performance issues under PyPy. πŸ”₯
  • PYPY_IRC_TOPIC β€” set to a non-empty value and it prints a random #pypy IRC topic when interactive mode starts up. pure nostalgia, we love her. 🫢

okay and then there's several environment variables: (yes, the original just says that, and honestly? mood. here they are) 🧚

  • PYPY_GC_NURSERY β€” the nursery size. defaults to 1/2 of your last-level cache, or 4M if that's unknown. small values (like 1 or 1KB) are useful for debugging. πŸ’œ
  • PYPY_GC_NURSERY_DEBUG β€” set it to non-zero and it fills the nursery with garbage, to help with debugging. chaos as a feature. πŸ“
  • PYPY_GC_INCREMENT_STEP β€” the size of memory marked during the marking step. default is the size of the nursery times 2. if you mark it too high, your GC is not incremental at all (rip). the minimum is set to the size that survives minor collection times 1.5, so we reclaim anything all the time.
  • PYPY_GC_MAJOR_COLLECT β€” major collection memory factor. default is 1.82, which means a major collection gets triggered when the memory consumed equals 1.82 times the memory really used at the end of the previous major collection.
  • PYPY_GC_GROWTH β€” major collection threshold's max growth rate. default is 1.4. useful for collecting more often than normal when memory suddenly spikes, like when there's a temporary peak in memory usage. πŸ“ˆ
  • PYPY_GC_MAX β€” the max heap size. if you come near this limit, it'll first collect more often, then raise an RPython MemoryError, and if that isn't enough, it crashes the program with a fatal error. πŸ’€ try values like 1.6GB.
  • PYPY_GC_MAX_DELTA β€” the major collection threshold will never be set to more than PYPY_GC_MAX_DELTA the amount really used after a collection. defaults to 1/8th of the total RAM size (which is constrained to be at most 2/3/4GB on 32-bit systems). try values like 200MB.
  • PYPY_GC_MIN β€” don't collect while the memory size is below this limit. useful to avoid spending all your time in the GC in very small programs. defaults to 8 times the nursery.
  • PYPY_GC_DEBUG β€” enables extra checks around collections that are too slow for normal use. values are 0 (off), 1 (on major collections) or 2 (also on minor collections).
  • PYPY_GC_MAX_PINNED β€” the maximal number of pinned objects at any point in time. defaults to a conservative value depending on nursery size and max object size inside the nursery. useful for debugging β€” just set it to 0. πŸŽ€

πŸ¦‹ SEE ALSO πŸ¦‹

  • python(1) β€” the original. the blueprint. respect the elders bestie. πŸ’–

πŸ‘‘ AUTHOR πŸ‘‘

The PyPy Project. kings, honestly. πŸ‘‘


2022, The PyPy Project


and that's the whole thing bestie!! this page is from PyPy 7.3, dated Apr 01, 2022, and it lives in section 1 of the manual (that's the "PYPY(1)" at the top and bottom, iykyk πŸ’…). go forth and run your Python at unreasonable speeds. slay. βœ¨πŸ«ΆπŸŽ€

πŸ“¦ where this page comes from