From 0c75708a5ba2d97d3ef4d920feed0a26fa63dc18 Mon Sep 17 00:00:00 2001 From: Anthony Shaw Date: Tue, 8 Dec 2020 18:57:44 +1100 Subject: [PATCH] Update release for 0.1.0 --- CHANGELOG.md | 7 +++++ CMakeSettings.json | 3 +-- Docs/source/index.rst | 60 +++++++++++++++++++++++++++++++++++++----- setup.py | 4 +-- src/pyjion/__init__.py | 2 +- 5 files changed, 64 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c768bf489..34562fa1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Release notes +## 0.1.0 + +* Added support for debugging compiled functions and modules by enabling tracing (`pyjion.enable_tracing()`) +* Added support for debugging to catch unhandled/handled exceptions at runtime when tracing is enabled +* Added support for opcode-level tracing +* Fixed a bug on executing Pyjion with pydevd (VScode/PyCharm debugger) would cause the Python process to crash because of a doubly-freed code object (#7) + ## 0.0.7 * Added a WSGI middleware function to enable Pyjion for Flask and Django (#67) diff --git a/CMakeSettings.json b/CMakeSettings.json index d5578b151..0a1a581ad 100644 --- a/CMakeSettings.json +++ b/CMakeSettings.json @@ -10,7 +10,7 @@ "cmakeCommandArgs": "-DDUMP_TRACES=1 -DDUMP_JIT_TRACES=1", "buildCommandArgs": "", "ctestCommandArgs": "", - "variables": [ { "DO_TESTS": 1 , "DUMP_TRACES": 1} ] + "variables": [ { "DO_TESTS": 1} ] }, { "name": "Release", @@ -23,7 +23,6 @@ "ctestCommandArgs": "", "inheritEnvironments": [ "msvc_x64_x64" ], "variables": [ - { "DO_TESTS": 1 } ] } ] diff --git a/Docs/source/index.rst b/Docs/source/index.rst index ef598e872..021d97ad0 100644 --- a/Docs/source/index.rst +++ b/Docs/source/index.rst @@ -8,16 +8,62 @@ Pyjion Pyjion is an implementation and technical proof of concept for a JIT API for CPython. -Project Goals -------------- +Installing Pyjion +----------------- -There are three goals for this project. +To install from PyPi, use pip to install from a virtual environment: -1. **Add a C API to CPython for plugging in a JIT** - make it so that CPython can have a JIT plugged in as desired (CPython is the Python implementation you download from https://www.python.org/). That would allow for an ecosystem of JIT implementations for Python where users can choose the JIT that works best for their use-case. And by using CPython we hope to have compatibility with all code that it can run (both Python code as well as C extension modules). -2. **Develop a JIT module using CoreCLR utilizing the C API mentioned in goal #1** - develop a JIT for CPython using the JIT provided by the CoreCLR. It's cross-platform, liberally licensed, and the original creator of Pyjion has a lot of experience with it. -3. **Develop a C++ framework that any JIT targeting the API in goal #1 can use to make development easier** - abstract out all of the common bits required to write a JIT implementation for CPython. The idea is to create a framework where JIT implementations only have to worry about JIT-specific stuff like how to do addition and not when to do addition. +.. code-block:: console + + $ python -m pip install Pyjion + +Using Pyjion +------------ + +After following the installation steps, pyjion is a python module that you can import a Python 3.9 environment. + +To get started, you need to have .NET 5 installed, with Python 3.9 and the Pyjion package (I also recommend using a virtual environment). + +After importing pyjion, enable it by calling `pyjion.enable()` which sets a compilation threshold to 0 (the code only needs to be run once to be compiled by the JIT): + +.. code-block:: + + >>> import pyjion + >>> pyjion.enable() + + +Any Python code you define or import after enabling pyjion will be JIT compiled. You don't need to execute functions in any special API, its completely transparent: + +.. code-block:: + + >>> def half(x): + ... return x/2 + >>> half(2) + 1.0 + +Pyjion will have compiled the `half` function into machine code on-the-fly and stored a cached version of that compiled function inside the function object. +You can see some basic stats by running `pyjion.info(f)`, where `f` is the function object: + +.. code-block:: + + >>> pyjion.info(half) + {'failed': False, 'compiled': True, 'run_count': 1} + +Debugging +--------- + +To enable debugging of the compiled code, or tracing using a tracer (like a code coverage tool), you need to enable tracing before compiling the functions: + +.. code-block:: + + >>> pyjion.enable_tracing() + +Because debugging adds an overhead to every line, statement and function call, it is disabled by default. You can disable it manually with ``disable_tracing()``: + +.. code-block:: + + >>> pyjion.disable_tracing() -Follow the :doc:`Getting Started ` guide for a walkthrough of how to use this project. Documentation ============= diff --git a/setup.py b/setup.py index 50d34427f..caccdbeaa 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ setup( name='pyjion', - version='0.0.7', + version='0.1.0', description='A JIT compiler wrapper for CPython', author='Anthony Shaw and Microsoft', author_email='anthonyshaw@apache.org', @@ -33,7 +33,7 @@ long_description=long_description, long_description_content_type="text/markdown", classifiers=[ - "Development Status :: 3 - Alpha", + "Development Status :: 4 - Beta", "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", diff --git a/src/pyjion/__init__.py b/src/pyjion/__init__.py index 24189fabe..d2b0824a8 100644 --- a/src/pyjion/__init__.py +++ b/src/pyjion/__init__.py @@ -3,7 +3,7 @@ import os import platform -__version__ = '0.0.7' +__version__ = '0.1.0' def _no_dotnet(path):