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

refactor: ♻️ improve repository code base and config and more orgs added. #1

Merged
merged 1 commit into from
Sep 26, 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
41 changes: 41 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
__pycache__/
*.py[cod]
*$py.class

.Python
build/
develop-eggs/
dist/
downloads/
data/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

.python-version

.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/


.mypy_cache/
.dmypy.json
dmypy.json

.pre-commit-config.yaml
.pre-commit-hooks.yaml
9 changes: 8 additions & 1 deletion .github/workflows/dev-star-tracker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
push:
branches:
- master
pull_request:
branches:
- '**'
workflow_dispatch:

jobs:
Expand All @@ -19,4 +22,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
organizations: 'roboflow, autodistill'
organizations: 'roboflow, autodistill, voxel51'

- name: 📊 Show data.csv
run: |
cat data/data.csv
6 changes: 3 additions & 3 deletions .github/workflows/star-tracker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
permissions:
contents: write # Grants push access


jobs:
track-stars:
runs-on: ubuntu-latest
Expand All @@ -22,10 +22,10 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
organizations: 'roboflow, autodistill'
organizations: 'roboflow, autodistill, huggingface, voxel51, ultralytics, Lightning-AI'

- name: Commit Data
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Update star data
file_pattern: data/data.csv
file_pattern: data/data.csv
33 changes: 33 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

ci:
autofix_prs: true
autoupdate_schedule: weekly
autofix_commit_msg: "fix(pre_commit): 🎨 auto format pre-commit hooks"
autoupdate_commit_msg: "chore(pre_commit): ⬆ pre_commit autoupdate"

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
exclude: test/.*\.py
- id: check-yaml
exclude: mkdocs.yml
- id: check-executables-have-shebangs
- id: check-toml
- id: check-case-conflict
- id: check-added-large-files
- id: detect-private-key
- id: pretty-format-json
exclude: demo.ipynb
args: ['--autofix', '--no-sort-keys', '--indent=4']
- id: end-of-file-fixer
- id: mixed-line-ending

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.7
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
types_or: [ python, pyi, jupyter ]
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.9-slim
FROM python:3.12-slim

COPY startrack/ /startrack/
COPY requirements.txt .
Expand Down
50 changes: 25 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@

## 👋 hello

Star-Track is a user-friendly utility for tracking GitHub repository statistics.
Star-Track is a user-friendly utility for tracking GitHub repository statistics.

## 💻 install

- clone repositoryą

```bash
git clone https://github.com/roboflow/star-track.git
```

- setup python environment and activate it [optional]
```bash
git clone https://github.com/roboflow/star-track.git
```

```bash
python3 -m venv venv
source venv/bin/activate
```
- setup python environment and activate it \[optional\]

```bash
python3 -m venv venv
source venv/bin/activate
```

- install required dependencies

```bash
pip install -r requirements.txt
```
```bash
pip install -r requirements.txt
```

## ⚙️ execute

Expand All @@ -37,22 +37,22 @@ To test the Docker solution locally, follow these steps:

1. **Build the Docker Image**

```bash
docker build -t startrack:latest .
```
```bash
docker build -t startrack:latest .
```

2. **Run the Docker Container**

```bash
docker run --rm \
-e GITHUB_TOKEN=your_github_token \
-e INPUT_ORGANIZATIONS=org1,org2 \
-e INPUT_REPOSITORIES=user1/repo1,user2/repo2 \
-v $(pwd)/data:/app/data \
startrack:latest
```
```bash
docker run --rm \
-e GITHUB_TOKEN=your_github_token \
-e INPUT_ORGANIZATIONS=org1,org2 \
-e INPUT_REPOSITORIES=user1/repo1,user2/repo2 \
-v $(pwd)/data:/app/data:z \
startrack:latest
```

### Explanation:
### Explanation

- `--rm`: Automatically remove the container when it exits.
- `-e GITHUB_TOKEN=your_github_token`: Set the `GITHUB_TOKEN` environment variable.
Expand Down
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.organizations }}
- ${{ inputs.repositories }}
- ${{ inputs.organizations }}
- ${{ inputs.repositories }}
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"organizations": [
"roboflow"
]
}
}
121 changes: 121 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
[tool.ruff]
target-version = "py312"

exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
"yarn-error.log",
"yarn.lock",
"docs",
]

line-length = 89
indent-width = 4

[tool.ruff.lint]
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
select = ["E", "F", "I", "A", "Q", "W","RUF","UP","YTT","NPY","ANN","T","S","Q","N","G","F","E","C","B","A"]
ignore = []
# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"I",
"N",
"Q",
"S",
"T",
"W",
"ANN",
"ARG",
"BLE",
"COM",
"DJ",
"DTZ",
"EM",
"ERA",
"EXE",
"FBT",
"ICN",
"INP",
"ISC",
"NPY",
"PD",
"PGH",
"PIE",
"PL",
"PT",
"PTH",
"PYI",
"RET",
"RSE",
"RUF",
"SIM",
"SLF",
"TCH",
"TID",
"TRY",
"UP",
"YTT",
]
unfixable = []
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
pylint.max-args = 20

[tool.ruff.lint.flake8-quotes]
inline-quotes = "double"
multiline-quotes = "double"
docstring-quotes = "double"

[tool.ruff.lint.pydocstyle]
convention = "google"

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["E402", "F401"]

[tool.ruff.lint.mccabe]
# Flag errors (`C901`) whenever the complexity level exceeds 5.
max-complexity = 20

[tool.ruff.lint.isort]
order-by-type = true
no-sections = false

[tool.ruff.format]
# Like Black, use double quotes for strings.
quote-style = "double"
docstring-code-format = true

# Like Black, indent with spaces, rather than tabs.
indent-style = "space"

# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false

# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pandas
requests
requests
Loading