Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy to PyPI, install with pip; removed some vulnerabilities…and more! #5

Merged
merged 2 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/leaderboard-generation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ jobs:

- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
python -m venv .venv
source .venv/bin/activate
pip install --editable .

- name: Run script and prepare files
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
run: |
run: |
# First, remove any conflicting files
rm -f examples/*-leaderboard.md

Expand All @@ -38,7 +39,7 @@ jobs:
# Extract the base name without .json extension
basename=$(basename "$config" .json)
# Generate the corresponding leaderboard file
python leaderboard.py "$config" --output_format MARKDOWN --unsorted --emoji --verbose >> "examples/${basename}-leaderboard.md"
slim-leaderboard "$config" --output_format MARKDOWN --unsorted --emoji --verbose >> "examples/${basename}-leaderboard.md"
done

# Set git config
Expand Down
17 changes: 16 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
*.sqlite
.DS_Store
._*
*.py[co]
.*.cfg
*.egg-info
dist
build
eggs
downloads
*.log
*~
*.sublime-workspace
.venv
venv
__pycache__
.env
78 changes: 52 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,67 +62,73 @@ Below is an example of a configuration file named `slim-config.json`:
}
```

Additional examples can be found in the `examples/` sub-folder within this repository.
Additional examples can be found in the `examples/` sub-folder within [the source repository](https://github.com/NASA-AMMOS/slim-leaderboard).


### Run Instructions

**Requirements:**
- Python 3
- `requests`, `requests-cache`, `tqdm`, and `rich` modules
- Install via: `pip install requests requests-cache tqdm rich`

**Setup:**
- Obtain a GitHub personal access token (classic). Ensure that all permissions under the "repo" group are enabled for this token, including `security_events`.
- Set the environment variable `GITHUB_TOKEN` with your token.
This software requires [Python 3.7 or later](https://www.python.org/). Usually, you'll want to create a virtual environment in order to isolate the dependencies of SLIM Leaderboard from other Python-using applications. Install SLIM Leaderboard into that environment using `pip`:

pip install slim-leaderboard

This installs the latest SLIM Leaderboard and its dependencies from the [Python Package Index](https://pypi.org/). The new console script `slim-leaderboard` is now ready for use. Confirm by running either:

slim-leaderboard --version
slim-leaderboard --help

To upgrade:

pip install --upgrade slim-leaderboard

Or select a specific version, such as `X.Y.Z`:

pip install slim-leaderboard==X.Y.Z

You'll also need a GitHub personal access token (classic). Ensure that all permissions under the "repo" group are enabled for this token, including `security_events`. Set the environment variable `GITHUB_TOKEN` with your token.

**Execution:**

*NOTE: the below example outputs will change as the tool evolves and adds more checks. For demonstration purposes only. *
**👉 Note:** the below example outputs will change as the tool evolves and adds more checks. This is for demonstration purposes only.

To generate a fresh leaderboard report, use the following command format:

```bash
python leaderboard.py [CONFIG_FILE] --output_format [FORMAT] --unsorted --verbose --emoji
```
slim-leaderboard --output_format FORMAT --unsorted --verbose --emoji CONFIG_FILE

The arguments above are as follows:

**Arguments:**
- `config_path`: Path to the JSON configuration file.
- (Optional) `--output_format`: Choose from 'TREE', 'TABLE', 'MARKDOWN', or 'PLAIN'. Default is 'TREE'.
- `CONFIG_FILE`: Path to the JSON configuration file.
- (Optional) `--output_format FORMAT`: Replace `FORMAT` with `TREE`, `TABLE`, `MARKDOWN`, or `PLAIN`. Default is `TREE`.
- (Optional) `--unsorted`: If included, the results will not be sorted.
- (Optional) `--verbose`: If included, outputs verbose information, including detailed statistics and explanations for each check performed.
- (Optional) `--emoji`: If included, outputs emojis for statuses rathe than pure text (e.g. ✅ ❌ ⚠️ etc.)

**Examples:**

Generate a report using default settings:

```bash
python leaderboard.py slim-config.json
```
slim-leaderboard slim-config.json

![tree](https://github.com/user-attachments/assets/f9ff8de4-2c8f-48dd-9475-ea04a3ba49f0)

Generate a report in table format:

```bash
python leaderboard.py slim-config.json --output_format TABLE
```
slim-leaderboard --output_format TABLE slim-config.json

![table](https://github.com/user-attachments/assets/84d99076-89e4-48c1-84bc-4cfc245f173b)

Verbose output in tree format:

```bash
python leaderboard.py slim-config.json --output_format TREE --verbose
```
slim-leaderboard --output_format TREE --verbose slim-config.json

![tree-verbose](https://github.com/user-attachments/assets/854aacf4-ce52-4819-a5f5-05a8f8684376)


Markdown format without sorting and with emojis:

```bash
python leaderboard.py slim-config.json --output_format MARKDOWN --unsorted --emoji
```
slim-leaderboard --output_format MARKDOWN --unsorted --emoji slim-config.json


```
Scanning Repositories: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:02<00:00, 1.15s/repo]
Expand All @@ -138,18 +144,38 @@ Scanning Repositories: 100%|█████████████████

See our root [CHANGELOG.md](CHANGELOG.md) for a history of our changes.


## Frequently Asked Questions (FAQ)

None. Please post a PR for this section to ask your question and the development team will add an answer.


## Contributing

Interested in contributing to our project? Please see our: [CONTRIBUTING.md](CONTRIBUTING.md)


### Local Development

For local development of SLIM Leaderboard, clone the GitHub repository, create a virtual environment, and then install the package in editable mode into it. For example:
```sh
$ git clone --quiet https://github.com/NASA-AMMOS/slim-leaderboard.git
$ cd slim-leaderboard
$ python3 -m venv .venv
$ source .venv/bin/activate
$ pip install --editable .
```

The `slim-leaderboard` console-script is now ready in editable mode; changes you make to the source files under `src` are immediately reflected when run.


## License

See our: [LICENSE](LICENSE)


## Support

Key points of contact are: [@riverma](https://github.com/riverma)


Loading
Loading