Metadata-Version: 2.1
Name: wpdatabase2
Version: 0.0.5
Summary: A Python package that checks and/or sets up a WordPress database.
Home-page: https://github.com/ravensorb/py-wordpress-database
Author: Shawn Anderson
Author-email: sanderson@eye-catcher.com
License: MIT
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: Topic :: Internet :: WWW/HTTP :: Site Management
Description-Content-Type: text/markdown
Requires-Dist: boto3 (~=1.9.0)
Requires-Dist: mysql-connector (>=2.1.0)
Requires-Dist: wpconfigr (~=1.0.0)
Provides-Extra: dev
Requires-Dist: autopep8 ; extra == 'dev'
Requires-Dist: coverage ; extra == 'dev'
Requires-Dist: pylint ; extra == 'dev'

# py-wordpress-database

[![CircleCI](https://circleci.com/gh/ravensorb/py-wordpress-database/tree/master.svg?style=svg)](https://circleci.com/gh/ravensorb/py-wordpress-database/tree/master)

**A big call out to @cariad for the original version of this library**

A Python package that sets up a WordPress database.

`wpdatabase2` will:
 - Provide a way to check to see if the wordpress database already exists
 - Return the version details of the wordpress database (if it exists)
 - Create the database, if it doesn't exist already.
 - Create the WordPress user, if it doesn't exist already.

`wpdatabase2` is idempotent; if the database and the user already exist then it will return successfully.

Note that `wpdatabase2` currently only supports MySQL databases.

## Installation

```shell
pip install wpdatabase2
```

## Prerequisites

`wpdatabase2` assumes that the following properties have already been set in the `wp-config.php` file:

| Property      | Description
|-              |-
| `DB_HOST`     | Host or endpoint of the MySQL database server.
| `DB_USER`     | WordPress database user.
| `DB_PASSWORD` | WordPress database password.

If you need help adding these values to `wp-config.php` then check out [wpconfigr](https://github.com/cariad/py-wpconfigr).

## Command-line usage

If you need to specify to the database's administrator username and password:

```shell
python -m wpdatabase2 
        --wp-config      /www/wp-config.php \
        --admin-username garnet \
        --admin-password love
```

If you're deploying WordPress into Amazon Web Services (AWS) and have your administrator username and password held in Secrets Manager:

```shell
python -m wpdatabase2 
        --wp-config                       /www/wp-config.php \
        --admin-credentials-aws-secret-id AdminSecretID \
        --admin-credentials-aws-region    eu-west-1
```

## Library usage

```python
import wpdatabase2

wpdb = WpDatabase('path to wp-config.php')
print(wpdb.get_database_version())
```

## Development

To install development dependencies:

```shell
pip install -e .[dev]
```

To run the tests:

```shell
python test.py
```


