A python script to run SimulationCraft reports for World of Warcraft characters when their gear/stats/level/etc. changes.
When run, the script will first read in its configuration file (see below).
For each character in the CHARACTERS
dictionary, it will use the BattleNet API
to request details about the character (currently: appearance, equipment, level,
stats and talents) and cache this information locally (in the same
directory as the configuration file). The first time a specific character is
found in the configuration file, a simc
report will be generated for the
character, and emailed to a configurable (per-character) list of email addresses.
On subsequent runs, the script will compare BattleNet's current information for the character with what the script saved to disk during its last run. If the information is the same, that character will be skipped. Otherwise, a report will be generated and sent via email (and also saved to disk).
This script is suitable for running via cron or another job scheduler (say, daily), and it will automatically run SimulationCraft and email the report whenever changes occur on the characters.
I got this working for myself originally as a single self-contained script. The code - especially the tests - desperately need a refactor. If I keep using it, or anyone else starts using it, maybe I'll try that.
- A working installation of SimulationCraft with (at least) the command line portion.
- Python 2.7 - The upstream library that I chose to use for the BattleNet API only works with python2. As is the case with all of my current code, I target 2.7 through current (3.4) for development, as the effort to get code that also works with horribly ancient 2.6 isn't worth it. I've cut a branch to start work on solving this problem. Until then, 2.7 is it. Sorry.
- Python VirtualEnv and
pip
(recommended installation method; your OS/distribution should have packages for these)
It's recommended that you install into a virtual environment (virtualenv / venv). See the virtualenv usage documentation for information on how to create a venv. If you really want to install system-wide, you can (using sudo).
pip install autosimulationcraft
Running
autosimc --genconfig
Will generate a default configuration file at ~/.autosimulationcraft/settings.py
. Open this with your
favorite text editor; the comments should be enough to help you configure it.
I'd recommend calling autosimc
from cron, or some other method of running it automatically
on a regular basis. If you want to, you can run it manually.
Bug reports and feature requests are happily accepted via the GitHub Issue Tracker. Pull requests are welcome. Issues that don't have an accompanying pull request will be worked on as my time and priority allows.
To install for development:
- Fork the autosimulationcraft repository on GitHub
- Create a new branch off of master in your fork.
$ virtualenv autosimulationcraft
$ cd autosimulationcraft && source bin/activate
$ pip install -e git+git@github.com:YOURNAME/autosimulationcraft.git@BRANCHNAME#egg=autosimulationcraft
$ cd src/autosimulationcraft
The git clone you're now in will probably be checked out to a specific commit,
so you may want to git checkout BRANCHNAME
.
- pep8 compliant with some exceptions (see pytest.ini)
- 100% test coverage with pytest (with valid tests)
Testing is done via pytest, driven by tox.
- testing is as simple as:
pip install tox
tox
- If you want to see code coverage:
tox -e cov
- this produces two coverage reports - a summary on STDOUT and a full report in the
htmlcov/
directory
- this produces two coverage reports - a summary on STDOUT and a full report in the
- If you want to pass additional arguments to pytest, add them to the tox command line after "--". i.e., for verbose pytext output on py27 tests:
tox -e py27 -- -v
- Open an issue for the release; cut a branch off master for that issue.
- Confirm that there are CHANGES.rst entries for all major changes.
- Ensure that Travis tests passing in all environments.
- Ensure that test coverage is no less than the last release (ideally, 100%).
- Increment the version number in autosimulationcraft/version.py and add version and release date to CHANGES.rst, then push to GitHub.
- Confirm that README.rst renders correctly on GitHub.
- Upload package to testpypi, confirm that README.rst renders correctly.
- Make sure your ~/.pypirc file is correct
python setup.py register -r https://testpypi.python.org/pypi
python setup.py sdist bdist_wheel upload -r https://testpypi.python.org/pypi
- Check that the README renders at https://testpypi.python.org/pypi/autosimulationcraft
- Create a pull request for the release to be merge into master. Upon successful Travis build, merge it.
- Tag the release in Git, push tag to GitHub:
- tag the release. for now the message is quite simple:
git tag -a X.Y.Z -m 'X.Y.Z released YYYY-MM-DD'
- push the tag to GitHub:
git push origin X.Y.Z
- tag the release. for now the message is quite simple:
- Upload package to live pypi:
python setup.py sdist bdist_wheel upload
- make sure any GH issues fixed in the release were closed.