Skip to content

Commit 59db2b8

Browse files
authored
Merge pull request #35 from marmig0404/main
Make project an importable library
2 parents 7ad9712 + 800ed98 commit 59db2b8

131 files changed

Lines changed: 429 additions & 47 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/pypi-package.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This workflow will install build a pypi distribution of this package
2+
# For more information see: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
3+
4+
name: Python Package
5+
6+
on:
7+
push:
8+
tags: # on tags with versions
9+
- "v*.*.*"
10+
11+
jobs:
12+
build-n-publish:
13+
name: Build and publish Python distributions to PyPI
14+
runs-on: ubuntu-18.04
15+
steps:
16+
- uses: actions/checkout@master
17+
- uses: little-core-labs/get-git-tag@v3.0.1
18+
- name: Set up Python 3.9
19+
uses: actions/setup-python@v1
20+
with:
21+
python-version: "3.9"
22+
- name: Install pypa/build
23+
run: >-
24+
python -m
25+
pip install
26+
build
27+
--user
28+
- name: Build a binary wheel and a source tarball
29+
run: >-
30+
python -m
31+
build
32+
--sdist
33+
--wheel
34+
--outdir dist/
35+
.
36+
- name: Publish distribution to PyPI
37+
uses: pypa/gh-action-pypi-publish@master
38+
with:
39+
password: ${{ secrets.PYPI_API_TOKEN }} # MUST SET GITHUB REPO SECRET https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
**/__pycache__
22
.idea/
3-
src/data/screenshots
3+
clashroyalebuildabot/data/screenshots
4+
.venv
5+
.vscode
6+
*.egg-info

clashroyalebuildabot/__init__.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Exports for clashroyalebuildabot
2+
from .bot import PeteBot, RandomBot, StandardBot, TwoSixHogCycle, Action, Bot
3+
from .data import constants
4+
from .screen import Screen
5+
from .state import (CardDetector, Detector, NumberDetector, OnnxDetector,
6+
ScreenDetector, UnitDetector)
7+
8+
__all__ = [
9+
"StandardBot",
10+
"RandomBot",
11+
"PeteBot",
12+
"TwoSixHogCycle",
13+
"constants",
14+
"Detector",
15+
"OnnxDetector",
16+
"ScreenDetector",
17+
"NumberDetector",
18+
"UnitDetector",
19+
"CardDetector",
20+
"Screen",
21+
"Action",
22+
"Bot"
23+
]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Exports for bot submodule
2+
from .two_six_hog_cycle import TwoSixHogCycle
3+
from .pete import PeteBot
4+
from .random import RandomBot
5+
from .standard import StandardBot
6+
from .action import Action
7+
from .bot import Bot
8+
__all__ = [
9+
"TwoSixHogCycle",
10+
"PeteBot",
11+
"RandomBot",
12+
"StandardBot",
13+
"Action",
14+
"Bot"
15+
]
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import time
22

3-
from src.bot.action import Action
4-
from src.data.constants import (
3+
from clashroyalebuildabot.bot.action import Action
4+
from clashroyalebuildabot.data.constants import (
55
ALLY_TILES,
66
LEFT_PRINCESS_TILES,
77
RIGHT_PRINCESS_TILES,
@@ -17,8 +17,8 @@
1717
TILE_INIT_Y,
1818
DISPLAY_HEIGHT
1919
)
20-
from src.screen import Screen
21-
from src.state.detector import Detector
20+
from clashroyalebuildabot.screen import Screen
21+
from clashroyalebuildabot.state.detector import Detector
2222

2323

2424
class Bot:
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Exports for bot.pete submodule
2+
from .pete_bot import PeteBot
3+
__all__ = ["PeteBot"]

src/bot/pete/pete_action.py renamed to clashroyalebuildabot/bot/pete/pete_action.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from src.bot.action import Action
1+
from clashroyalebuildabot.bot.action import Action
22

33

44
class PeteAction(Action):
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import random
22
import time
33

4-
from src.bot.bot import Bot
5-
from src.bot.pete.pete_action import PeteAction
6-
from src.data.constants import DISPLAY_WIDTH, SCREENSHOT_WIDTH, DISPLAY_HEIGHT, SCREENSHOT_HEIGHT
4+
from clashroyalebuildabot.bot.bot import Bot
5+
from clashroyalebuildabot.bot.pete.pete_action import PeteAction
6+
from clashroyalebuildabot.data.constants import DISPLAY_WIDTH, SCREENSHOT_WIDTH, DISPLAY_HEIGHT, SCREENSHOT_HEIGHT
77

88

99
class PeteBot(Bot):
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Exports for bot.random submodule
2+
from .random_bot import RandomBot
3+
__all__ = ["RandomBot"]

0 commit comments

Comments
 (0)