-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c1c5aa1
Showing
10 changed files
with
256 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
.PHONY: prerequisites install dev test purge-db purge | ||
|
||
# This Makefile should provide you with a simple way to get your dev | ||
# environment up and running. It will install all the dependencies | ||
# needed to run the project, and then run the project. | ||
|
||
prerequisites: | ||
# Make sure to have micromamba installed - a fast conda/mamba implementation with very low overhead. | ||
# This will allow you to create a new environment with all the dependencies needed for this project. | ||
# Conda environments also contain dedicated python interpreters that won't mess up your local python installation." | ||
|
||
install: | ||
pre-commit install | ||
micromamba create -f environment.yml # Create a new environment | ||
# execute the following two steps manually | ||
# micromamba activate parma-mining-github # Activate the new environment | ||
# pip install -e . # Install the project in editable mode | ||
|
||
dev: | ||
uvicorn parma_mining.github.api:app --reload | ||
|
||
test: | ||
pytest tests/ | ||
|
||
purge-db: | ||
# TODO | ||
|
||
purge: purge-db | ||
rm -rf .mypy_cache .pytest_cache .coverage .eggs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
# parma-mining-github | ||
|
||
[![Chore](https://github.com/la-famiglia-jst2324/parma-mining-github/actions/workflows/chore.yml/badge.svg?branch=main)](https://github.com/la-famiglia-jst2324/parma-mining-github/actions/workflows/chore.yml) | ||
[![CI](https://github.com/la-famiglia-jst2324/parma-mining-github/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/la-famiglia-jst2324/parma-mining-github/actions/workflows/ci.yml) | ||
[![Deploy](https://github.com/la-famiglia-jst2324/parma-mining-github/actions/workflows/release.yml/badge.svg)](https://github.com/la-famiglia-jst2324/parma-mining-github/actions/workflows/release.yml) | ||
[![Major Tag](https://github.com/la-famiglia-jst2324/parma-mining-github/actions/workflows/tag-major.yml/badge.svg)](https://github.com/la-famiglia-jst2324/parma-mining-github/actions/workflows/tag-major.yml) | ||
|
||
ParmaAI mining module for the github CRM. | ||
|
||
## Getting Started | ||
|
||
The following steps will get you started with the project. | ||
|
||
1. Pre-requisites: to be able to contribute to JST in this repository, make sure to comply with the following prerequisites. | ||
|
||
- Configure GitHub via an ssh key. Key based authenticated is highly encouraged. See [GitHub Docs](https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh) for more information. | ||
- Please make sure to have an GPG key configured for GitHub. See [GitHub Docs](https://docs.github.com/en/authentication/managing-commit-signature-verification/adding-a-gpg-key-to-your-github-account) for more information. | ||
- Install **micromamba**, a conda environment management package manager, as described [here](https://mamba.readthedocs.io/en/latest/micromamba-installation.html). Alternatively conda or mamba installations should also work, but are highly discouraged because of their slow performance. | ||
|
||
2. **Clone the repository** | ||
|
||
```bash | ||
git@github.com:la-famiglia-jst2324/parma-mining-github.git | ||
``` | ||
|
||
3. **Precommit & environment setup**: | ||
|
||
```bash | ||
make install # execute the last 2 steps manually! | ||
``` | ||
|
||
4. **Start the api server**: | ||
|
||
```bash | ||
make dev | ||
``` | ||
|
||
**Open [http://localhost:8000](http://localhost:8000) with your browser to see the result.** | ||
|
||
FastApi will provide you with an interactive documentation of the api. You can also use the swagger ui at [http://localhost:8000/docs](http://localhost:8000/docs) or the redoc ui at [http://localhost:8000/redoc](http://localhost:8000/redoc). | ||
|
||
5. Optional: Running the pre-commit pipeline manually | ||
|
||
```bash | ||
pre-commit run --all | ||
``` | ||
|
||
6. Test your code: | ||
|
||
```bash | ||
make test | ||
``` | ||
|
||
## PR workflow | ||
|
||
1. **Create a new branch** | ||
[linear.app](linear.app) offers a button to copy branch names from tickets. | ||
In case there is no ticket, please use feel free to use an arbitrary name or create a ticket. | ||
GitHub CI doesn't care about the branch name, only the PR title matters. | ||
```bash | ||
# format: e.g. robinholzingr/meta-1-create-archtecture-drafts-diagrams-list-of-key-priorities | ||
git checkout -b <branch-name> | ||
``` | ||
2. Open a PR and use a [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/) PR title. | ||
3. Wait for CI pipeline to pass and if you are happy with your changes request a review. | ||
4. Merge the PR (using the "Squash and merge" option) and delete the branch. | ||
Pay attention to include co-authors if anyone else contributed to the PR. | ||
5. If you want to release a new version to production, create a new release on GitHub. | ||
The release version will be automatically derived from the PR titles | ||
(breaking changes yield new major versions, new features yield new minor versions). | ||
### Directory structure | ||
```bash | ||
. | ||
├── parma_mining.github: Main sourcing code | ||
│ └── api: FastAPI REST API | ||
├─ tests: Tests for mining module | ||
├── Makefile: Recipes for easy simplified setup and local development | ||
├── README.md | ||
├── docker-compose.yml: Docker compose file for local database | ||
├── environment.yml: conda environment file | ||
└── pyproject.toml: Python project configuration file | ||
``` | ||
## Tech Stack | ||
Core libraries that this project uses: | ||
- [FastAPI](https://fastapi.tiangolo.com/): FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints. | ||
- [Pydantic](https://pydantic-docs.helpmanual.io/): Data validation and settings management using python type annotations. | ||
- [Typer](https://typer.tiangolo.com/): Typer is a library for building CLI applications that users will love using and developers will love creating. | ||
- [Polars](https://pola.rs): Polars is a blazingly fast data processing library written in Rust. It has a DataFrame API that is similar to Pandas and a Series API that is similar to NumPy. | ||
- [Pytest](https://docs.pytest.org/en/6.2.x/): The pytest framework makes it easy to write small tests, yet scales to support complex functional testing for applications and libraries. | ||
## Deployment | ||
No deployment pipeline has been set up yet. | ||
Currently we are considering several backend frameworks like `Firebase`, `Supabase` or `AWS Amplify`. | ||
## Disclaimer | ||
In case there are any issues with the initial setup or important architectural decisions/integrations missing, please contact the meta team or @robinholzi directly. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# version: "3.9" | ||
# services: | ||
# parma-mining-db: | ||
# TODO: add a mongo.db instance if needed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: parma-mining-github | ||
channels: | ||
- conda-forge | ||
- nodefaults | ||
dependencies: | ||
# Git | ||
- pre-commit | ||
# Python | ||
- pip | ||
- python =3.11 | ||
- setuptools-scm | ||
- setuptools >=61 # pyproject.toml support | ||
# Development | ||
- types-pyyaml | ||
# Testing | ||
- pytest >=6 # --import-mode option | ||
- pytest-cov | ||
# Dependencies (core) | ||
- fastapi >=0.104.0 | ||
- polars >=0.19.0 | ||
- pydantic >=2 | ||
- pyyaml | ||
- typer >=0.9.0 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
"""github data sourcing package.""" | ||
|
||
import importlib.metadata | ||
|
||
try: | ||
__version__ = importlib.metadata.version(__name__) | ||
except Exception: | ||
__version__ = "unknown" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from .main import app # noqa | ||
|
||
__all__ = ["app"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
"""Main entrypoint for the API routes in of parma-analytics.""" | ||
|
||
from fastapi import FastAPI | ||
|
||
app = FastAPI() | ||
|
||
|
||
# root endpoint | ||
@app.get("/", status_code=200) | ||
def root(): | ||
"""Root endpoint for the API.""" | ||
return {"welcome": "at parma-mining-github"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
[build-system] | ||
requires = ["setuptools", "setuptools-scm", "wheel"] | ||
|
||
[tool.setuptools_scm] | ||
version_scheme = "post-release" | ||
|
||
[project] | ||
name = "parma-mining-github" | ||
description = "" | ||
readme = "README.md" | ||
dynamic = ["version"] | ||
authors = [ | ||
{name = "Robin Holzinger", email = "robin.holzinger@tum.de"}, | ||
] | ||
classifiers = [ | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.11", | ||
] | ||
requires-python = ">=3.11" | ||
|
||
[project.urls] | ||
repository = "https://github.com/la-famiglia-jst2324/parma-mining-github" | ||
|
||
[tool.setuptools.packages.find] | ||
include = ["parma_mining.*"] | ||
namespaces = false | ||
|
||
[project.scripts] | ||
|
||
[tool.black] | ||
exclude = ''' | ||
/( | ||
\.eggs | ||
| \.git | ||
| \.venv | ||
| build | ||
| dist | ||
)/ | ||
''' | ||
|
||
[tool.ruff] | ||
line-length = 88 | ||
select = ["F", "E", "W", "I", "N", "UP", "D", "PL"] | ||
target-version = "py311" | ||
|
||
[tool.mypy] | ||
python_version = '3.11' | ||
ignore_missing_imports = true | ||
no_implicit_optional = true | ||
check_untyped_defs = true | ||
|
||
[tool.ruff.pydocstyle] | ||
convention = "google" | ||
|
||
[tool.docformatter] | ||
black = true | ||
|
||
[tool.pytest.ini_options] | ||
addopts = "--import-mode=importlib --cov='parma_mining' --cov-report xml --color=yes" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import pytest | ||
|
||
from parma_mining.github import __version__ | ||
|
||
|
||
@pytest.mark.parametrize("arg", [True, False]) | ||
def test_dummy(arg: bool): | ||
assert arg or not arg | ||
assert len(__version__) > 0 |