fix instructions

This commit is contained in:
Sander Land committed 2020-05-16 12:04:38 +02:00
1 parent 8cb4ef3595
commit 5e4086b812
6 files changed
+49 -22

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
name: release
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install dependencies
run: |
pip3 install -e .
pip3 install pytest wheel
- name: Run tests
run: pytest -v tests
- name: Build
run: |
python3 setup.py sdist
python3 setup.py bdist_wheel
- name: Release to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USER }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: twine upload --verbose dist/* || echo 'File exists'
+3 -5
View File
@@ -24,7 +24,7 @@
* Download the repository by clicking the green *Clone or download* on this page and *Download zip*. Extract the contents. * Download the repository by clicking the green *Clone or download* on this page and *Download zip*. Extract the contents.
* Make sure you have a python installation, I will assume Anaconda (Python 3.7), available [here](https://www.anaconda.com/products/individual#download-section). * Make sure you have a python installation, I will assume Anaconda (Python 3.7), available [here](https://www.anaconda.com/products/individual#download-section).
* Open 'Anaconda prompt' from the start menu and navigate to where you extracted the zip file using the `cd <folder>` command. * Open 'Anaconda prompt' from the start menu and navigate to where you extracted the zip file using the `cd <folder>` command.
* Execute the command `python setup.py install` * Execute the command `pip3 install .`
* Start the app by running `katrain` in the directory where you downloaded the scripts. * Start the app by running `katrain` in the directory where you downloaded the scripts.
# <a name="LinuxSources"></a>Installation from sources for Linux users # <a name="LinuxSources"></a>Installation from sources for Linux users
@@ -34,11 +34,9 @@
* Open a terminal. * Open a terminal.
* Run the command `git clone https://github.com/sanderland/katrain.git` to download the repository. * Run the command `git clone https://github.com/sanderland/katrain.git` to download the repository.
* Changing directory using `cd katrain` * Changing directory using `cd katrain`
* Run the command `python3 setup.py install` * Run the command `pip3 install .` to install the package globally, then run the program by typing `katrain` in the terminal.
* If you get an error about permissions, try `python3 setup.py install --user` * If you prefer not to install, run without installing using `python -m katrain`
* A binary for KataGo is included, but if you have compiled your own, point the 'engine/katago' setting to the relevant KataGo v1.4+ binary. * A binary for KataGo is included, but if you have compiled your own, point the 'engine/katago' setting to the relevant KataGo v1.4+ binary.
* Run the program by typing `katrain` in the terminal.
# Configuring the GPU(s) KataGo uses # Configuring the GPU(s) KataGo uses
+1 -2
View File
@@ -19,7 +19,7 @@ from kivy.storage.jsonstore import JsonStore
from kivy.uix.popup import Popup from kivy.uix.popup import Popup
from katrain.core.ai import ai_move from katrain.core.ai import ai_move
from katrain.core.common import OUTPUT_INFO, OUTPUT_ERROR, OUTPUT_DEBUG, OUTPUT_EXTRA_DEBUG, OUTPUT_KATAGO_STDERR, find_package_resource, clean_temp from katrain.core.common import OUTPUT_INFO, OUTPUT_ERROR, OUTPUT_DEBUG, OUTPUT_EXTRA_DEBUG, OUTPUT_KATAGO_STDERR, find_package_resource
from katrain.core.engine import KataGoEngine from katrain.core.engine import KataGoEngine
from katrain.core.game import Game, IllegalMoveException, KaTrainSGF from katrain.core.game import Game, IllegalMoveException, KaTrainSGF
from katrain.core.sgf_parser import Move, ParseError from katrain.core.sgf_parser import Move, ParseError
@@ -338,7 +338,6 @@ class KaTrainApp(App):
def on_request_close(self, *args): def on_request_close(self, *args):
if getattr(self, "gui", None) and self.gui.engine: if getattr(self, "gui", None) and self.gui.engine:
self.gui.engine.shutdown() self.gui.engine.shutdown()
clean_temp()
def signal_handler(self, *args): def signal_handler(self, *args):
if self.gui.debug_level >= OUTPUT_DEBUG: if self.gui.debug_level >= OUTPUT_DEBUG:
+3 -12
View File
@@ -1,5 +1,5 @@
from typing import Any, List, Tuple
import os import os
from typing import Any, List, Tuple
try: try:
import importlib.resources as pkg_resources import importlib.resources as pkg_resources
@@ -30,21 +30,12 @@ def evaluation_class(points_lost: float, eval_thresholds: List[float]):
return i return i
resource_scopes = []
def clean_temp():
for s in resource_scopes:
s.__exit__(None, None, None)
def find_package_resource(path): def find_package_resource(path):
if path.startswith("katrain"): if path.startswith("katrain"):
parts = path.replace("\\", "/").split("/") parts = path.replace("\\", "/").split("/")
try: try:
path_obj = pkg_resources.path(".".join(parts[:-1]), parts[-1]).__enter__() with pkg_resources.path(".".join(parts[:-1]), parts[-1]) as path_obj:
resource_scopes.append(path_obj) return str(path_obj) # this will clean up if egg etc, but these don't work anyway
return str(path_obj)
except (ModuleNotFoundError, FileNotFoundError) as e: except (ModuleNotFoundError, FileNotFoundError) as e:
print(f"File {path} not found, installation possibly broken") print(f"File {path} not found, installation possibly broken")
return f"FILENOTFOUND::{path}" return f"FILENOTFOUND::{path}"
+4 -2
View File
@@ -1,6 +1,8 @@
import json import json
import os
import shlex import shlex
import subprocess import subprocess
import stat
import sys import sys
import threading import threading
import time import time
@@ -36,8 +38,8 @@ class KataGoEngine:
else: # e.g. MacOS after brewing else: # e.g. MacOS after brewing
executable = "katago" executable = "katago"
modelfile, configfile = find_package_resource(config["model"]), find_package_resource(config["config"]) modelfile, configfile, exefile = find_package_resource(config["model"]), find_package_resource(config["config"]), find_package_resource(executable)
self.command = f'{find_package_resource(executable)} analysis -model "{modelfile}" -config "{configfile}" -analysis-threads {config["threads"]}' self.command = f'{exefile} analysis -model "{modelfile}" -config "{configfile}" -analysis-threads {config["threads"]}'
if not sys.platform.startswith("win"): if not sys.platform.startswith("win"):
self.command = shlex.split(self.command) self.command = shlex.split(self.command)
self.queries = {} # outstanding query id -> start time and callback self.queries = {} # outstanding query id -> start time and callback
+2 -1
View File
@@ -36,11 +36,12 @@ setup(
url="https://github.com/sanderland/katrain", url="https://github.com/sanderland/katrain",
license="MIT", license="MIT",
install_requires=[ install_requires=[
"kivy", "kivy>=1.11,<2",
"kivy_deps.glew;platform_system=='Windows'", "kivy_deps.glew;platform_system=='Windows'",
"kivy_deps.sdl2;platform_system=='Windows'", "kivy_deps.sdl2;platform_system=='Windows'",
"kivy_deps.gstreamer;platform_system=='Windows'", "kivy_deps.gstreamer;platform_system=='Windows'",
"importlib_resources ;python_version<'3.7'", "importlib_resources ;python_version<'3.7'",
"wheel",
], ],
python_requires=">=3.6, <3.8", python_requires=">=3.6, <3.8",
entry_points={"console_scripts": ["katrain=katrain.__main__:run_app"]}, entry_points={"console_scripts": ["katrain=katrain.__main__:run_app"]},