Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
You can contribute in many ways:
Types of Contributions¶
Report bugs via Github Issues.
If you are reporting a bug, please include:
- Your versions of Django-MySQL, Django, and MySQL/MariaDB
- Any other details about your local setup that might be helpful in troubleshooting, e.g. operating system.
- Detailed steps to reproduce the bug.
Look through the GitHub issues for bugs. Anything tagged with “bug” is open to whoever wants to implement it.
Look through the GitHub issues for features. Anything tagged with “help wanted” and not assigned to anyone is open to whoever wants to implement it - please leave a comment to say you have started working on it, and open a pull request as soon as you have something working, so that Travis starts building it.
Issues without “help wanted” generally already have some code ready in the background (maybe it’s not yet open source), but you can still contribute to them by saying how you’d find the fix useful, linking to known prior art, or other such help.
Django-MySQL could always use more documentation, whether as part of the official Django-MySQL docs, in docstrings, or even on the web in blog posts, articles, and such. Write away!
The best way to send feedback is to file an issue via Github Issues.
If you are proposing a feature:
- Explain in detail how it would work.
- Keep the scope as narrow as possible, to make it easier to implement.
- Remember that this is a volunteer-driven project, and that contributions are welcome :)
- Link to any prior art, e.g. MySQL/MariaDB documentation that details the necessary database features
Ready to contribute? Here’s how to set up Django-MySQL for local development.
Fork the Django-MySQL repo on GitHub.
Clone your fork locally:
$ git clone firstname.lastname@example.org:your_name_here/django-mysql.git $ cd django-mysql/
Install your local copy into a virtualenv. Assuming you have
virtualenvwrapperinstalled, this is how you set up your fork for local development:
$ mkvirtualenv django-mysql $ pip install -r requirements.txt Django
Check you have MySQL or MariaDB running and that the settings in
tests/settings.pywill work for connecting. This involves making sure you can connect from your terminal with the plain command
mysql, i.e. as your current user.
On Ubuntu, this can be done with the commands below:
$ sudo apt-get install mysql-server-5.6 $ mysql -uroot -p -e "CREATE USER '$(whoami)'@localhost; GRANT ALL PRIVILEGES ON *.* TO '$(whoami)'@localhost;" # Enter the password for root you set in the apt dialog
On Max OS X, this can be done with something like:
$ brew install mariadb $ mysql.server start $ mysql -uroot -e "GRANT ALL PRIVILEGES ON *.* TO ''@localhost;"
If you want to use a different user or add a password, you can patch the settings file in your local install.
Then run the tests with:
To test every version of Python and Django, make sure you have
toxinstalled globally (outside of your virtualenv), then run:
Now to make changes, create a branch for local development:
$ git checkout -b name-of-your-bugfix-or-feature
And hack away!
When you’re done making changes, check that your changes pass the code style rules and the tests on all versions of Python and Django, by running tox:
If it’s too tricky setting up multiple versions of Python, don’t worry about it - it will be picked up by the Travis build from Github. As long as
runtestspasses, you have a good start.
Commit your changes and push your branch to GitHub:
$ git add . $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature
Submit a pull request through the GitHub website. This will trigger the Travis build which runs the tests against all supported versions of Python, Django, and MySQL/MariaDB.
Pull Request Checklist¶
When you open a Pull Request on Github, a checklist will be pre-populated in the message. Please check all of the steps have been done, or ask for assistance in doing so!
The tests do a lot of work that you can reduce by using some features that are available.
To skip the linting phase, run them with:
$ ./runtests.py --nolint
To only run a particular test file, you can run with the path to that file:
$ ./runtests.py tests/testapp/test_some_feature.py
You can also pass arguments through
runtests.py by passing these
arguments after the
-- separator, for example:
$ tox -- tests/testapp/test_some_feature.py
There are lots of other useful features, most of which you can check out in the pytest docs!