forked from element-hq/synapse-room-access-rules
-
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.
Use modern project layout and CI conf
- Loading branch information
Mathieu Velten
committed
Feb 5, 2024
1 parent
08e0191
commit 061441b
Showing
12 changed files
with
309 additions
and
185 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,41 @@ | ||
name: Tests | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
|
||
|
||
jobs: | ||
check-code-style: | ||
name: Check code style | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
- run: python -m pip install tox | ||
- run: tox -e check_codestyle | ||
|
||
# check-types: | ||
# name: Check types with Mypy | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - uses: actions/checkout@v4 | ||
# - uses: actions/setup-python@v4 | ||
# with: | ||
# python-version: "3.11" | ||
# - run: python -m pip install tox | ||
# - run: tox -e check_types | ||
|
||
unit-tests: | ||
name: Unit tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
- run: python -m pip install tox | ||
- run: tox -e py |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -12,3 +12,4 @@ _trial_temp/ | |
/build/ | ||
/dist/ | ||
/*.egg-info/ | ||
/.venv/ |
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,83 @@ | ||
[project] | ||
name = "room_access_rules" | ||
description = "Custom room access rules for Tchap." | ||
readme = "README.md" | ||
dynamic = ["version"] | ||
|
||
requires-python = ">=3.8" | ||
|
||
classifiers = [ | ||
"License :: OSI Approved :: Apache Software License" | ||
] | ||
|
||
dependencies = [ | ||
"attrs" | ||
] | ||
|
||
[project.optional-dependencies] | ||
dev = [ | ||
# for tests | ||
"pydantic >= 1.7.4, < 2.0", | ||
"matrix-synapse == 1.98.0", | ||
"tox", | ||
"twisted", | ||
"aiounittest", | ||
# for type checking | ||
"mypy == 1.6.1", | ||
# for linting | ||
"black == 23.10.0", | ||
"ruff == 0.1.1", | ||
] | ||
|
||
[project.urls] | ||
repository = "https://github.com/tchapgouv/synapse-room-access-rules" | ||
|
||
[build-system] | ||
requires = ["setuptools", "setuptools_scm", "wheel"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.setuptools_scm] | ||
|
||
[tool.mypy] | ||
strict = true | ||
|
||
[tool.ruff] | ||
line-length = 88 | ||
|
||
# See https://docs.astral.sh/ruff/rules/#error-e | ||
# for error codes. The ones we ignore are: | ||
# E501: Line too long (black enforces this for us) | ||
# E731: do not assign a lambda expression, use a def | ||
# | ||
# flake8-bugbear compatible checks. Its error codes are described at | ||
# https://docs.astral.sh/ruff/rules/#flake8-bugbear-b | ||
# B023: Functions defined inside a loop must not use variables redefined in the loop | ||
ignore = [ | ||
"B023", | ||
"E501", | ||
"E731", | ||
] | ||
select = [ | ||
# pycodestyle | ||
"E", | ||
"W", | ||
# pyflakes | ||
"F", | ||
# flake8-bugbear | ||
"B0", | ||
# flake8-comprehensions | ||
"C4", | ||
# flake8-2020 | ||
"YTT", | ||
# flake8-slots | ||
"SLOT", | ||
# flake8-debugger | ||
"T10", | ||
# flake8-pie | ||
"PIE", | ||
# flake8-executable | ||
"EXE", | ||
# isort | ||
"I", | ||
] | ||
|
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
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,19 @@ | ||
#!/usr/bin/env bash | ||
# Runs linting scripts and type checking | ||
# black - opinionated code formatter | ||
# ruff - lints, finds mistakes, and sorts import statements | ||
# mypy - checks type annotations | ||
|
||
set -e | ||
|
||
files=( | ||
"room_access_rules" | ||
"tests" | ||
) | ||
|
||
# Print out the commands being run | ||
set -x | ||
|
||
black "${files[@]}" | ||
ruff --fix "${files[@]}" | ||
mypy "${files[@]}" |
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
Oops, something went wrong.