Metadata-Version: 2.1
Name: pywordle
Version: 0.2.1
Summary: Little helper to play the Wordle game
License: MIT
Author: Pierre Cart-Grandjean
Author-email: pcart-grandjea@noreply.com
Requires-Python: >=3.10,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Requires-Dist: marshmallow
Requires-Dist: pytz
Requires-Dist: requests
Description-Content-Type: text/markdown

# Wordle

## Description

This is to help playing the [Wordle](https://www.powerlanguage.co.uk/wordle/) game.

## Usage

All the command line options can be found with the `--help` option.

```bash
$ poetry run wordle --help
usage: Propose words for the Wordle game. [-h] [--large] [--stats] [--none] [--unique] [--check] [--verbose] [--letters LETTERS] [--minfrequency MINFREQUENCY]

options:
  -h, --help            show this help message and exit
  --large               Uses the large file of english words.
  --stats               Displays some stats about the found words.
  --none                Use none of the previously used letters.
  --unique              Do not repeat letters in a word.
  --check               Check that the word is valid.
  --verbose             Print progress.
  --letters LETTERS     The set of letters to be used.
  --minfrequency MINFREQUENCY
                        A minimum frequency for the proposed words, between 1 and 7.

```

### Check the Words API

In order to call the [Words API](https://github.com/dwyl/english-words) below, you need to store a valid [Rapid API](https://rapidapi.com) key in `RAPIDAPI_KEY` environment variable. This can be done with the `secret.sh` if available in the repository:

```bash
. secret.sh
```

Using the `--check` option will check all proposed words with the [Words API](https://github.com/dwyl/english-words). Be carefull that we only have 2500 free queries per day. After that it will automatically cost $0.004 per extra word. But it is also quite easy to check the status current of the [usage](https://rapidapi.com/developer/dashboard).

```bash
poetry run wordle --check
```

### Letters

The `--letters` is useful to start the game with a word that is using the most common english letters to have the best chances to find letters of the solution word. It also could be a good idea to add the `--unique` option to avoid repeating a letter. Adding the `--check` will allow to check how often the words are used. This can be filtered with a `--minfrequency`. And if you do not add too many letters, you can finally add `--all` to see the full list of matching words.

```bash
poetry run wordle --letters=etaionshr --unique --check --minfrequency=3 --all
```

## Development

The python depedencies are handled with Poetry.

```bash
poetry install
```

### Unit tests

This is how to run the unit tests and generate the JUnit report.

```bash
poetry run pytest --junitxml=test-reports/report.xml
```

### Check the types

This is done with [mypy](https://mypy.readthedocs.io/en/latest/index.html)

```bash
poetry run mypy *.py
```

### Check the syntax

This is done with [pylint](https://pypi.org/project/pylint/)

```bash
poetry run pylint *.py
```

### Initial word list

The initial list is taken from [Github](https://github.com/dwyl/english-words). But it contains many word that hardly exist.
A smaller list was taken from [Corncob](http://www.mieliestronk.com/corncob_lowercase.txt).

### Safety

In order to test that all the dependencies have no known issues, we are experimenting with [Safety](https://pypi.org/project/safety/) that compares our dependencies to the [Satefty DB](https://github.com/pyupio/safety-db).

Checking the safety of the installed packages is done as follow:

```bash
poetry run safety check
```

`Poetry` makes it easy to upgrade to the latest packages. It will update the `poetry.lock` and even the `pyproject.toml` accordingly.

```bash
poetry update
```

### Publish to Pypi

On Pypi, this package is called `pywordle`. It is very simple to publish it with `poetry`:

```bash
poetry install
poetry build
poetry publish
```

Then it can be used with `pip` for example:

```bash
pip instal pywordle
wordle --help
```

