Skip to content

Commit

Permalink
Merge pull request #1 from compsys-progtools/sub_command
Browse files Browse the repository at this point in the history
Sub command // major refactor.
  • Loading branch information
brownsarahm authored Mar 2, 2024
2 parents 2220b76 + b9af403 commit adfccd2
Show file tree
Hide file tree
Showing 43 changed files with 1,787 additions and 537 deletions.
11 changes: 11 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM mcr.microsoft.com/devcontainers/anaconda:0-3

# Copy environment.yml (if found) to a temp location so we update the environment. Also
# copy "noop.txt" so the COPY instruction does not fail if no environment.yml exists.
COPY environment.yml* .devcontainer/noop.txt /tmp/conda-tmp/
RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then umask 0002 && /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment.yml; fi \
&& rm -rf /tmp/conda-tmp

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>
33 changes: 33 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/anaconda
{
"name": "Anaconda (Python 3)",
"build": {
"context": "..",
"dockerfile": "Dockerfile"
},
"customizations": {
"vscode": {
"extensions": [
"ExecutableBookProject.myst-highlight",
"vsls-contrib.codetour",
"searKing.preview-vscode"
]
}
},

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "pip install -r requirements.txt; pip install .",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
3 changes: 3 additions & 0 deletions .devcontainer/noop.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file copied into the container along with environment.yml* from the parent
folder. This file is included to prevents the Dockerfile COPY instruction from
failing if no environment.yml is found.
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot

version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
114 changes: 114 additions & 0 deletions .tours/overview.tour
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
{
"$schema": "https://aka.ms/codetour-schema",
"title": "overview",
"steps": [
{
"title": "Where to start",
"file": "setup.py",
"description": "setuptools is a Python package for installing programs. This file `setup.py` is special that `pip` will look for. ",
"line": 1
},
{
"title": "how it finds modules",
"file": "setup.py",
"description": "here it defines what to be installed, each of these refers to a folder with an `__init__.py` or a `.py` file. ",
"line": 6
},
{
"title": "dependencies",
"file": "setup.py",
"description": "and here it defines the dependencies to install first",
"line": 10
},
{
"title": "Console entry points, aka terminal commands",
"file": "setup.py",
"description": "this is what makes it have CLI programs available this says that the `cspt` command will be found in the `cspt/cli.py` file in the `cspt_cli` function. let's go look at that function next.",
"line": 13
},
{
"title": "top group function",
"file": "cspt/cli.py",
"description": "This funciton is not very interesting, but it defines the entrypoint that uses the [click package](https://click.palletsprojects.com/en/8.1.x/commands/)",
"line": 15
},
{
"title": "first subcommand",
"file": "cspt/cli.py",
"description": "these lines make the following function a sub command of the `cspt_cli` function's command (`cspt`)",
"line": 23
},
{
"title": "another subcommand",
"file": "cspt/cli.py",
"description": "here in this function, it calls other functions provided in the library with a little bit of logic to parse the options. \n\nthen it uses `click`'s `echo` method to print the info to the terminal. ",
"line": 59
},
{
"title": "tracing a function",
"file": "cspt/cli.py",
"description": "here it is not clear where this function comes from, but if we go to the top of the file, we can learn more. We will go there next. ",
"line": 63
},
{
"title": "imported functions",
"file": "cspt/cli.py",
"description": "From here we see that the `fetch_to_checklist` is defined in the `tasktracking.py` let's go there next",
"line": 10
},
{
"title": "a core function",
"file": "cspt/tasktracking.py",
"description": "here it is, this function takes in the date and assignment type",
"line": 105
},
{
"title": "docstring",
"file": "cspt/tasktracking.py",
"description": "here you can see that this line is incomplete. If no one has yet, you could make a suggestion on the PR to fix it. ",
"line": 113
},
{
"title": "requests",
"file": "cspt/tasktracking.py",
"description": "here is that line we talked about in class that fetches the course website. ",
"line": 119
},
{
"title": "regex",
"file": "cspt/tasktracking.py",
"description": "the majority of the work this function does is use regular expressions do clean up the text",
"line": 123
},
{
"title": "return",
"file": "cspt/tasktracking.py",
"description": "then it returns the actual text",
"line": 126
},
{
"title": "shared variable",
"file": "cspt/tasktracking.py",
"description": "this main URL is used in a lot of places, so I made it a variable",
"line": 117
},
{
"title": "imported variable",
"file": "cspt/tasktracking.py",
"description": "this variable is stored in the config.py file so that I only have to change it in one place, despite using it in many. ",
"line": 7
},
{
"title": "variables to update each semester",
"file": "cspt/config.py",
"description": "This is what I have to update each semester",
"line": 4
},
{
"title": "example options",
"file": "cspt/cli.py",
"description": "for this function, I wanted the options to be flags. ",
"line": 26
}
]
}
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
recursive-include cspt/assets *
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,37 @@ helper code for class

If you are trying to use this while finishing an incomplete, use the correct release.

## To install:
## To install from clone

```
git clone https://github.com/introcompsys/courseutils
git clone https://github.com/compsys-progtools/courseutils
cd courseutils
pip install .
```

You may need to use pip3 instead of pip.
On Windows, use GitBash for the clone and then Anaconda Prompt for install

## To install direct

```
pip install git+ https://github.com/compsys-progtools/courseutils
```

You may need to use pip3 instead of pip.
On Windows, use GitBash for the clone and then Anaconda Prompt for install


## See the docs

```
pip install -r requirements.txt
cd docs
make html
```


## To upgrade:
```
cd courseutils
Expand Down
Loading

0 comments on commit adfccd2

Please sign in to comment.