Skip to content

Commit 8d4fa61

Browse files
merge #17: migrations, optimizations and docs update for v2.5.0
merge: v2.5.0
2 parents 3ff90dc + ebd0768 commit 8d4fa61

26 files changed

Lines changed: 2160 additions & 659 deletions

‎.github/workflows/main.yml‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Main
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
jobs:
8+
run-tests:
9+
uses: ./.github/workflows/test.yml
10+
11+
run-release:
12+
needs: run-tests
13+
uses: ./.github/workflows/release.yml
14+
secrets: inherit

‎.github/workflows/release.yml‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Release
2+
3+
on:
4+
workflow_call:
5+
6+
permissions:
7+
contents: write
8+
pull-requests: write
9+
10+
jobs:
11+
release-please:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: googleapis/release-please-action@v4
15+
id: release
16+
with:
17+
release-type: python
18+
19+
- name: Checkout code
20+
if: ${{ steps.release.outputs.pr }}
21+
uses: actions/checkout@v4
22+
with:
23+
ref: ${{ fromJson(steps.release.outputs.pr).head_sha }}
24+
25+
- name: install uv
26+
if: ${{ steps.release.outputs.pr }}
27+
uses: astral-sh/setup-uv@v5
28+
29+
- name: update uv lockfile
30+
if: ${{ steps.release.outputs.pr }}
31+
run: |
32+
uv lock
33+
git config user.name github-actions[bot]
34+
git config user.email github-actions[bot]@users.noreply.github.com
35+
git add uv.lock
36+
git commit -m "chore: update uv.lock for new version" || echo "no changes"
37+
git push

‎.github/workflows/test.yml‎

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
1-
name: Run Tests
1+
name: Test
22

33
on:
44
push:
55
branches: [ master ]
66
pull_request:
77
branches: [ master ]
8+
workflow_call:
9+
10+
permissions:
11+
contents: write
12+
pull-requests: write
813

914
jobs:
1015
test:
1116
runs-on: ubuntu-latest
12-
1317
steps:
14-
- uses: actions/checkout@v3
15-
16-
- name: Set up Python
17-
uses: actions/setup-python@v4
18-
with:
19-
python-version: '3.11'
20-
21-
- name: Install dependencies
22-
run: |
23-
python -m pip install --upgrade pip
24-
pip install -r requirements.txt
25-
26-
- name: Run tests
27-
run: |
28-
pytest tests/ -v
18+
- uses: actions/checkout@v4
19+
20+
- name: Install uv
21+
uses: astral-sh/setup-uv@v5
22+
with:
23+
enable-cache: true
24+
25+
- name: set up python
26+
run: uv python install 3.11
27+
28+
- name: install dependencies
29+
run: uv sync --all-extras --dev
30+
31+
- name: run tests
32+
run: uv run pytest tests/ -v

‎.gitignore‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,11 @@
1717
# dataset (removing cause I'm no longer hosting on railway and using my second laptop to double as a server)
1818
/data
1919
/predict
20+
21+
# uv migrations
22+
.python-version
23+
.ruff_cache
24+
.venv
25+
26+
# fonts dir for better analytics-overview
27+
/fonts

‎CONTRIBUTING.md‎

Lines changed: 120 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,149 @@
1-
# Written on: 25/12/2025
1+
# Contributing to Bitsatards Bot
22

3-
## Contributions
3+
## Code-Contributions
44

5-
I think this goes without saying but still, you need to have a GitHub account to make any sort of contributions to this codebase which also applies to creating issues as well.
5+
### last written on 5/2/2026
66

7-
If this is your time using GitHub or making code-contributions to open-source projects, no worries! again I am listing how you can still contribute to this project:
7+
Thank you for considering to contribute, Whether you are fixing a bug or adding a new feature, your help is appreciated highly.
88

9-
1. proceed to fork this [repository](https://github.com/PranavU-Coder/bitsatards_bot)
10-
2. please navigate repositories listed under your profile where you should be able to find this codebase listed as a 'fork', clone that repository under **YOUR** profile and start working on it locally.
11-
3. install all necessary dependencies by running:
9+
If you are new to open-source or GitHub, follow the steps below to get started ->
1210

13-
```bash
14-
pip install -r requirements.txt
15-
```
11+
1.proceed to fork this [repository](https://github.com/PranavU-Coder/bitsatards_bot) and clone it locally:
1612

17-
4. once any changes are made to the codebase from your end, make sure to 'commit' those changes to your forked repository, once the codebase you have modified seems aptly ready for being pushed to main codebase (the one which is under mine) proceed to create a 'pull-request'.
13+
```bash
14+
git clone https://github.com/{replace with your username}/bitsatards_bot.git
15+
cd bitsatards_bot
16+
```
1817

19-
**PLEASE NOTE** that a pull-request will be accepted only and only if the code changes have been tested and were successful locally otherwise it will be **CLOSED**, please remove comments and any irrelevant statements that would be asked in template.md at time of creation of pull-request
18+
2.create a branch for your purpose of work: feat/fix:
19+
20+
```bash
21+
git checkout -b feat/feat-name
22+
# or
23+
git checkout -b fix/bug-name
24+
```
25+
26+
3.this project has **recently** migrated from pip to uv thus it is important to have uv installed on your system.
27+
28+
```bash
29+
uv sync
30+
```
31+
32+
This command will automatically create a virtual environment and install all required packages listed in the uv.lock file.
33+
34+
3.Dev Standards:
35+
36+
(1) Run
37+
38+
```bash
39+
uv run ruff format .
40+
```
41+
42+
before committing.
43+
44+
(2) Ensure
45+
46+
```bash
47+
uv run ruff check .
48+
```
49+
50+
passes without errors.
51+
52+
(3) Run tests locally
53+
54+
```bash
55+
uv run pytest
56+
```
57+
58+
A passing build is required for any merge.
59+
60+
(4) Commit Messages: Conventional Commits Please, prefix your messages accordingly:
61+
62+
```text
63+
feat: for new features.
64+
fix: for bug fixes.
65+
docs: for documentation/non-code changes.
66+
```
67+
68+
4.commit your changes to your branch.
69+
70+
push your changes to your fork.
71+
72+
open a Pull Request (PR) against the master branch of the original repository.
73+
74+
Wait for the automated tests to pass. Once reviewed they will be merged.
75+
76+
Make sure to appropriately add/remove lines of the PULL_REQUEST_TEMPLATE.md which align to your changes.
2077

2178
<img width="690" height="253" alt="image" src="https://github.com/user-attachments/assets/9f1af6c1-7d73-4f94-89f4-4b1cc84f6496" />
2279

23-
at the moment, I alone am the codeowner of this codebase hence mostly it will be reviewing the pull-requests and approve if it fits with the existing codebase, assuming the scope of this project increases, I'm more than happy to give ownership of this codebase to any enthusiastic contributor who is willing to do code-reviews.
80+
At the moment, I alone am the codeowner of this codebase hence mostly it will be reviewing the pull-requests and approve if it fits with the existing codebase, assuming the scope of this project increases, I'm more than happy to give ownership of this codebase to any enthusiastic contributor who is willing to do code-reviews.
2481

25-
please make sure that you are adding docstrings underneath your functions or any classes if you are planning to define as it will be easier for other developers to read and understand, similarly apply strong type annotations wherever possible, although again honestly at the time of writing this, I myself am guilty of not doing this so I will be working on this as well.
82+
More Recently, I have installed CodeRabbit on this repository to do code-reviews alongside me.
2683

27-
There are plans of integrating unit-tests using pytest to ensure any code-change can handle edge-cases regardless of what the diffs would be.
84+
Feature Documentation:
85+
86+
Please add docstrings underneath any new functions or classes. While much of the code is still being documented, it would be a good precedent in terms of open-source projects.
87+
88+
Please consider using strong type hinting for all function signatures and variables. I am of the opinion and in the movement to make this project to be in the direction of 100%-type safe
2889

2990
## Features & Bug Reports
3091

31-
Starting with a pretty obvious phase of development, which is what features or problems will this project be undertaking so to put it shortly, please check the [roadmap](https://github.com/users/PranavU-Coder/projects/9) page to get an idea of what is being actively worked on and what would be worked on in the future.
92+
Before contributing, review the [Roadmap](https://github.com/users/PranavU-Coder/projects/9) first to understand current priorities and exisitng issues that are being worked on.
93+
94+
For raising issues, they must follow these criterias to be considered:
3295

33-
if you want any feature to be implemented please state **explicitly why exactly it is important** under the [issues](https://github.com/PranavU-Coder/bitsatards_bot/issues) tab by creating an issue under the same mentioned, similarly in bug-related issues please state where exactly is the bug occurring and how to reproduce from the developer's side so it can be worked upon to fix it.
96+
Feature Requests: You must explicitly justify why the feature is necessary to be implemented.
97+
98+
Bug Reports: You must provide a clear "Steps to Reproduce" section (check figure below). If the developer cannot replicate the bug based on your description, the issue will be marked as invalid.
99+
100+
Out of Scope (These will not be considered): Do **NOT** raise issues regarding the website's UI or functionality. This codebase is a **MONO-REPO** and is hence independent of the web project; such issues will be closed without review.
34101

35102
![issues](https://github.com/user-attachments/assets/66934dc7-b137-4469-a8f5-6272a7681f38)
36103

37104
**PLEASE NOTE**:
38105

39-
(1) any issue with website's ui or functionality shouldn't be raised and as such any issues raised on that request will **NOT** be reviewed and closed as this codebase is independent from the one in which the website is going to be made in.
106+
This bot is currently self-hosted through my old laptop which doubles as a server rather than a third-party cloud-service provider which leads to uptime problems.
107+
108+
With hostel network dependencies, there is no way to resolve downtime-issues specially if I am not near the laptop which is hosting the bot.
40109

41-
(2) discord bot being inactive at some portions of the day, now the reason why I chose to clear this up right now is because **I AM NOT USING ANY THIRD-PARTY CLOUD SERVICE PROVIDER** for the continuous deployment and execution of the discord bot and am rather using my old laptop as a full-time server to run my programs 24/7 out of which this bot is one of them, once I return back to hostel there would be issues of running this bot particularly given how bad my hostel wifi is (since it frequently goes out) and as such if I'm not available when this occurs there is no way for me to fix it immediately.
110+
**Possible Solution**: While orchestration for backup service providers is a goal (using good MLOps principles), it has not yet been implemented.
42111

43-
there is a fix to the second issue by adopting good MLOps principles and orchestrating deployment of a backup service provider when one goes out, however at the time of writing this I'm not skilled enough to navigate through this and implement it.
112+
Please do **NOT** open issues regarding temporary bot inactivity. These are known infrastructure limitations, not code problems.
44113

45114
## Pipeline
46115

47-
The idea of execution-workflow will be greatly discussed in the second-version/iteration of this bot to ensure other open-source maintainers who might not be traditionally from an ML or a DS background can still maintain this codebase actively without much external help/assistance.
116+
The project follows a structured execution workflow designed for maintainability. Even without a massive background in Data Science, contributors can help updating the bot's by interacting with scripts:
117+
118+
### Data-Acquisition && Machine-Learning
119+
120+
**data_pipeline.py**: This scrapes official BITS-admission sites containing cutoff scores for particular years and converts raw data into standardized CSV files which can be then put in for model-training.
121+
122+
**helper_notebook.ipynb**: This contains code for the "model"—currently focused on min-max scaling applications so ... it is more of a statistical-validator than a traditional machine-learning model to process cutoff trends.
123+
124+
**predictions.py**: This bridges between data-science and ML aspect of this repository with the production-aspect. It takes the constraints (user inputs) and applies the model logic to generate results. Note: This script is currently volatile and subject to change as the model logic matures.
125+
126+
### Production
127+
128+
**main.py**: Contains actual code for the bitsatards-discord-bot. It handles events, commands, and integrates with the prediction and database services.
129+
130+
analytics.py: Handles data visualization for the bot's features.
131+
132+
### Databases
133+
134+
/services and /database concerns with the time-tracking feature which is a misc. feature of this bot using postgres as its database and SQLAlchemy as ORM. There is quite a bit of work to do here, but that will be halted till 3.0.0 release.
135+
136+
**init_db.py** helps initializing database on your system with necessary columns.
137+
138+
How to contribute to the flow:
139+
140+
If you are adding a feature, identify where it sits. For example:
141+
142+
A new way to view/formulate data -> analytics.py.
143+
144+
Model-Improvement -> helper_notebook.ipynb
145+
146+
Bot Command -> Modify main.py.
48147

49148
## Discussions
50149

0 commit comments

Comments
 (0)