summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Schmeichel <kevin.schmeichel@altres.com>2022-06-14 16:55:08 -1000
committerKevin Schmeichel <kevin.schmeichel@altres.com>2022-06-14 16:55:08 -1000
commit44de76a44c523be6f030faee1fe41392d9eed539 (patch)
tree4e976de1086d23c2a715038100facddc5bd25ed4
parentf86acc4f15774f88a87300a92d75df94ab39340c (diff)
Update the CONTRIBUTING.md doc with db grant instructions
-rw-r--r--CONTRIBUTING.md92
1 files changed, 50 insertions, 42 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 3075600..6abf894 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -10,67 +10,68 @@ You'll always get credit for your work.
1. [Fork the repository](https://github.com/dbcli/mycli) on GitHub.
2. Clone your fork locally:
- ```bash
- $ git clone <url-for-your-fork>
- ```
+
+ ```bash
+ $ git clone <url-for-your-fork>
+ ```
3. Add the official repository (`upstream`) as a remote repository:
- ```bash
- $ git remote add upstream git@github.com:dbcli/mycli.git
- ```
+
+ ```bash
+ $ git remote add upstream git@github.com:dbcli/mycli.git
+ ```
4. Set up a [virtual environment](http://docs.python-guide.org/en/latest/dev/virtualenvs)
for development:
- ```bash
- $ cd mycli
- $ pip install virtualenv
- $ virtualenv mycli_dev
- ```
+ ```bash
+ $ cd mycli
+ $ pip install virtualenv
+ $ virtualenv mycli_dev
+ ```
- We've just created a virtual environment that we'll use to install all the dependencies
- and tools we need to work on mycli. Whenever you want to work on mycli, you
- need to activate the virtual environment:
+ We've just created a virtual environment that we'll use to install all the dependencies
+ and tools we need to work on mycli. Whenever you want to work on mycli, you
+ need to activate the virtual environment:
- ```bash
- $ source mycli_dev/bin/activate
- ```
+ ```bash
+ $ source mycli_dev/bin/activate
+ ```
- When you're done working, you can deactivate the virtual environment:
+ When you're done working, you can deactivate the virtual environment:
- ```bash
- $ deactivate
- ```
+ ```bash
+ $ deactivate
+ ```
5. Install the dependencies and development tools:
- ```bash
- $ pip install -r requirements-dev.txt
- $ pip install --editable .
- ```
+ ```bash
+ $ pip install -r requirements-dev.txt
+ $ pip install --editable .
+ ```
6. Create a branch for your bugfix or feature based off the `main` branch:
- ```bash
- $ git checkout -b <name-of-bugfix-or-feature> main
- ```
+ ```bash
+ $ git checkout -b <name-of-bugfix-or-feature> main
+ ```
7. While you work on your bugfix or feature, be sure to pull the latest changes from `upstream`. This ensures that your local codebase is up-to-date:
- ```bash
- $ git pull upstream main
- ```
+ ```bash
+ $ git pull upstream main
+ ```
8. When your work is ready for the mycli team to review it, push your branch to your fork:
- ```bash
- $ git push origin <name-of-bugfix-or-feature>
- ```
+ ```bash
+ $ git push origin <name-of-bugfix-or-feature>
+ ```
9. [Create a pull request](https://help.github.com/articles/creating-a-pull-request-from-a-fork/)
on GitHub.
-
## Running the Tests
While you work on mycli, it's important to run the tests to make sure your code
@@ -87,7 +88,6 @@ Python by running tox:
$ tox
```
-
### Test Database Credentials
The tests require a database connection to work. You can tell the tests which
@@ -95,7 +95,7 @@ credentials to use by setting the applicable environment variables:
```bash
$ export PYTEST_HOST=localhost
-$ export PYTEST_USER=user
+$ export PYTEST_USER=mycli
$ export PYTEST_PASSWORD=myclirocks
$ export PYTEST_PORT=3306
$ export PYTEST_CHARSET=utf8
@@ -104,6 +104,14 @@ $ export PYTEST_CHARSET=utf8
The default values are `localhost`, `root`, no password, `3306`, and `utf8`.
You only need to set the values that differ from the defaults.
+If you would like to run the tests as a user with only the necessary privileges,
+create a `mycli` user and run the following grant statements.
+
+```sql
+GRANT ALL PRIVILEGES ON `mycli_%`.* TO 'mycli'@'localhost';
+GRANT SELECT ON mysql.* TO 'mycli'@'localhost';
+GRANT SELECT ON performance_schema.* TO 'mycli'@'localhost';
+```
### CLI Tests
@@ -113,11 +121,11 @@ In some systems (e.g. Arch Linux) `ex` is a symbolic link to `vi`, which will
change the output and therefore make some tests fail.
You can check this by running:
+
```bash
$ readlink -f $(which ex)
```
-
## Coding Style
Mycli requires code submissions to adhere to
@@ -153,7 +161,7 @@ Options:
To release a new version of the package:
-* Create and merge a PR to bump the version in the changelog ([example PR](https://github.com/dbcli/mycli/pull/1043)).
-* Pull `main` and bump the version number inside `mycli/__init__.py`. Do not check in - the release script will do that.
-* Make sure you have the dev requirements installed: `pip install -r requirements-dev.txt -U --upgrade-strategy only-if-needed`.
-* Finally, run the release script: `python release.py`.
+- Create and merge a PR to bump the version in the changelog ([example PR](https://github.com/dbcli/mycli/pull/1043)).
+- Pull `main` and bump the version number inside `mycli/__init__.py`. Do not check in - the release script will do that.
+- Make sure you have the dev requirements installed: `pip install -r requirements-dev.txt -U --upgrade-strategy only-if-needed`.
+- Finally, run the release script: `python release.py`.