spatial-data-discovery / spatial-data-discovery.github.io

Organization website
https://spatial-data-discovery.github.io/
4 stars 0 forks source link

The Utility Script | Spring 2020 #26

Closed dt-woods closed 4 years ago

dt-woods commented 4 years ago

"Never be afraid to show your colleagues your work. If you are afraid to, that's probably the bigger sign that something is wrong with your code and that you already know it."—N. Schweitzer (2008), Software Consultant, Wauwatosa, WI

5 points

This purpose of this assignment is to introduce me to your Python programming skills. You may choose any script that you have written or found useful in performing a "utility" task. It may range from counting characters in a file to lexicographically sorting lines in a file. If you are not the author, please assign proper attribution to the originators.

Grading

Points Description
0.5 pt Create an issue for developing your script and assign it to yourself.
0.5 pt Track your work by using the issue numbers in your commits.
1.0 pt Update your About .Rmd file with a copy of the code using a code block (see examples or search the internet) and include a link to your python file.
2.0 pt Produce a Python script that performs a basic utility function in the /scripts directory of this repository.
0.5 pt Your python script should import the module argparse and provide a useful help message if a user would type python yourscript.py --help
0.5 pt Update the scripts/README.md file on GitHub

Instructions

Once you have your idea for your code, please create a new issue on GitHub.

Test Your Skills: In your local copy of the repository, create a new branch and name it based on the issue number you raised on GitHub. Work on your code in this new branch; you will not have to worry about merging until your development is complete. Make certain you include your issue number in your commit messages.

``` {style="overflow:auto;white-space:pre;margin:0 0 29px 0;border:1px solid #cccccc;border-radius:2px;background:#091e42;font-family:monospace, monospace;font-size:1em;line-height:1.5;font-weight:400;line-height:1.5;"} # On the Terminal / Command Prompt git checkout -b [iss2] # replace "[iss2]" such that the issue number matches your issue on GitHub cd scripts # move into the scripts directory git add [myscript.py] # change [myscript.py] with your script name git commit -m "Beginning development on my utility script. Addresses #2." # change the '#2' to reflect your issue number ```

As an added challenge, make sure your script includes support for "-h" or "--help" command-line arguments (see example).

When you have finished developing your script, open your "About" .Rmd file, add a heading called "Sample Script" and copy-and-paste your Python code into a code block. Also, create a link to your script file. Make sure to stage and commit changes you made to this file and associate them with the issue you raised.

When you are ready to submit your assignment for grading, checkout the master branch and merge in your changes.

``` {style="overflow:auto;white-space:pre;margin:0 0 29px 0;border:1px solid #cccccc;border-radius:2px;background:#091e42;font-family:monospace, monospace;font-size:1em;line-height:1.5;font-weight:400;line-height:1.5;"} git checkout master # move back on to the master branch git pull # download the latest changes git merge [iss2] # change [iss2] with your branch name # You should be prompted for a merge message. # Save and close the message. git push # send your changes to remote server git branch -d [iss2] # delete old branch; you are done with it ```

Once you have committed your script and updated your about .Rmd file, log in to GitHub and open the README.md file in the scripts directory. Add your file to the list and a bullet point under it with a one-line description of what it does. Please use consistent markdown syntax to match the other entries.