Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bogdan Radko committed Jun 10, 2024
0 parents commit 5bd25da
Show file tree
Hide file tree
Showing 40 changed files with 1,972 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .bumpversion.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[tool.bumpversion]
current_version = "0.0.0"
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
serialize = ["{major}.{minor}.{patch}"]
search = "{current_version}"
replace = "{new_version}"
regex = false
ignore_missing_version = false
ignore_missing_files = false
tag = true
sign_tags = false
tag_name = "v{new_version}"
tag_message = "Bump version: {current_version} → {new_version}"
allow_dirty = false
commit = true
message = "Bump version: {current_version} → {new_version}"
commit_args = ""
[[tool.bumpversion.files ]]
filename = "./django_kafka/__init__.py"
89 changes: 89 additions & 0 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Test

on:
- push
- pull_request

jobs:
test:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version:
- "3.11"
- "3.12"
django:
- "4.0"
- "4.1"
- "4.2"
- "5.0"
exclude:
- python-version: "3.11"
django: "4.0"
- python-version: "3.12"
django: "4.0"
- python-version: "3.12"
django: "4.1"

steps:
- uses: actions/checkout@v4

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

- name: Update pip
run: python -m pip install --upgrade pip

- name: Install Django 3.2
if: matrix.django == 3.2
run: pip install "Django>=3.2"

- name: Install Django 4.0
if: matrix.django == 4.0
run: pip install "Django>=4.0"

- name: Install Django 4.1
if: matrix.django == 4.1
run: pip install "Django>=4.1"

- name: Install Django 4.2
if: matrix.django == 4.2
run: pip install "Django>=4.2"

- name: Install Django 5.0
if: matrix.django == 5.0
run: pip install "Django>=5.0"

- name: Install package
run: pip install -e .

- name: Run tests
run: python ./example/manage.py test

publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Install req packages
run: python -m pip install -U setuptools build

- name: Build a binary wheel and a source tarball
run: python -m build --sdist --wheel

- name: Publish Package on PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1.8
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*.pyc
.idea/
.pycharm_helpers/
.ipython/
dist/
*.egg-info/
build/
*.sw*
.coverage
.bash_history
db.sqlite3
72 changes: 72 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
exclude = [
".git",
"__pycache",
"migrations",
"src",
"docs",
"rh_django_shared",
"example/conf/settings.py",
]

[lint]
dummy-variable-rgx = "_|dummy"
# See https://github.com/astral-sh/ruff?tab=readme-ov-file#rules for all supported rules
select = [
"A",
"B",
"BLE",
"C",
"C4",
"C90",
"COM",
"DJ",
"DTZ",
"E",
"ERA",
"F",
"G",
"I",
"ICN",
"INP",
"N",
"PIE",
"PGH",
"PL",
"PTH",
"RET",
"RSE",
"RUF",
"S",
"SIM",
"T20",
"UP",
"W",
"YTT",
]
ignore = [
# "N802", # Function name `{name}` should be lowercase
"N803", # Argument name `{name}` should be lowercase
# "N806", # Variable `{name}` in function should be lowercase
# "N815", # Variable `{name}` in class scope should not be mixedCase
# "N818", # Exception name `{name}` should be named with an Error suffix
# "A003", # Class attribute `{name}` is shadowing a python builtin
# "S101", # Use of `assert` detected
# "UP007", # Use `X | Y` for type annotations
"S105", # Possible hardcoded password: "{}"
# "PLR0913", # Too many arguments to function call ({c_args}/{max_args})
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
]

[lint.mccabe]
max-complexity = 16

[lint.pycodestyle]
max-line-length = 88

[lint.pylint]
max-branches = 16
max-args = 10
max-public-methods = 50

[format]
skip-magic-trailing-comma = false
Empty file added CHANGELOG.md
Empty file.
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM python:3.12

ENV PYTHONUNBUFFERED 1
ENV LC_ALL=C.UTF-8

RUN useradd -m app

USER app
WORKDIR /app

ADD ./example/requirements.txt /app/example/
ADD ./requirements-ci.txt /app/

ENV PATH /home/app/venv/bin:$PATH

RUN python3 -m venv ~/venv && \
pip install -r ./example/requirements.txt

ADD . /app/

ENV DJANGO_SETTINGS_MODULE conf.settings
7 changes: 7 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2024 RegioHelden GmbH

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include LICENSE README.md
recursive-include django_kafka/ *
Loading

0 comments on commit 5bd25da

Please sign in to comment.