|
| 1 | +Develop VMProf |
| 2 | +============== |
| 3 | + |
| 4 | +VMProf consists of several projects working together: |
| 5 | + |
| 6 | +* `vmprof-python`_: The PyPI package providing the command line interface to enable vmprof. |
| 7 | +* `vmprof-server`_: Webservice hosted at `vmprof.com`_. Hosts and visualizes data uploaded by `vmprof-python`_ package. |
| 8 | +* `vmprof-integration`_: Test suite for pulling together all different projects and ensuring that all play together nicely. |
| 9 | +* `PyPy`_: A virtual machine for the Python programming language. Most notably it contains an implementation for the logging facility `vmprof-server`_ can display. |
| 10 | + |
| 11 | +The following description helps you to set up a development environment on Linux. For Windows |
| 12 | +and MacOSX the instructions might be similar. |
| 13 | + |
| 14 | +.. _`PyPy`: http://pypy.org |
| 15 | +.. _`vmprof.com`: http://vmprof.com |
| 16 | +.. _`vmprof-python`: https://github.com/vmprof/vmprof-python |
| 17 | +.. _`vmprof-server`: https://github.com/vmprof/vmprof-server |
| 18 | +.. _`vmprof-integration`: https://github.com/vmprof/vmprof-integration |
| 19 | + |
| 20 | +Develop VMProf on Linux |
| 21 | +----------------------- |
| 22 | + |
| 23 | +It is recommended to use Python 3.x for development. Here is a list of requirements |
| 24 | +on your system: |
| 25 | + |
| 26 | +* python |
| 27 | +* sqlite3 |
| 28 | +* virtualenv |
| 29 | + |
| 30 | +Please move you shell to the location you store your source code in and setup |
| 31 | +a virtual environment:: |
| 32 | + |
| 33 | + $ virtualenv -p /usr/bin/python3 vmprof3 |
| 34 | + $ source vmprof3/bin/activate |
| 35 | + |
| 36 | +All commands from now on assume you have the vmprof3 virutal environment enabled. |
| 37 | + |
| 38 | +Clone the repositories |
| 39 | +---------------------- |
| 40 | + |
| 41 | +:: |
| 42 | + |
| 43 | + $ git clone git@github.com:vmprof/vmprof-integration.git |
| 44 | + $ git clone git@github.com:vmprof/vmprof-server.git |
| 45 | + $ git clone git@github.com:vmprof/vmprof-python.git |
| 46 | + # on old mercurial version the following command takes ages. please use a recent version |
| 47 | + $ hg clone ssh://hg@bitbucket.org/pypy/pypy # optional, only if you want to hack on pypy as well |
| 48 | + |
| 49 | +VMProf Server |
| 50 | +------------- |
| 51 | + |
| 52 | +:: |
| 53 | + |
| 54 | + # setup django service |
| 55 | + $ cd vmprof-server |
| 56 | + $ pip install -r requirements/development.txt |
| 57 | + $ python manage.py migrate |
| 58 | + # to run the service |
| 59 | + $ python manage.py runserver -v 3 |
| 60 | + |
| 61 | +VMProf Python |
| 62 | +------------- |
| 63 | + |
| 64 | +An optional stage. It is only necessary if you want to co develop `vmprof-python`_ with `vmprof-server`_:: |
| 65 | + |
| 66 | + # install vmprof for development (only needed if you want to co develop vmprof-python) |
| 67 | + $ cd vmprof-python |
| 68 | + $ python setup.py develop |
| 69 | + |
| 70 | + |
| 71 | +Now you are able to change both the python package and the server and see the results. |
| 72 | +Here are some more hints on how to develop this platform |
| 73 | + |
| 74 | +Smaller Profiles |
| 75 | +---------------- |
| 76 | + |
| 77 | +Some times it is tedious to generate a big log file and develop a new feature with it. |
| 78 | +Both for VMProf and JitLog you can generate small log files that ease development. |
| 79 | + |
| 80 | +There are small logs generated by a python script in `vmprof-server/vmlog/test/data/loggen.py`. Use the following command to load those:: |
| 81 | + |
| 82 | + $ ./manage.py loaddata vmlog/test/fixtures.yaml |
| 83 | + |
| 84 | +Now open your browser and redirect them to the jitlog. E.g. http://localhost:8000/#/1v1/traces |
| 85 | + |
| 86 | +Integration Tests |
| 87 | +----------------- |
| 88 | + |
| 89 | +This is a very important test suite to ensure that all packages work together. It is automatically run every day by travis. You can run them locally. If you happen not to run a Debian base distribution, you can provide the following shell variable to prevent the tests from downloading a Debian PyPy:: |
| 90 | + |
| 91 | + $ TEST_PYPY_EXEC=/path/to/pypy py.test testvmprof/ |
| 92 | + |
| 93 | + |
0 commit comments