Mock package that auto-closes the League client
Project description
Auto League Closer™
Tired of procrastinating on homework all day while still being hardstuck Bronze? Suffering from a bad case of League withdrawal?
Well, I've got a solution for you! Install the Auto League Closer™!
This handy program will automatically close the League of Legends client whenever it's running, so you can get back to binging YouTube videos - uh, I mean doing homework :)
About
This is a mock application - complex enough to run into many common issues, but simple enough to quickly understand. The goal is to serve as a reference for best practices by using a clean project structure and handling packaging/distribution methods.
Installation
Run the installer. (This app only works on Windows.)
How It Works
Using the Python Module
This module is just like any other Python module! See its PyPi page, or just install it with:
$ pip install leaguecloser
Example usage (also what the installable app does):
import leaguecloser
import time
print("Searching for League...")
while True:
if leaguecloser.is_league_running():
print("\nNO LEAGUE ALLOWED!")
if leaguecloser.close_league():
print("\nThat's right... now get back to work!")
time.sleep(3)
Best Practices
Makefile
The Makefile contains good practice methods for the common tasks below:
$ make run # Runs the file
$ make test # Runs all tests
$ make package_create # Creates (or updates) the leaguecloser package
$ make package_upload # Uploads the leaguecloser package to PyPi
$ make build_app # Builds the app into a standalone folder with an executable ("freezes" the app)
The purpose of a Makefile is to simplify repetitive tasks. It's basically multiple shell scripts, but combined into one file with a simple command for each task.
Building (EXEs) and Packaging (PyPi)
For building and packaging, these files must be configured per project (this repo serves as a good reference for how to do this!):
- pyproject.toml to create a PyPi package and specify required dependencies
- MANIFEST.in to specify data files for setuptools to include in the package
- src/app.py as an entry point for the PyInstaller app
- misc/InstallerSetupScript.iss, auto-generated by Inno Setup to create a Windows installer for the app.
Handling Data Files
Since this app uses both static and dynamic data files (the SikuliX script folder, along with a large JAR file that is downloaded on the first run), the above files and some special code were required. Actually, the module, albeit small, follows best practices:
__init__.py
only exposes things that are meant to be public and has a docstring describing the module with a copyright footercomputer.py
keeps large code organized through code reuse, clear sections using comments, and Google docstrings for variables and functions.league.py
exists to ensure each file serves a specific purpose (separation of concerns), rather than bunching this short piece of code into another file.sikuli.py
treats frozen and non-frozen environments differently, and demonstrates how to handle program data files. (Data that's unique per computer user should be stored in%APPDATA%
instead.)
Development Setup
Run the development environment setup script to create a virtual environment and install dependencies:
> & '.\misc\Dev Setup.ps1'
Publishing a New Version
Here are the steps:
-
Change the project version in
pyproject.toml
. -
Delete the
dist/package
directory. -
Run
make package_create package_upload
and `make package_upload
$ make build_app
$ make package_create
$ make package_upload
-
Compile the Inno Setup script.
-
Create a new release on Github with the generated installer attached as a binary.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file leaguecloser-1.0.5.tar.gz
.
File metadata
- Download URL: leaguecloser-1.0.5.tar.gz
- Upload date:
- Size: 32.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23fc6339fe8607c5ae0b7204e81a8260b27d0af9be05dd77780b8446aeba8d35 |
|
MD5 | e2b4c1db1df9851f01790cc120b658e7 |
|
BLAKE2b-256 | 6dbc54d76d239cc822018a187038bca01c8b748b5cac2ae061378c1abf3bcf24 |
File details
Details for the file leaguecloser-1.0.5-py3-none-any.whl
.
File metadata
- Download URL: leaguecloser-1.0.5-py3-none-any.whl
- Upload date:
- Size: 29.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59badadb0256b8feef62df619bbabdacd1f83003976f3578803aca95cbdac2c9 |
|
MD5 | 60de564be3f77c7728e9b165c9d7fa18 |
|
BLAKE2b-256 | 6fe70c8950d20f3dfe8ba0de0a8fb064a229c485372a2abce2914a142e6145b9 |