Skip to content

Latest commit

 

History

History
181 lines (105 loc) · 8.84 KB

File metadata and controls

181 lines (105 loc) · 8.84 KB

Development Setup

Open issues for development: Help Wanted

Table of Contents


Note to Users

The following setup instructions are intended for developer use only! For information about how to set up the Fantasy Football Metrics Weekly Report app for regular usage, please see the setup documentation HERE for more information.


Manual Setup

  • Make sure your operating system (OS) has the correct version of Python installed (see the main README.md section on dependencies for instructions).

  • After you've finished installing Python, check that it has been successfully installed by running python3 --version (or py -0p (or py -3 to see if you can launch Python 3 if py -0p fails) if using the Python launcher for Windows in Windows to list installed Python version with their paths) in the command line again, and confirming that it outputs Python 3.x.x. If it does not, double check that you followed all Python installation steps correctly.

  • Open a command line prompt

    • macOS: type Cmd + Space (⌘ + Space) to bring up Spotlight, and search for "Terminal" and hit enter).

    • Windows: type Windows + R to open the "Run" box, then type cmd and then click "OK" to open a regular Command Prompt (or type cmd and then press Ctrl + Shift + Enter to open an administrator Command Prompt)

    • Linux: type Ctrl+Alt+T (in Ubuntu).

  • Install git (if you do not already have it installed). You can see instructions for installation on your OS here. If you are comfortable using the command line, feel free to just install git for the command line. However, if using the command line is not something you have much experience with and would prefer to do less in a command line shell, you should install Git for Desktop.

  • Clone this project to whichever directory you wish:

    git clone [email protected]:uberfastman/fantasy-football-metrics-weekly-report.git
    • If not using SSH, then use HTTPS by running:
    git clone https://github.com/uberfastman/fantasy-football-metrics-weekly-report.git
  • Run cd fantasy-football-metrics-weekly-report to enter the project directory.

  • Set up a virtual environment:

    • macOS/Linux:

      • Run pip3 install virtualenv virtualenvwrapper (if not already installed).

      • Run touch ~/.bashrc.

      • Run

        echo 'export WORKON_HOME=$HOME/.virtualenvs' >> ~/.bashrc
        echo 'source /usr/local/bin/virtualenvwrapper.sh' >> ~/.bashrc
      • Run source ~/.bashrc

      • Run which python3. This should output something like /usr/local/bin/python3. Copy that path for the next step.

    • Windows:

      • Run pip3 install virtualenv virtualenvwrapper-win

      • Details for using virtualenvwrapper-win can be found here.

  • Run mkvirtualenv -p /usr/local/bin/python3 fantasy-football-metrics-weekly-report.

  • When the previous command is finished running, your command line prompt should now look something like this:

    (fantasy-football-metrics-weekly-report) [username@Computer 02:52:01 PM] ~/fantasy-football-metrics-weekly-report $

    Congratulations, you have successfully created a Python 3 virtual environment for the project to run in!

  • Finally, run pip install -r requirements.txt -r requirements-dev.txt.


Running the Report Application

  • If you are running on macOS, see below!

  • If you followed the setup instructions and set up the application to run in a virtual environment, once you have navigated to the project directory, you MUST run

    workon fantasy-football-metrics-weekly-report

    before running the report EVERY TIME you open a new command line prompt to run the application!

  • Make sure you have updated the default league ID (league_id value) in the .env file to your own league id. Please see the respective setup instructions for your chosen platform for directions on how to find your league ID.

  • Run python main.py. You should see the following prompts:

    • Generate report for default league? (y/n) -> .

      Type y and hit enter.

    • Generate report for default week? (y/n) ->.

      Type y and hit enter.

    • The FIRST time you run the app, a browser window will automatically open, and if you correctly followed the instructions in the Report Setup section, you should see a verifier code (something like w6nwjvz).

    • Copy the above verifier code and return to the command line window, where you should now see the following prompt:

      Enter verifier :

      Paste the verifier code there and hit enter.

    • Assuming the above went as expected, the application should now generate a report for your fantasy league for the selected NFL week.

NOTE: You can also specify a large number of settings directly in the command line. Please see the usage section for more information.

macOS Launch Script

If you are running on macOS, there is an additional bash script available in the project, run_in_virtualenv.command. This script allows you to double-click it and run the app in a new Terminal window. It REQUIRES you to have completed all steps in Setup, and also the above steps in Running the Report Application, except running the workon command or the python main.py command. Instead, do the following:

  • Right click on run_in_virtualenv.command and select Open With, then select TextEdit.

  • Modify the path you find in the script after cd to point to wherever you cloned the application. You can either use the absolute path (something like /Users/username/Projects/fantasy-football-metrics-weekly-report), or a shortcut to your home directory (~), like ~/Documents/fantasy-football-metrics-weekly-report).

  • Move run_in_virtualenv.command wherever you wish it to be for easy access.

  • You can now double-click run_in_virtualenv.command, and it will open a new Terminal window and run the application! If that fails, you may need to change the permissions on run_in_virtualenv.command. You can do that as follows:

    • Open a Terminal window.

    • Run cd path/to/wherever/you/put/run_in_virtualenv.command

    • Run chmod +x run_in_virtualenv.command

    • If you get a permissions error after running the chmod command, you may need to run it as an administrator:

      sudo chmod +x run_in_virtualenv.command

      And then put in your password to allow the operating system to modify the permissions on run_in_virtualenv.command.

    • NOW you should be able to double-click run_in_virtualenv.command to launch the application!


Virtual Environment

When you are done working within the virtualenv, you can run deactivate within the environment to exit:

(fantasy-football-metrics) host-machine: fantasy-football-metrics-weekly-report $ deactivate

When you wish to work within the virtualenv once more, do the following:

  • Run source ~/.bashrc

  • View virtualenvs that you have available: lsvirtualenv

  • Run workon fantasy-football-metrics-weekly-report (or whatever you named your virtual environment for the application).