[PATCH 3/4] requirements: Switch to PyMySQL

Stephen Finucane stephen at that.guru
Tue May 14 06:31:08 AEST 2019


On Wed, 2019-05-08 at 20:38 +1000, Daniel Axtens wrote:
> Stephen Finucane <stephen at that.guru> writes:
> 
> > This is pure Python, which means there's no need for those pesky MySQL
> > development libs.
> > 
> I'm a bit worried about the performance impact of going from C to pure
> Python: does have an impact on the speed of tests? Have you tested it
> with a large parsearchive invocation?

Performance is an issue, if StackOverflow is to be believed. However,
database accesses aren't typically the blocking thing in most of our
parser archive (that would be parsing itself). I'm happy to drop this
for now if it helps with the rest of the series.

Stephen

> Regards,
> Daniel
> 
> > Signed-off-by: Stephen Finucane <stephen at that.guru>
> > ---
> >  manage.py            | 12 ++++++++++--
> >  requirements-dev.txt |  2 +-
> >  tox.ini              |  2 +-
> >  3 files changed, 12 insertions(+), 4 deletions(-)
> > 
> > diff --git a/manage.py b/manage.py
> > index fe6189ee..86bd67e9 100755
> > --- a/manage.py
> > +++ b/manage.py
> > @@ -2,9 +2,17 @@
> >  import os
> >  import sys
> >  
> > +try:
> > +    # From https://github.com/PyMySQL/PyMySQL/wiki/WhyPyMySQL
> > +    import pymysql
> > +    pymysql.install_as_MySQLdb()
> > +except ImportError:
> > +    pass
> > +
> > +
> >  if __name__ == "__main__":
> > -    os.environ.setdefault("DJANGO_SETTINGS_MODULE",
> > -            "patchwork.settings.production")
> > +    os.environ.setdefault(
> > +        "DJANGO_SETTINGS_MODULE", "patchwork.settings.production")
> >  
> >      from django.core.management import execute_from_command_line
> >  
> > diff --git a/requirements-dev.txt b/requirements-dev.txt
> > index 0efdf886..06eefd99 100644
> > --- a/requirements-dev.txt
> > +++ b/requirements-dev.txt
> > @@ -6,5 +6,5 @@ django-filter==1.1.0; python_version < '3.0'  # pyup: ignore
> >  django-debug-toolbar==1.11
> >  django-dbbackup==3.2.0
> >  psycopg2-binary==2.8.2
> > -mysqlclient==1.3.14
> > +PyMySQL==0.9.3
> >  -r requirements-test.txt
> > diff --git a/tox.ini b/tox.ini
> > index ba5d5104..86fb62e1 100644
> > --- a/tox.ini
> > +++ b/tox.ini
> > @@ -15,7 +15,7 @@ deps =
> >      django{20,21}: djangorestframework>=3.7,<3.10
> >      django{20,21}: django-filter>=2.0,<3.0
> >      postgres: psycopg2-binary==2.7.7
> > -    mysql: mysqlclient==1.3.14
> > +    mysql: PyMySQL==0.9.3
> >  docker =
> >      postgres: postgres:9.6
> >      mysql: mysql:5.7
> > -- 
> > 2.20.1



More information about the Patchwork mailing list