Skip to content

Commit

Permalink
fix: hw1 feedback fix
Browse files Browse the repository at this point in the history
- Upgrade python from 3.11 to 3.12
- Use uv to transform the project from app to a library, exposing api only via modules (modules named with "_" to discourage direct use and import)
- Add mypy for static type checking
- Add pytest-cov for test coverage and reporting
- Add circleCI tests and coverage report
- Untracked artifact files
- The project is capable of being built with build-tools (maigic uses hatchling) and probably being published to PyPi
  • Loading branch information
Nightshade14 committed Nov 10, 2024
1 parent 615e65e commit 40838dd
Show file tree
Hide file tree
Showing 20 changed files with 255 additions and 414 deletions.
30 changes: 23 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2.1
executors:
my-docker-executor:
docker:
- image: cimg/python:3.11.10
- image: cimg/python:3.12

jobs:
build:
Expand All @@ -19,7 +19,7 @@ jobs:
- persist_to_workspace:
root: /home/circleci/
paths:
- .cargo
- .local

test:
executor: my-docker-executor
Expand All @@ -31,19 +31,35 @@ jobs:

- run:
name: Set-up dependencies path
command: echo 'export PATH=$HOME/.cargo/bin:$PATH' >> $BASH_ENV
command: echo 'export PATH=$HOME/.local/bin:$PATH' >> $BASH_ENV

- run:
name: Set-up project dependencies
command: uv sync

- run:
name: Format python files with ruff
command: uv run ruff check . --fix
name: Create test results directory
command: mkdir -p test-results

- run:
name: Run test files
command: uv run pytest
name: Static Type Checking with mypy
command: uv run mypy .

- run:
name: Linting checks with Ruff
# ignore = ["S101", "D203", "D213", "COM812", "ISC001"]
command: uv run ruff check .

- run:
name: Run unit tests with coverage
command: uv run pytest tests/ --junitxml=test-results/coverage.xml

- store_test_results:
path: test-results

- store_artifacts:
path: test-results/coverage.xml
destination: coverage-report

workflows:
build_and_test:
Expand Down
173 changes: 172 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,172 @@
**/**cache**/**
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

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

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# 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
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

**/**cache**

**/.python-version

**/uv.lock

**/py.typed

**/**.xml
1 change: 0 additions & 1 deletion .python-version

This file was deleted.

12 changes: 11 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
MIT License

Copyright (c) 2024 Satyam Chatrola
Copyright (c) 2024 NYU-OSS
Contributors:

- Kamen Yotov
- Satyam Chatrola
- Frank Zhao
- Sidhved Warik
- Yaxin Ke
- Eli Edme
- Abdullah Suri
- Mihir Lovekar

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
15 changes: 0 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,6 @@ Note: One can run tools like ruff and pytest independently or can run them throu

Note: Request to keep all `communication` in the Google Chats Project Group.

## Trello Setup

- Create a Trello account.
- Go to https://trello.com/power-ups/admin to create a new Power-up.
- Check the new power-up, click `API key` on the left side panel.
- Copy the API key and visit https://trello.com/1/authorize?expiration=1day&name=yourAppName&scope=read,write&response_type=token&key=your_api_key, replace `your_api_key` with your own api key. The expiration and the name can be changed if needed.
- Create a .env file, input your API key and token:

```
TRELLO_API_KEY=your_api_key
TRELLO_OAUTH_TOKEN=your_token
```

- Run TrelloManager.py and you will see the test result.

# License

mAIgic has a MIT-style license, as found in the [LICENSE](LICENSE) file.
Binary file removed SlackChatbot/.DS_Store
Binary file not shown.
3 changes: 0 additions & 3 deletions SlackChatbot/ClientID_Secret.env

This file was deleted.

3 changes: 0 additions & 3 deletions SlackChatbot/Commands

This file was deleted.

35 changes: 0 additions & 35 deletions SlackChatbot/slack_bot.py

This file was deleted.

21 changes: 0 additions & 21 deletions SlackChatbot/slack_events.py

This file was deleted.

48 changes: 0 additions & 48 deletions SlackChatbot/slack_oauth.py

This file was deleted.

Loading

0 comments on commit 40838dd

Please sign in to comment.