Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update project, merge PRs #101

Merged
merged 5 commits into from
Apr 3, 2024
Merged
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
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
root = true

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

[*.py]
indent_size = 4

[Makefile]
indent_style = tab
indent_size = 4
78 changes: 78 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Test
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: '${{ matrix.os }}'
strategy:
matrix:
include:
- os: ubuntu-latest
python-version: '3.8'
FLASK: 3.0.2
- os: ubuntu-latest
python-version: '3.8'
FLASK: 2.3.3
- os: ubuntu-latest
python-version: '3.8'
FLASK: 2.2.5
- os: ubuntu-latest
python-version: '3.9'
FLASK: 3.0.2
- os: ubuntu-latest
python-version: '3.9'
FLASK: 2.3.3
- os: ubuntu-latest
python-version: '3.9'
FLASK: 2.2.5
- os: ubuntu-latest
python-version: '3.10'
FLASK: 3.0.2
- os: ubuntu-latest
python-version: '3.10'
FLASK: 2.3.3
- os: ubuntu-latest
python-version: '3.10'
FLASK: 2.2.5
- os: ubuntu-latest
python-version: '3.11'
FLASK: 3.0.2
- os: ubuntu-latest
python-version: '3.11'
FLASK: 2.3.3
- os: ubuntu-latest
python-version: '3.11'
FLASK: 2.2.5
- os: ubuntu-latest
python-version: '3.12'
FLASK: 3.0.2
- os: ubuntu-latest
python-version: '3.12'
FLASK: 2.3.3
- os: ubuntu-latest
python-version: '3.12'
FLASK: 2.2.5
steps:
- name: Install apt dependencies
run: |
set -ex
sudo apt update
sudo apt install -y ldap-utils slapd enchant-2 libldap2-dev libsasl2-dev apparmor-utils
- name: Disable AppArmor
run: sudo aa-disable /usr/sbin/slapd
- name: 'Set up Python ${{ matrix.python-version }}'
uses: actions/setup-python@v5
with:
python-version: '${{ matrix.python-version }}'
- uses: actions/checkout@v4
- run: pip install pytest Flask==$FLASK
env:
FLASK: '${{ matrix.FLASK }}'
- run: pip install -r requirements-dev.txt .
- run: pip install .
- run: pytest
34 changes: 20 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: mixed-line-ending
args: ['--fix=lf']
description: Forces to replace line ending by the UNIX 'lf' character.
- repo: https://github.com/psf/black
rev: 22.1.0
hooks:
- id: black
language_version: python3
args: [-t, py310]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: mixed-line-ending
args: ['--fix=lf']
description: Forces to replace line ending by the UNIX 'lf' character.
- repo: https://github.com/psf/black
rev: 24.3.0
hooks:
- id: black
language_version: python3
- repo: https://github.com/d-ryzhykau/pipenv-lock-pre-commit
rev: 0.5.0
hooks:
- id: pipenv-lock
- id: pipenv-verify
- id: pipenv-requirements
- id: pipenv-requirements-dev
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

8 changes: 0 additions & 8 deletions AUTHORS

This file was deleted.

47 changes: 12 additions & 35 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,47 +1,24 @@
.PHONY: help dev clean update test lint pre-commit

VENV_NAME?=venv
VENV_ACTIVATE=. $(VENV_NAME)/bin/activate
PYTHON=${VENV_NAME}/bin/python3
.PHONY: help dev test lint pre-commit

.DEFAULT: help
help:
@echo "make dev"
@echo " prepare development environment, use only once"
@echo "make clean"
@echo " delete development environment"
@echo "make update"
@echo " update dependencies"
@echo " prepare development environment"
@echo "make test"
@echo " run tests"
@echo " run tests"
@echo "make lint"
@echo " run black"
@echo " run black"
@echo "make pre-commit"
@echo " run pre-commit hooks"
@echo " run pre-commit hooks"

dev:
make venv

venv: $(VENV_NAME)/bin/activate
$(VENV_NAME)/bin/activate:
test -d $(VENV_NAME) || virtualenv -p python3 $(VENV_NAME)
${PYTHON} -m pip install -U pip
${PYTHON} -m pip install -r dev_requirements.txt
$(VENV_NAME)/bin/pre-commit install
touch $(VENV_NAME)/bin/activate

clean:
rm -rf venv

update:
${PYTHON} -m pip install -U -r dev_requirements.txt
$(VENV_NAME)/bin/pre-commit install
pipenv install --dev

test: venv
${PYTHON} -m pytest
test:
pipenv run pytest

lint: venv
$(VENV_NAME)/bin/black -t py310 --exclude $(VENV_NAME) .
lint:
pipenv run black .

pre-commit: venv
$(VENV_NAME)/bin/pre-commit
pre-commit:
pipenv run pre-commit
13 changes: 13 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
flask = "==3.0.2"
python-ldap = "==3.4.4"

[dev-packages]
black = "==24.3.0"
pre-commit = "==3.5.0"
pytest = "==8.1.1"
Loading