Skip to content

Commit

Permalink
Merge pull request #147 from CyberPunkMetalHead/release-1.0.0
Browse files Browse the repository at this point in the history
Release 1.0.0
  • Loading branch information
CyberPunkMetalHead authored Jan 17, 2022
2 parents c82a94f + 865c760 commit 2f035ac
Show file tree
Hide file tree
Showing 30 changed files with 1,288 additions and 760 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Black Lint Check

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: psf/black@stable
with:
options: "--check --verbose"
src: "."
28 changes: 28 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Unit Tests/Flake8 check for Python 3.8, 3.9

on:
- push
- pull_request

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ['3.8', '3.9']
defaults:
run:
working-directory: .
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Test with tox
run: tox
174 changes: 159 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,32 +1,29 @@
# Ignore creds file
*/**/auth/auth.yml
**/auth/auth.yml

# Ignore orders
*/**/order.json
*/**/sold.json
*/**/new_listing.json
*/**/session.json
**/order.json
**/sold.json
**/new_listing.json
**/session.json

# Ignore bot log
*/bot.log
*/**/logs
**/logs

# Ignore currency list and old coins
*/**/currencies.json
*/**/old_coins.json
**/currencies.json
**/old_coins.json

# Ignore pycache
*/**/__pycache__/
*/**/auth/__pycache__/
**/__pycache__/
**/auth/__pycache__/

# Ignore config
*/**/config.yml
**/config.yml

# Ignore test file
*/**/test_order.py

# Ignore virtual environment
venv/
**/test_order.py

.idea/

Expand All @@ -40,3 +37,150 @@ venv/

# Local History for Visual Studio Code
.history/



# Created by https://www.toptal.com/developers/gitignore/api/python
# Edit at https://www.toptal.com/developers/gitignore?templates=python

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# End of https://www.toptal.com/developers/gitignore/api/python
50 changes: 50 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_language_version:
python: python3.8
default_stages: [commit, push]
fail_fast: false
repos:
- repo: https://github.com/psf/black
rev: 21.12b0
hooks:
- id: black
args: [--safe, --config=pyproject.toml]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: debug-statements
language_version: python3

- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
args: [--config=setup.cfg]
language_version: python3

- repo: https://github.com/asottile/reorder_python_imports
rev: v2.6.0
hooks:
- id: reorder-python-imports
args: [--application-directories=./src, --py37-plus]

- repo: https://github.com/asottile/pyupgrade
rev: v2.29.1
hooks:
- id: pyupgrade
args: [--py37-plus]

# Add later, due to typing issues this is currently disabled
# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v0.920
# hooks:
# - id: mypy
# files: ^src/
# args: [--no-strict-optional, --ignore-missing-imports]
# additional_dependencies: []
27 changes: 22 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
# API Dockerfile

FROM python:3.9-alpine
RUN mkdir /app
COPY src /app
COPY ./requirements.txt /app/requirements.txt
WORKDIR /app

# Copy requirements file
COPY requirements.txt .

# Copy module files
COPY src/gateio_new_coins_announcements_bot ./src/gateio_new_coins_announcements_bot
COPY pyproject.toml .
COPY README.md .
COPY setup.cfg .
COPY setup.py .
COPY main.py .

# Copy relevant files to run bot
COPY config.yml .
COPY old_coins.json .
COPY auth/auth.yml ./auth/

#root directory contains main.py to start the bot as well as all config/auth.yml files
WORKDIR .

# install necessary requirements
RUN pip3 install -r requirements.txt

CMD [ "python", "main.py"]
1 change: 0 additions & 1 deletion src/auth/auth.example.yml → auth/auth.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@
# then go visit https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates and find the chat ID
telegram_token: "my_token"
telegram_chat_id: "my_chat_id"

2 changes: 1 addition & 1 deletion src/config.example.yml → config.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
BUY_START: True # when entering position
BUY_ORDER_CREATED: True # when buy order is created
BUY_FILLED: True # when the buy order got filled
SELL_START: True # when starting to sell
SELL_START: True # when starting to sell
SELL_FILLED: True # when sold
7 changes: 7 additions & 0 deletions dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
flake8==3.9.2
tox==3.24.3
pytest==6.2.5
pytest-cov==3.0.0
mypy==0.910
pre-commit==2.15.0
black==21.12b0
Loading

0 comments on commit 2f035ac

Please sign in to comment.