Skip to content

Commit

Permalink
Add framework
Browse files Browse the repository at this point in the history
  • Loading branch information
DamianZaremba committed Aug 27, 2021
1 parent 424a7f0 commit b1fd970
Show file tree
Hide file tree
Showing 11 changed files with 188 additions and 3 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CI
on: [ push, pull_request ]
jobs:
pytest:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.x
uses: actions/setup-python@v2
with: { python-version: '3.9' }
- name: Install dependencies
run: pip install tox
- name: Run pytest
run: tox -e pytest
pylama:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.x
uses: actions/setup-python@v2
with: { python-version: '3.9' }
- name: Install dependencies
run: pip install tox
- name: Run pylama
run: tox -e pylama
pyre:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.x
uses: actions/setup-python@v2
with: { python-version: '3.9' }
- name: Install dependencies
run: pip install tox
- name: Run pyre
run: tox -e pyre
15 changes: 15 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Release
on: { push: { tags: [ 'v*' ] } }
jobs:
github:
runs-on: ubuntu-20.04
steps:
- name: Create GitHub release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
23 changes: 23 additions & 0 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Update dependencies using pyup
on:
schedule:
- cron: '30 8 * * *'
push:
branches:
- main
permissions:
contents: write
issues: read
pull-requests: write
jobs:
pyup:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with: { python-version: '3.9' }
- name: Install pyup
run: pip install git+https://github.com/DamianZaremba/pyup.git@gh-action-fixes
- name: Run pyup
run: pyup --provider=github --provider_url=https://api.github.com --integration --repo=${GITHUB_REPOSITORY} --branch=main --user-token=${{ secrets.GITHUB_TOKEN }}
7 changes: 7 additions & 0 deletions .pyup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
update: all
pin: True
search: True
close_prs: True
requirements:
- requirements.txt
- dev-requirements.txt
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 ClueBot NG
Copyright (c) 2021 Damian Zaremba

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include requirements.txt
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
# continuous-trainer
Scheduled training & comparison
# ClueBot NG continuous trainer

This repo trains the ANN on a schedule and compares the resulting database with the current production database.

The intention is for it to serve as a step towards being able to safely re-train the database in the future.

## Example Usage

1. Download the reviewed edits
1. `cbng-trainer download-edits --output=edits.xml`
2. Train a new database
1. `mkdir -p new/`
1. `cbng-trainer build-database --input=edits.xml --output new/`
3. Compare the 2 databases
1. `cbng-trainer compare-database --target new/ --export results/`

## Requirements

1. Python 3.9+
2. Docker on execution host
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
click
aiohttp
8 changes: 8 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[bdist_wheel]
universal=1

[metadata]
version = attr:trainer.__version__

[pylama:pycodestyle]
max_line_length = 100
58 changes: 58 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/usr/bin/env python3
'''
continuous-trainer - ClueBot NG continuous trainer
MIT License
Copyright (c) 2021 Damian Zaremba
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
'''
from pathlib import Path

import pkg_resources
from setuptools import setup, find_packages

with Path('README.md').open('r') as fh:
long_description = fh.read()

with Path('requirements.txt').open('r') as fh:
install_requires = [str(req) for req in pkg_resources.parse_requirements(fh)]

setup(
name='cbng-trainer',
description='ClueBot NG training utilities',
long_description=long_description,
long_description_content_type='text/markdown',
url='https://github.com/cluebotng/trainer',
packages=find_packages(),
license='MIT',
platforms='any',
install_requires=install_requires,
entry_points={
'console_scripts': [
'cbng-trainer=cbng_trainer.cli:cli'
],
},
classifiers=[
'Programming Language :: Python :: 3',
'Operating System :: OS Independent',
],
python_requires='>=3.9',
)
17 changes: 17 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[tox]
envlist = pytest,pylama,pyre

[testenv:pytest]
deps = -r dev-requirements.txt
-r requirements.txt
commands = pytest tests

[testenv:pylama]
deps = -r dev-requirements.txt
-r requirements.txt
commands = pylama trainer

[testenv:pyre]
deps = -r dev-requirements.txt
-r requirements.txt
commands = pyre check

0 comments on commit b1fd970

Please sign in to comment.