Skip to content

Commit

Permalink
Init project
Browse files Browse the repository at this point in the history
Co-authored-by: Shirokov Sergey <sergey.shirokov@saritasa.com>
Co-authored-by: Leonid Malin <leonid.malin@saritasa.com>
Co-authored-by: Nikita Azanov <nikita.azanov@saritasa.com>
Co-authored-by: Roman Gorbil <roman.gorbil@saritasa.com>
  • Loading branch information
5 people committed Mar 15, 2024
1 parent b36bf35 commit 1a86cc7
Show file tree
Hide file tree
Showing 29 changed files with 3,314 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Check http://editorconfig.org for more information
# This is the main config file for this project:
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
trim_trailing_whitespace = true

[*.py]
indent_size = 4

[*.txt]
indent_style = tab
indent_size = 4

[*.{diff,md}]
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* stanislav.khlud@saritasa.com sergey.shirokov@saritasa.com leonid.malin@saritasa.com
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
time: "00:00"
open-pull-requests-limit: 10

- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
time: "00:00"
open-pull-requests-limit: 10
52 changes: 52 additions & 0 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CR

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
cr:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12"]
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-${{ matrix.python-version }}-${{ hashFiles('**/.pre-commit-config.yaml') }}
restore-keys: |
${{ runner.os }}-pre-commit-
- name: Cache poetry dependencies
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: ${{ runner.os }}-poetry-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
# Install dependencies if cache does not exist
- name: Install local dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --all-extras
- name: Run checks
run: |
poetry run inv pre-commit.run-hooks
162 changes: 162 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
### https://github.com/github/gitignore/blob/main/Python.gitignore
### VisualStudioCode template
.vscode/*
!.vscode/recommended_settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace

# Local History for Visual Studio Code
.history/

### Python template
# 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/
pytest.xml

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Local settings
local.py
# Media folder
media/

# 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

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

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.venv
config/settings/.env
config/settings/.env.tmp
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/

# Ignore idea folder
.idea

# Ignore tmp folder
.tmp/

# sql files
*.sql

# Local invoke config
.invoke

# pyenv's file for specifying local Python version
.python-version
53 changes: 53 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-yaml
- id: check-toml
- id: check-json
exclude: ".*\\.vscode/"
- id: end-of-file-fixer
- id: trailing-whitespace
- id: detect-aws-credentials
args: [--allow-missing-credentials]
- id: debug-statements
- id: check-merge-conflict
- id: detect-private-key

- repo: https://github.com/python-poetry/poetry
rev: 1.8.0
hooks:
- id: poetry-check
args: ["--lock"]

- repo: https://github.com/asottile/add-trailing-comma
rev: v3.1.0
hooks:
- id: add-trailing-comma

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.2
hooks:
- id: ruff
args: [ --fix ]
- id: ruff-format

- repo: https://github.com/pycqa/docformatter
rev: v1.7.5
hooks:
- id: docformatter
args: [
--wrap-descriptions=0,
--in-place,
--blank
]

- repo: local
hooks:
- id: mypy
name: Run mypy
entry: inv mypy.run
language: system
pass_filenames: false
types: [ file ]
stages: [ push ]
23 changes: 23 additions & 0 deletions .vscode/recommended_settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"files.exclude": {
"**/__pycache__": true,
"**/.mypy_cache": true
},

"editor.rulers": [79],

"editor.bracketPairColorization.enabled": true,

"python.analysis.typeCheckingMode": "basic",

"python.analysis.inlayHints.functionReturnTypes": true,
"mypy.enabled": false,

"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,

"[python]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "charliermarsh.ruff"
}
}
54 changes: 54 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# How to contribute

## Dependencies

We use [poetry](https://github.com/python-poetry/poetry) to manage the dependencies.

To install them you would need to run `install` command:

```bash
poetry install
```

To activate your `virtualenv` run `poetry shell`.

## Style checks

We use `pre-commit` for quality control.

To run checks:

```bash
inv pre-commit.run-hooks
```

Note: we also have flake8 dependencies for proper support of flake8 vscode
plugin.

## Submitting your code

We use [trunk based](https://trunkbaseddevelopment.com/) development.

What the point of this method?

1. We use protected `main` branch,
so the only way to push your code is via pull request
2. We use issue branches: to implement a new feature or to fix a bug
create a new branch named `issue-$TASKNUMBER`
3. Then create a pull request to `main` branch
4. We use `git tag`s to make releases, so we can track what has changed
since the latest release

So, this way we achieve an easy and scalable development process
which frees us from merging hell and long-living branches.

In this method, the latest version of the app is always in the `main` branch.

### Before submitting

Before submitting your code please do the following steps:

1. Add any changes you want
2. Edit documentation if you have changed something significant
3. Update `CHANGELOG.md` with a quick summary of your changes
4. Run `pre-commit` to ensure that style is correct
Loading

0 comments on commit 1a86cc7

Please sign in to comment.