Package: leaguecloser
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 theAuto League Closer™!This handy program willautomatically close the League of Legends client whenever it's running, so you can get back to binging YouTube videos - uh, I mean doing homework :)AboutThis is amock application- complex enough to run into many common issues, but simple enough to quickly understand. The goal is to serve as areference for best practicesby using a clean project structure and handling packaging/distribution methods.InstallationRun theinstaller. (This app only works on Windows.)How It WorksRepeatedly checks if League is open usingpsutil.Closes League in a ~fancy~ way usingSikuliX.Using the Python ModuleThis module is just like any other Python module! See itsPyPi page, or just install it with:$pipinstallleaguecloserExample usage (also what the installable app does):importleaguecloserimporttimeprint("Searching for League...")whileTrue:ifleaguecloser.is_league_running():print("\nNO LEAGUE ALLOWED!")ifleaguecloser.close_league():print("\nThat's right... now get back to work!")time.sleep(3)Best PracticesMakefileTheMakefilecontains good practice methods for the common tasks below:$makerun# Runs the file$maketest# Runs all tests$makepackage_create# Creates (or updates) the leaguecloser package$makepackage_upload# Uploads the leaguecloser package to PyPi$makebuild_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.tomlto create a PyPi package and specify required dependenciesMANIFEST.into specify data files for setuptools to include in the packagesrc/app.pyas an entry point for the PyInstaller appmisc/InstallerSetupScript.iss, auto-generated by Inno Setup to create a Windows installer for the app.Handling Data FilesSince this app uses bothstatic 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__.pyonly exposes things that are meant to be public and has a docstring describing the module with a copyright footercomputer.pykeeps large code organized through code reuse, clear sections using comments, and Google docstrings for variables and functions.league.pyexists to ensure each file serves a specific purpose (separation of concerns), rather than bunching this short piece of code into another file.sikuli.pytreats 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 SetupRun the development environmentsetup scriptto create avirtual environmentand install dependencies:>&'.\misc\Dev Setup.ps1'Publishing a New VersionHere are the steps:Change the project version inpyproject.toml.Delete thedist/packagedirectory.Runmake package_create package_uploadand `make package_upload$makebuild_app
$makepackage_create
$makepackage_uploadCompile the Inno Setup script.Create a new release on Github with the generated installer attached as a binary.