Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Bloodmallet/simc_support
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 9.0.2.10
Choose a base ref
...
head repository: Bloodmallet/simc_support
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing with 3,774 additions and 2,477 deletions.
  1. +80 −0 .github/workflows/CD.yml
  2. +11 −11 .github/workflows/CI.yml
  3. +3 −0 .gitignore
  4. +6 −0 README.md
  5. +34 −0 publish_release.ps1
  6. +2 −2 publish_release.sh
  7. +36 −0 pyproject.toml
  8. +16 −0 requirements-dev.txt
  9. +3 −4 requirements.txt
  10. +108 −0 self_update.py
  11. +32 −0 setup.cfg
  12. +0 −35 setup.py
  13. +0 −125 simc_support/game_data/Conduit.py
  14. +0 −68 simc_support/game_data/Covenant.py
  15. +16 −0 simc_support/game_data/Expansion.py
  16. +2 −2 simc_support/game_data/Faction.py
  17. +164 −0 simc_support/game_data/Instance.py
  18. +429 −58 simc_support/game_data/ItemLevel.py
  19. +12 −11 simc_support/game_data/Language.py
  20. +0 −108 simc_support/game_data/Legendary.py
  21. +71 −3 simc_support/game_data/Race.py
  22. +1 −0 simc_support/game_data/Role.py
  23. +107 −0 simc_support/game_data/Season.py
  24. +35 −17 simc_support/game_data/SimcObject.py
  25. +0 −327 simc_support/game_data/SoulBind.py
  26. +14 −1 simc_support/game_data/Source.py
  27. +759 −82 simc_support/game_data/Talent.py
  28. +679 −245 simc_support/game_data/Trinket.py
  29. +58 −95 simc_support/game_data/WowClass.py
  30. +72 −125 simc_support/game_data/WowSpec.py
  31. +0 −1 simc_support/game_data/data_files/conduits.json
  32. +0 −1 simc_support/game_data/data_files/covenants.json
  33. +0 −1 simc_support/game_data/data_files/legendaries.json
  34. +0 −1 simc_support/game_data/data_files/soul_binds.json
  35. +0 −1 simc_support/game_data/data_files/talents.json
  36. +1 −0 simc_support/game_data/data_files/trees/death_knight_blood.json
  37. +1 −0 simc_support/game_data/data_files/trees/death_knight_frost.json
  38. +1 −0 simc_support/game_data/data_files/trees/death_knight_unholy.json
  39. +1 −0 simc_support/game_data/data_files/trees/demon_hunter_havoc.json
  40. +1 −0 simc_support/game_data/data_files/trees/demon_hunter_vengeance.json
  41. +1 −0 simc_support/game_data/data_files/trees/druid_balance.json
  42. +1 −0 simc_support/game_data/data_files/trees/druid_feral.json
  43. +1 −0 simc_support/game_data/data_files/trees/druid_guardian.json
  44. +1 −0 simc_support/game_data/data_files/trees/druid_restoration.json
  45. +1 −0 simc_support/game_data/data_files/trees/evoker_augmentation.json
  46. +1 −0 simc_support/game_data/data_files/trees/evoker_devastation.json
  47. +1 −0 simc_support/game_data/data_files/trees/evoker_preservation.json
  48. +1 −0 simc_support/game_data/data_files/trees/hunter_beast_mastery.json
  49. +1 −0 simc_support/game_data/data_files/trees/hunter_marksmanship.json
  50. +1 −0 simc_support/game_data/data_files/trees/hunter_survival.json
  51. +1 −0 simc_support/game_data/data_files/trees/mage_arcane.json
  52. +1 −0 simc_support/game_data/data_files/trees/mage_fire.json
  53. +1 −0 simc_support/game_data/data_files/trees/mage_frost.json
  54. +1 −0 simc_support/game_data/data_files/trees/monk_brewmaster.json
  55. +1 −0 simc_support/game_data/data_files/trees/monk_mistweaver.json
  56. +1 −0 simc_support/game_data/data_files/trees/monk_windwalker.json
  57. +1 −0 simc_support/game_data/data_files/trees/paladin_holy.json
  58. +1 −0 simc_support/game_data/data_files/trees/paladin_protection.json
  59. +1 −0 simc_support/game_data/data_files/trees/paladin_retribution.json
  60. +1 −0 simc_support/game_data/data_files/trees/priest_discipline.json
  61. +1 −0 simc_support/game_data/data_files/trees/priest_holy.json
  62. +1 −0 simc_support/game_data/data_files/trees/priest_shadow.json
  63. +1 −0 simc_support/game_data/data_files/trees/raw_raidbots_talent_information.json
  64. +1 −0 simc_support/game_data/data_files/trees/rogue_assassination.json
  65. +1 −0 simc_support/game_data/data_files/trees/rogue_outlaw.json
  66. +1 −0 simc_support/game_data/data_files/trees/rogue_subtlety.json
  67. +1 −0 simc_support/game_data/data_files/trees/shaman_elemental.json
  68. +1 −0 simc_support/game_data/data_files/trees/shaman_enhancement.json
  69. +1 −0 simc_support/game_data/data_files/trees/shaman_restoration.json
  70. +1 −0 simc_support/game_data/data_files/trees/warlock_affliction.json
  71. +1 −0 simc_support/game_data/data_files/trees/warlock_demonology.json
  72. +1 −0 simc_support/game_data/data_files/trees/warlock_destruction.json
  73. +1 −0 simc_support/game_data/data_files/trees/warrior_arms.json
  74. +1 −0 simc_support/game_data/data_files/trees/warrior_fury.json
  75. +1 −0 simc_support/game_data/data_files/trees/warrior_protection.json
  76. +1 −1 simc_support/game_data/data_files/trinkets.json
  77. +1 −1 simc_support/game_data/data_files/wow_classes.json
  78. BIN simc_support/game_data/full_tree.jpg
  79. BIN simc_support/game_data/full_tree_assumptions.jpg
  80. BIN simc_support/game_data/full_tree_coordinates.jpg
  81. BIN simc_support/game_data/partial_tree.jpg
  82. BIN simc_support/game_data/screenshot_talents_full.jpg
  83. 0 simc_support/py.typed
  84. +0 −802 simc_support/self_update.py
  85. +6 −8 simc_support/simc_data/Tier.py
  86. 0 simc_support/update/__init__.py
  87. +47 −0 simc_support/update/extractor.py
  88. +278 −0 simc_support/update/talents.py
  89. +195 −0 simc_support/update/trinkets.py
  90. +397 −0 simc_support/update/utils.py
  91. +0 −182 tests/game_data/conduits_shaman.txt
  92. +0 −43 tests/game_data/test_Conduit.py
  93. +0 −26 tests/game_data/test_Covenants.py
  94. +0 −17 tests/game_data/test_Legendary.py
  95. +0 −36 tests/game_data/test_SoulBind.py
  96. +20 −32 tests/game_data/test_Talent.py
  97. +16 −0 tests/game_data/test_Trinket.py
  98. +23 −5 {simc_support → }/trinket_export.py
80 changes: 80 additions & 0 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versionspython@v4
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: CD

on:
push:
tags:
- '**'

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black pytest pytest-cov mypy
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Style with black
run: |
# stop the build if there are style errors
black .
- name: Type checking with mypy
run: |
mypy .
- name: Test with pytest
run: |
pytest --doctest-modules --junitxml=junit/test-results.xml --cov=simc_support --cov-report=xml --cov-report=html
publish:
needs: [test]
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10']

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U build twine
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Build
run: |
python -m build
- name: Publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m twine upload dist/*
merge:
needs: [publish]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Merge branch -> master
uses: devmasx/merge-branch@master
with:
type: now
target_branch: master
github_token: ${{ github.token }}
message: '[CD] merge published code into master'
22 changes: 11 additions & 11 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -8,30 +8,30 @@ on:
- pull_request

jobs:
build:

test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: ['3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest pytest-cov
pip install black pytest pytest-cov mypy
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
- name: Style with black
run: |
# stop the build if there are style errors
black .
- name: Type checking with mypy
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=400 --statistics
mypy .
- name: Test with pytest
run: |
pytest --doctest-modules --junitxml=junit/test-results.xml --cov=simc_support --cov-report=xml --cov-report=html
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# directories
__pycache__/
.eggs/
.mypy_cache/
.pytest_cache/
.vscode/
@@ -18,3 +19,5 @@ tmp/
*.pyc
*.simc
coverage.xml
*.log
run*.*
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -29,3 +29,9 @@ trinkets = get_trinkets_for_spec(elemental_shaman)
for trinket in TRINKETS:
print(f"{trinket.item_id} {trinket.name}")
```

## Data Origin
- Data in `.py` files was written by hand.
- Data in `.json` files is automatically generated with the help of SimulationCrafts casc and dbc scripts. See `./simc_support/self_update.py` in the repository for more informtion.

**Exception**: Dragonflight Talent data (also `.json` files) is being prepared by [raidbots.com](https://www.raidbots.com/simbot). Permission was granted to use it here.
34 changes: 34 additions & 0 deletions publish_release.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
$ErrorActionPreference = "Stop"

echo "Activating environment"
.\env\Scripts\activate

function Remove-Artifacts {
[CmdletBinding()]
param ()

echo "Removing Build Artifacts"
Foreach ($D in @("build", "dist", "simc_support.egg-info")) {
if (Test-Path "${D}") {
echo " ${D}"
rm -r "${D}"
}
}
}

Remove-Artifacts

echo "Install requirements"
pip install -U -r requirements.txt
pip install -U setuptools wheel build twine

echo "Execute unittest"
python -m unittest

echo "Build wheel"
python -m build

echo "Publish"
python -m twine upload dist/*

Remove-Artifacts
4 changes: 2 additions & 2 deletions publish_release.sh
Original file line number Diff line number Diff line change
@@ -11,13 +11,13 @@ done

echo "Install requirements"
pip install -U -r requirements.txt
pip install -U setuptools wheel twine
pip install -U setuptools wheel build twine

echo "Execute unittest"
python -m unittest

echo "Build wheel"
python setup.py sdist bdist_wheel
python -m build

echo "Publish"
python -m twine upload dist/*
36 changes: 36 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[build-system]
requires = [
"setuptools>=45",
"wheel",
"setuptools-git-versioning",
]
build-backend = "setuptools.build_meta"

[tool.setuptools-git-versioning]
# schema: <wow_version, e.g. 9.0.1>.<own_version_per_wow_version>
starting_version = "0.0.0.1"
template = "{tag}"
dev_template = "{tag}.dev1+{branch}.{ccount}.{sha}"
dirty_template = "{tag}.dev1+{branch}.{ccount}.{sha}.dirty"
count_commits_from_version_file = false

[tool.mypy]
warn_return_any = true
exclude = [
'^env/.',
'self_update.py',
]

[[tool.mypy.overrides]]
module = [
"pkg_resources",
]
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = [
"networkx",
"pandas",
"requests"
]
ignore_missing_imports = true
16 changes: 16 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# libraries required to further develop this library
# required by simulationcraft
bitarray
fixedint

# formatting
black

# type checking
mypy

# loading files to update data
requests

# library versioning
setuptools-git-versioning
7 changes: 3 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
black
mypy
fixedint
# libraries required to use this library
dataclasses; python_version<'3.7'
types-dataclasses; python_version<'3.7'
requests
bitarray
108 changes: 108 additions & 0 deletions self_update.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
"""
This script updates data_files by using SimulationCrafts casc and dbc extractors.
Basically; execute this script once per patch.
e.g. python self_update.py -s ../../simulationcraft/ --beta --no-load --no-extract
"""
import json
import logging
import os
import typing
from simc_support.update.extractor import Extractor
from simc_support.update.utils import (
ArgsObject,
handle_arguments,
dbc,
casc,
get_compiled_data_path,
collect_localizations,
)
from simc_support.update.talents import TalentLoader
from simc_support.update.trinkets import TrinketExtractor


logger = logging.getLogger()
logger.setLevel(logging.DEBUG)

ch = logging.StreamHandler()
ch.setLevel(logging.INFO)
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
ch.setFormatter(formatter)

fh = logging.FileHandler("debug.log", encoding="utf-8", mode="w")
fh.setLevel(logging.DEBUG)
fh.setFormatter(formatter)

logger.addHandler(ch)
logger.addHandler(fh)

_LOCALES = [
"en_US",
"ko_KR",
"fr_FR",
"de_DE",
"zh_CN",
"es_ES",
"ru_RU",
"it_IT",
"pt_PT",
]

DATA_PATH = "simc_support/game_data/data_files"


def update_wow_classes(args: ArgsObject) -> None:
logger.info("Update WowClasses")

# TODO: class - race connection can be established via ChrClassRaceSex table
CHRCLASSES = "ChrClasses"
dbc(
args,
[
CHRCLASSES,
],
)
data = {}

for locale in _LOCALES:
with open(
os.path.join(get_compiled_data_path(args, locale), f"{CHRCLASSES}.json"),
"r",
) as f:
data[locale] = json.load(f)

wow_classes = []

wow_classes = collect_localizations(data, translation_field="name_lang")

with open(os.path.join(DATA_PATH, "wow_classes.json"), "w", encoding="utf-8") as f:
json.dump(wow_classes, f, ensure_ascii=False)

logger.info(f"Updated {len(wow_classes)} WowClasses")


def main() -> None:
args = handle_arguments()
if args.debug:
logger.setLevel(logging.DEBUG)

casc(args)

updates: typing.List[typing.Callable[[ArgsObject], None]] = [
update_wow_classes,
]
for update in updates:
update(args)

extractors: typing.List[typing.Type[Extractor]] = [
TalentLoader,
TrinketExtractor,
]
for extractor in extractors:
extractor(args).extract()

logger.debug("self_update done")


if __name__ == "__main__":
main()
Loading