Skip to content

Commit

Permalink
chore: setup configuration yamls and index docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Septimus4 committed Oct 22, 2024
1 parent 4312be1 commit 4380a23
Show file tree
Hide file tree
Showing 11 changed files with 1,217 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
repos:
- repo: https://github.com/psf/black
rev: 21.9b0
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
21 changes: 21 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!--
Thank you for your pull request! Please provide a description of your changes below and review the checklist.
Bug fixes and new features should include tests and documentation updates.
Refer to the [Contribution Guidelines](CONTRIBUTING.md) for more details.
-->

## Checklist

- [ ] `poetry run pytest` passes locally with my changes
- [ ] Tests have been added or updated to cover the changes
- [ ] Documentation has been updated as needed
- [ ] Code style checks pass (`poetry run flake8` and `poetry run black --check .`)
- [ ] Commit messages follow the [Conventional Commits](https://www.conventionalcommits.org/) guidelines

## Affected Components

## Description of Changes

## Additional Notes
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# .github/workflows/ci.yml
name: CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
python-version: [3.12]

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
export PATH="$HOME/.local/bin:$PATH"
- name: Install dependencies
run: |
poetry install --no-interaction --no-ansi
- name: Run linters
run: |
poetry run flake8 concord/
poetry run black --check concord/
- name: Run tests
run: |
poetry run pytest --cov=concord tests/
84 changes: 84 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL Advanced"

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '33 8 * * 2'

jobs:
analyze:
name: Analyze (${{ matrix.language }})
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
permissions:
# required for all workflows
security-events: write

# required to fetch internal or private CodeQL packs
packages: read

# only required for workflows in private repositories
actions: read
contents: read

strategy:
fail-fast: false
matrix:
include:
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- if: matrix.build-mode == 'manual'
shell: bash
run: |
# TODO setup build command
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
150 changes: 150 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
# Contribution Guidelines

Thank you for your interest in contributing to our Python open-source project! To ensure a smooth collaboration and maintain code quality, please follow the guidelines below.

## Table of Contents

- [Code Style](#code-style)
- [Object-Oriented Design](#object-oriented-design)
- [Don't Repeat Yourself (DRY)](#dont-repeat-yourself-dry)
- [Testing](#testing)
- [Continuous Integration and Testing](#continuous-integration-and-testing)
- [Linting and Formatting](#linting-and-formatting)
- [Commit Messages](#commit-messages)
- [Pull Request Process](#pull-request-process)
- [Additional Recommendations](#additional-recommendations)

## Code Style

- **PEP 8 Compliance**: Ensure your code adheres to the [PEP 8](https://www.python.org/dev/peps/pep-0008/) style guide.
- **Consistent Naming**: Use clear and descriptive names for variables, functions, and classes.
- **Line Length**: Limit all lines to a maximum of 79 characters.
- **Comments and Docstrings**: Provide docstrings for modules, classes, and functions. Use comments to explain complex logic.

## Object-Oriented Design

- **Encapsulation**: Use classes and objects to encapsulate data and functionality.
- **Inheritance and Polymorphism**: Utilize inheritance to promote code reuse and polymorphism for flexibility.
- **Modularity**: Break down large modules into smaller, manageable classes or functions.

## Don't Repeat Yourself (DRY)

- **Code Reusability**: Avoid code duplication by reusing functions or classes.
- **Abstraction**: Abstract common functionality into utility functions or base classes.
- **Refactoring**: If you notice repeated code, consider refactoring it into a shared component.

## Testing

- **Unit Tests**: Write unit tests for new features and bug fixes using `pytest`.
- **Coverage**: Aim for at least **80% test coverage**.
- **Running Tests**:

```bash
poetry run pytest --cov=concord tests/
```

- **Test Cases**: Include edge cases and validate expected exceptions.

## Continuous Integration and Testing

We use **GitHub Actions** to automatically run tests and linters on all pull requests and commits to the `main` branch. To ensure your contributions pass these checks, please follow the instructions below.

### Prerequisites

- Python 3.12 or higher.
- **Poetry** installed for dependency management.

### Installing Dependencies

1. **Install Poetry**:

```bash
# For Unix/macOS
curl -sSL https://install.python-poetry.org | python3 -
```

For other installation methods, refer to the [Poetry documentation](https://python-poetry.org/docs/#installation).

2. **Install Project Dependencies**:

Navigate to the project directory and run:

```bash
poetry install
```

This will create a virtual environment and install all required packages, including development dependencies.

3. **Activate the Virtual Environment** (Optional):

```bash
poetry shell
```

Alternatively, you can prefix commands with `poetry run` without activating the shell.

## Linting and Formatting

- **Linters**: Use linters to enforce coding standards.

- **Flake8**: For code style and quality checks.

```bash
poetry run flake8 concord/
```

- **Black**: For automatic code formatting.

```bash
poetry run black concord/
```

- **Pre-Commit Hooks**: Set up pre-commit hooks to automate linting and testing before each commit.

1. **Install Pre-Commit Hooks**:

```bash
poetry run pre-commit install
```

2. **Run Pre-Commit on All Files** (Optional):

```bash
poetry run pre-commit run --all-files
```

## Commit Messages

- **Format**: Use clear and descriptive commit messages.

- Start with a short summary (50 characters max).
- Follow with a blank line and a detailed description if necessary.

- **Conventional Commits**: Follow the [Conventional Commits](https://www.conventionalcommits.org/) specification for consistency.

## Pull Request Process

1. **Open a Pull Request**:

- Fork the repository and create your feature branch.
- Go to the original repository on GitHub.
- Click on "New Pull Request" and select your fork and branch.
- Provide a descriptive title and detailed description of your changes.

2. **Address Feedback**:

- Be responsive to code review comments.
- Make necessary changes and push them to your branch.

## Additional Recommendations

- **Issue Tracking**: Reference any related issues in your pull request description.
- **Documentation**: Update the project's documentation to reflect your changes.
- **Dependencies**: Avoid introducing new dependencies unless absolutely necessary.
- **Security**: Be mindful of security implications in your code.
---
By adhering to these guidelines, you help maintain the project's quality and ensure a seamless collaboration experience. If you have any questions, feel free to reach out to the maintainers.

Thank you for your contributions!
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 4380a23

Please sign in to comment.