Working asv and django-asv for Django optimisation
I am currently working on an optimisation ticket for the Django ORM as part of the Djangonaut Space mentorship programme for Session 6 Team Saturn. This is my first time contributing code to Django after being a non-code contributor for many years through my work in the Django community. I had already set up my Django development environment following the Django docs to create a branch for Ticket #99999 as part of the Djangonaut Space application process, so on to the optimisation.
Django uses the asv package on PyPi for performance benchmarking, along with the django-asv package maintained by Django. There is limited documentation on django-asv, which you would need for optimisation tickets, and I hope to help both you and me by documenting this process. At the time of writing this post, I am working on Windows.
Setting up django-asv and asv
To set up django-asv and asv, follow these instructions:
- First, fork the django-asv repo to create your own copy.
- Clone your fork, preferably in the same directory as your Django project.
- Update asv.conf.json with the following settings:
{
"version": 1,
"project": "Django",
"project_url": "https://www.djangoproject.com/",
"repo": "../django",
"branches": ["branch_name"],
"environment_type": "virtualenv",
"show_commit_url": "http://github.com/django/django/commit/",
}
- Activate the virtual environment for your Django project.
- Install asv using pip install asv command.
- Run the asv run command to ensure that django-asv is properly installed.