Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
You can contribute in many ways:
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 git@github.com:your_name_here/django-mysql.git $ cd django-mysql/
Check you have a supported version of MySQL or MariaDB running and that the settings in
tests/settings.py
will work for connecting. This involves making sure you can connect from your terminal with the plain commandmysql
with no options, i.e. as your current user.On Ubuntu, this can be done with the commands below:
$ sudo apt-get install mysql-server-5.7 $ 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 Mac OS X, this can be done with something like:
$ brew install mariadb $ mysql.server start $ mysql -uroot -e "CREATE USER '$(whoami)'@localhost; GRANT ALL PRIVILEGES ON *.* TO '$(whoami)'@localhost;"
If you want to use a different user or add a password, you can patch the settings file in your local install.
Install
tox
and run the tests for Python 3.8 + Django 3.0:$ python -m pip install tox $ tox -e py38-django30
The
tox.ini
file defines a large number of test environments, for different Python and Django versions, plus for checking codestyle. During development of a feature/fix, you'll probably want to run just one plus the relevant codestyle:$ tox -e py38-codestyle,py38-django30
You can run all the environments to check your code is okay for them with:
$ tox
To make changes, create a branch for local development:
$ git checkout -b name-of-your-bugfix-or-feature
...and hack away!
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.
To only run a particular test file, you can run with the path to that file:
$ tox -- tests/testapp/test_some_feature.py
You can also pass other pytest arguments through tox
after the --
separator. There are lots of other useful features, most of which you can check
out in the pytest docs!