Skip to content

Commit

Permalink
Update release for 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tonybaloney committed Dec 8, 2020
1 parent 27e4aea commit 0c75708
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 12 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
3 changes: 1 addition & 2 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -23,7 +23,6 @@
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": [
{ "DO_TESTS": 1 }
]
}
]
Expand Down
60 changes: 53 additions & 7 deletions Docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <gettingstarted>` guide for a walkthrough of how to use this project.
Documentation
=============
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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='[email protected]',
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/pyjion/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
import platform

__version__ = '0.0.7'
__version__ = '0.1.0'


def _no_dotnet(path):
Expand Down

0 comments on commit 0c75708

Please sign in to comment.