GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - cryptic-game/python-daemon: The official Python daemon of Cryptic

This repository was archived by the owner on Mar 13, 2022. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

140 Commits
140 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
daemon
daemon
 
 
tests
tests
 
 
.flake8
.flake8
 
 
.gitignore
.gitignore
 
 
Dockerfile
Dockerfile
 
 
LICENSE
LICENSE
 
 
Pipfile
Pipfile
 
 
Pipfile.lock
Pipfile.lock
 
 
README.md
README.md
 
 
coverage.sh
coverage.sh
 
 
daemon.env
daemon.env
 
 
docker-compose.yml
docker-compose.yml
 
 
docs.sh
docs.sh
 
 
pyproject.toml
pyproject.toml
 
 
test.sh
test.sh
 
 

Repository files navigation

CI Code style: black Maintainability Test Coverage DockerHub - Python Daemon

Python Daemon

The official Python Daemon of Cryptic

Documentation

The documentation can be found on GitHub Pages.

If you want to build the documentation yourself, use the docs script:

pipenv sync --dev
pipenv run docs

Note that you need to have Docker installed for this!

Development

Prerequisites

  • Python >=3.9
  • Pipenv
  • Black
  • Git
  • Docker and docker-compose (recommended)
  • PyCharm Community/Professional (recommended)
  • An instance of the Cryptic Java Server (recommended)

Clone the repository

SSH (recommended)

git clone [email protected]:cryptic-game/python-daemon.git

HTTPS

git clone https://github.com/cryptic-game/python-daemon.git

Setup Dependencies

Once you have cloned the repository, you need to create a virtual environment and install the dependencies using the following command:

pipenv sync --dev

Environment Variables

To set the required environment variables it is necessary to create a file named (exactly) .env in the root directory (there is a template for this file in daemon.env).

Variable Name Description Default Value
LOG_LEVEL one of DEBUG, INFO, WARNING, ERROR, CRITICAL INFO
HOST Host for the uvicorn server to listen on 0.0.0.0
PORT Port for the uvicorn server to listen on 8000
RELOAD Enable uvicorn auto-reload (for development purposes only!) False
DEBUG Enable debug mode False
API_TOKEN Secret api token for server-daemon communication
SQL_DRIVER Name of the SQL connection driver postgresql+asyncpg
SQL_HOST Hostname of the database server localhost
SQL_PORT Port on which the database server is running 5432
SQL_DATABASE Name of the database you want to use cryptic
SQL_USERNAME Username for the database account cryptic
SQL_PASSWORD Password for the database account cryptic
POOL_RECYCLE Number of seconds between db connection recycling 300
POOL_SIZE Size of the connection pool 20
MAX_OVERFLOW The maximum overflow size of the connection pool 20
SQL_SHOW_STATEMENTS whether SQL queries should be logged False
SQL_CREATE_TABLES whether to create database tables on startup False
REDIS_HOST Hostname of the redis server redis
REDIS_PORT Port on which the redis server is running 6379
REDIS_DB Index of the redis database you want to use 0
SENTRY_DSN [Optional] Sentry DSN for logging

Project structure

Project
├── daemon
│  ├── endpoints
│  │  ├── __init__.py
│  │  └── <endpoint collection>.py
│  ├── exceptions
│  │  ├── api_exception.py
│  │  └── <endpoint collection>.py
│  ├── models
│  │  └── <endpoint collection>.py
│  └── schemas
│     ├── <endpoint collection>.py
│     ├── daemon.py
│     └── ok.py
└── tests
   ├── endpoints
   │  ├── __init__.py
   │  └── test_<endpoint collection>.py
   └── test_<...>.py

PyCharm configuration

  • Open PyCharm and go to Settings ➔ Project: python-daemon ➔ Python Interpreter
  • Open the menu Python Interpreter and click on Show All...
  • Click on the plus symbol
  • Click on Pipenv Environment
  • Select Python 3.9 as Base interpreter
  • Confirm with OK
  • Change the working directory to root path ➔ Edit Configurations ➔ Working directory

Running

To run the Python Daemon yourself, use the daemon script:

pipenv run daemon

Code Style

Before committing your changes, please check that all unit tests are passing, reformat your code using black and run the linter:

pipenv run test
pipenv run black
pipenv run flake8

About

The official Python daemon of Cryptic

cryptic-game.github.io/python-daemon/

Topics

crypticcryptic-gamedockerfastapihacktoberfestpythonsqlalchemyuvicorn

Resources

Readme
AGPL-3.0 license
Activity
Custom properties

Stars

6 stars

Watchers

3 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.