Skip to content
Open
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
30 changes: 30 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: 2.1

jobs:
test:
docker:
- image: cimg/python:3.12
steps:
- checkout
- run:
name: Install uv
command: |
curl -sSL https://install.uv.tools | bash
- run:
name: Install dependencies
command: uv init # Installs dependencies from pyproject.toml
- run:
name: Run pytest tests
command: pytest tests
- run:
name: Run ruff for linting
command: ruff check .
- run:
name: Run mypy for type checking
command: mypy .

workflows:
version: 2
test_and_static_analysis:
jobs:
- test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ dmypy.json
# Cython debug symbols
cython_debug/

# Mac metadata file
.DS_Store

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
117 changes: 116 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,116 @@
# mAIgic-nyu
# mAIgic

## Project Description
**mAIgic** is an AI-powered assistant designed to enhance productivity and organization by tracking messages and important information across multiple platforms. It identifies and reminds users about follow-ups, ensuring timely responses and efficient information management. With intelligent search capabilities, mAIgic enables users to easily locate conversations and details tied to specific individuals or tasks.

The project supports popular platforms such as Slack, Trello, and Gmail, providing seamless follow-up tracking, reminders, and contextual search across these communication channels. This integration leverages AI to automate the reminder process, making it easier to stay on top of essential follow-ups and tasks.

## Features
- Unit testing with `pytest`
- Static code analysis with `ruff` (linter)
- Type checking with `mypy`
- Continuous Integration (CI) pipeline with CircleCI, running both tests and static analysis automatically on every push.

---

## Setup Instructions

### 1. Clone the Repository
```bash
git clone https://github.com/your-username/mAIgic.git
cd mAIgic
```

### 2. Install Dependencies
```bash
pip install -r requirements.txt
```

Alternatively, if using the `uv` package manager:
```bash
uv sync
```

The above command will create a virtual environment `.venv` and install all the dependencies from the `uv.lock` file. Activate the environment by executing
```bash
source .venv/bin/activate
```

---

## Running Tests

### 1. Pytest
You can run unit tests using `pytest` by running the following command:
```bash
pytest tests
```

**Example Tests in `tests/test_samples.py`:**
- Basic arithmetic (addition, subtraction, multiplication, division)
- String operations (case-insensitive checks)
- List and dictionary operations
- Exception handling tests (checking for specific exceptions)

### 2. Ruff (Linter)
Use `ruff` to run static analysis (linting) on your code:
```bash
ruff check .

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what checks are enabled?
can we make sure all checks are enabled?
discuss which checks you need to disable because they did not make sense.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

select = ["E", "F", "W"]:
This is selecting the following categories of checks:
E: PEP 8 style errors (e.g., indentation, whitespace issues)
F: PyFlakes checks (e.g., undefined names, unused variables)
W: PEP 8 style warnings (e.g., line breaks around operators)

Do you want us to enable all the checks?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you enable all the checks and then tell me which ones are too pesky and you felt like you wanted to disable?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have enabled all the checks.

```

### 3. Mypy (Type Checking)
To perform static type checking using `mypy`, run:
```bash
mypy .

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what checks are enabled?
can we make sure all checks are enabled?
discuss which checks you need to disable because they did not make sense.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In our mypy.ini, these following checks are enabled:

python_version = 3.8: This specifies that mypy will assume your project is using Python 3.8. Any type hints or language features not supported by Python 3.8 will raise an error.

ignore_missing_imports = True: This setting tells mypy to ignore any missing type stubs (type information) for third-party libraries that do not have type hints. This prevents mypy from raising errors about missing types in libraries that aren’t type-annotated.

do you want us to include any specific checks?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would lean towards enabling all available checks and then disabling ones that don't make sense.
let's also do latest version of python..,.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have made made the changes to python version and have changed to enable all the checks

```

---

## CircleCI Configuration

The project is integrated with CircleCI for continuous integration. Every push to the repository automatically triggers the following steps:
1. **Install dependencies**: Installs `pytest`, `ruff`, and `mypy`.
2. **Run tests**: Executes all tests in the `tests/` folder using `pytest`.
3. **Run static analysis**: Runs `ruff` for linting and `mypy` for type checking.



### View CircleCI Status:
The latest CircleCI build can be viewed [here](https://app.circleci.com/pipelines/circleci/L7kpZ5X2tZyEgUBhR4SB2j/NxWta8V9bEwRzTNu9Vzc3c/9/workflows/be567b6f-0c9c-41c8-91f7-e4789784b41f).

---

## Troubleshooting

### Common Errors:
1. **Missing Dependencies**: If any dependency-related issues arise, ensure all dependencies are installed by running:
```bash
pip install -r requirements.txt

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is better!
why mention the packages up there literally?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove the mention of packages from there

```
or
```bash
uv init
```


## License
This project is licensed under the MIT License.


### Explanation of the Sections:

1. **Project Description**: Provides an overview of what the project does.
2. **Features**: Highlights the major tools and features used.
3. **Setup Instructions**: Guides users on how to clone the repo, install dependencies, and initialize the project.
4. **Running Tests**: Explains how to run unit tests, static analysis, and type checks.
5. **CircleCI Configuration**: Outlines how CircleCI automates the process of testing and analysis, including the YAML configuration.
6. **Troubleshooting**: Offers solutions for common errors like string comparison and missing dependencies.
7. **License**: A placeholder for your project's license type.

## Teammates
- Siddharth Singh - sms10221@nyu.edu
- Adittya Mittal - am14079@nyu.edu
- Anushka Tawte - at5849@nyu.edu
- Rafael de Leon - rdl404@nyu.edu
- Alex Ying - aty2009@nyu.edu
- Mridul Mittal - mm13171@nyu.edu
3 changes: 3 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[mypy]
python_version = 3.12
ignore_missing_imports = True
15 changes: 15 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[project]
name = "mAIgic"
version = "0.1.0"
description = "An AI-powered assistant designed to enhance productivity and organization by tracking messages and important information across multiple platforms"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"pytest",
"ruff",
"mypy"
]

[tool.ruff.lint]
select = ["ALL"]
extend-ignore = ["S101", "D211", "D213"]
Binary file added requirements.txt
Binary file not shown.
5 changes: 5 additions & 0 deletions src/hello.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def main() -> None:
print("Hello from maigic!")

if __name__ == "__main__":
main()
1 change: 1 addition & 0 deletions src/maigic_nyu/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Make maigic_nyu directory a referenceable package."""
16 changes: 16 additions & 0 deletions src/maigic_nyu/_temp_math.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""Placeholder API file to test imports."""

def add(num1:int, num2:int) -> int:
return num1 + num2

def subtract(num1:int, num2:int) -> int:
return num1 - num2

def multiply(num1:int, num2:int) -> int:
return num1 * num2

def divide(num1:int, num2:int) -> float:
return num1 / num2

def modulo(num1:int, num2:int) -> int:
return num1 % num2
7 changes: 7 additions & 0 deletions src/maigic_nyu/api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from ._temp_math import (
add as add,
divide as divide,
modulo as modulo,
multiply as multiply,
subtract as subtract,
)
1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Make tests directory as a referenceable package."""
22 changes: 22 additions & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from src.maigic_nyu.api import (
add as add,
divide as divide,
modulo as modulo,
multiply as multiply,
subtract as subtract,
)

def test_api_add() -> None:
assert add(7, 2) == 9

def test_api_subtract() -> None:
assert subtract(7, 2) == 5

def test_api_multiply() -> None:
assert multiply(7, 2) == 14

def test_api_divide() -> None:
assert divide(7, 2) == 3.5

def test_api_modulo() -> None:
assert modulo(7, 2) == 1
31 changes: 31 additions & 0 deletions tests/test_samples.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import pytest


def test_addition() -> None:
assert 2 + 2 == 4

def test_subtraction() -> None:
assert 5 - 3 == 2

def test_multiplication() -> None:
assert 3 * 3 == 9

def test_division() -> None:
assert 8 / 2 == 4

def test_string_equality() -> None:
assert "hello".upper() == "HELLO"

def test_list_append() -> None:
lst = [1, 2, 3]
lst.append(4)
assert lst == [1, 2, 3, 4]

def test_dictionary_key() -> None:
d = {"name": "Alice", "age": 30}
assert "name" in d
assert d["name"] == "Alice"

def test_raise_error() -> None:
with pytest.raises(ZeroDivisionError):
1 / 0
Loading