Skip to content

Commit 0779ae1

Browse files
authored
Trim contributing guide (#914)
It was mostly out of date - trying to document just the unchanging pieces.
1 parent 5f2940f commit 0779ae1

File tree

1 file changed

+17
-126
lines changed

1 file changed

+17
-126
lines changed

CONTRIBUTING.rst

Lines changed: 17 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -2,141 +2,32 @@
22
Contributing
33
============
44

5-
Contributions are welcome, and they are greatly appreciated! Every little bit
6-
helps, and credit will always be given.
5+
Run the tests
6+
-------------
77

8-
You can contribute in many ways:
8+
1. Install `tox <https://tox.wiki/en/latest/>`__.
99

10-
Types of Contributions
11-
----------------------
10+
2. Run a supported version of MySQL or MariaDB.
11+
This is easiest with the official Docker images.
12+
For example:
1213

13-
Report Bugs
14-
~~~~~~~~~~~
14+
.. code-block:: console
1515
16-
Report bugs via `Github Issues
17-
<https://github.com/adamchainz/django-mysql/issues>`_.
16+
docker run --detach --name mariadb -e MYSQL_ROOT_PASSWORD=hunter2 --publish 3306:3306 mariadb:10.7
1817
19-
If you are reporting a bug, please include:
18+
3. Run the tests by passing environment variables with your connection parameters.
19+
For the above Docker command:
2020

21-
* Your versions of Django-MySQL, Django, and MySQL/MariaDB
22-
* Any other details about your local setup that might be helpful in
23-
troubleshooting, e.g. operating system.
24-
* Detailed steps to reproduce the bug.
21+
.. code-block:: console
2522
26-
Fix Bugs
27-
~~~~~~~~
23+
DB_HOST=127.0.0.1 DB_USER=root DB_PASSWORD='hunter2' tox -e py310-django40
2824
29-
Look through the GitHub issues for bugs. Anything tagged with "bug"
30-
is open to whoever wants to implement it.
25+
tox environments are split per Python and Django version.
3126

32-
Implement Features
33-
~~~~~~~~~~~~~~~~~~
27+
You can run a subset of tests by passing them after ``--`` like:
3428

35-
Look through the GitHub issues for features. Anything tagged with "help wanted"
36-
and not assigned to anyone is open to whoever wants to implement it - please
37-
leave a comment to say you have started working on it, and open a pull request
38-
as soon as you have something working, so that Travis starts building it.
29+
.. code-block:: console
3930
40-
Issues without "help wanted" generally already have some code ready in the
41-
background (maybe it's not yet open source), but you can still contribute to
42-
them by saying how you'd find the fix useful, linking to known prior art, or
43-
other such help.
31+
DB_HOST=127.0.0.1 DB_USER=root DB_PASSWORD='hunter2' tox -e py310-django40 -- tests/testapp/test_cache.py
4432
45-
Write Documentation
46-
~~~~~~~~~~~~~~~~~~~
47-
48-
Django-MySQL could always use more documentation, whether as part of the
49-
official Django-MySQL docs, in docstrings, or even on the web in blog posts,
50-
articles, and such. Write away!
51-
52-
Submit Feedback
53-
~~~~~~~~~~~~~~~
54-
55-
The best way to send feedback is to file an issue via `Github Issues
56-
<https://github.com/adamchainz/django-mysql/issues>`_.
57-
58-
If you are proposing a feature:
59-
60-
* Explain in detail how it would work.
61-
* Keep the scope as narrow as possible, to make it easier to implement.
62-
* Remember that this is a volunteer-driven project, and that contributions
63-
are welcome :)
64-
* Link to any prior art, e.g. MySQL/MariaDB documentation that details the
65-
necessary database features
66-
67-
Get Started!
68-
------------
69-
70-
Ready to contribute? Here's how to set up Django-MySQL for local development.
71-
72-
1. Fork the Django-MySQL repo on GitHub.
73-
2. Clone your fork locally:
74-
75-
.. code-block:: sh
76-
77-
$ git clone [email protected]:your_name_here/django-mysql.git
78-
$ cd django-mysql/
79-
80-
3. Check you have a supported version of MySQL or MariaDB running and that the
81-
settings in ``tests/settings.py`` will work for connecting. This involves
82-
making sure you can connect from your terminal with the plain command
83-
``mysql`` with no options, i.e. as your current user.
84-
85-
On Ubuntu, this can be done with the commands below:
86-
87-
.. code-block:: sh
88-
89-
$ sudo apt-get install mysql-server-5.7
90-
$ mysql -uroot -p -e "CREATE USER '$(whoami)'@localhost; GRANT ALL PRIVILEGES ON *.* TO '$(whoami)'@localhost;"
91-
# Enter the password for root you set in the apt dialog
92-
93-
On Mac OS X, this can be done with something like:
94-
95-
.. code-block:: sh
96-
97-
$ brew install mariadb
98-
$ mysql.server start
99-
$ mysql -uroot -e "CREATE USER '$(whoami)'@localhost; GRANT ALL PRIVILEGES ON *.* TO '$(whoami)'@localhost;"
100-
101-
If you want to use a different user or add a password, you can patch the
102-
settings file in your local install.
103-
104-
5. Install ``tox`` and run the tests for Python 3.10 + Django 4.0:
105-
106-
.. code-block:: sh
107-
108-
$ python -m pip install tox
109-
$ tox -e py310-django40
110-
111-
6. To make changes, create a branch for local development:
112-
113-
.. code-block:: sh
114-
115-
$ git checkout -b name-of-your-bugfix-or-feature
116-
117-
...and hack away!
118-
119-
7. Commit your changes and push your branch to GitHub:
120-
121-
.. code-block:: sh
122-
123-
$ git add .
124-
$ git commit -m "Your detailed description of your changes."
125-
$ git push origin name-of-your-bugfix-or-feature
126-
127-
8. Submit a pull request through the GitHub website. This will trigger the
128-
Travis build which runs the tests against all supported versions of Python,
129-
Django, and MySQL/MariaDB.
130-
131-
Testing Tips
132-
------------
133-
134-
To only run a particular test file, you can run with the path to that file:
135-
136-
.. code-block:: sh
137-
138-
$ tox -- tests/testapp/test_some_feature.py
139-
140-
You can also pass other pytest arguments through ``tox`` after the ``--``
141-
separator. There are lots of other useful features, most of which you can check
142-
out in the `pytest docs <http://docs.pytest.org/en/latest/>`_!
33+
You can also pass other pytest arguments after the ``--``.

0 commit comments

Comments
 (0)