Skip to content

Commit

Permalink
Merge remote-tracking branch 'dynamic-bse/main' into bse-django-42
Browse files Browse the repository at this point in the history
  • Loading branch information
seljin committed Nov 18, 2024
2 parents e9e015c + cd20262 commit 58244e6
Show file tree
Hide file tree
Showing 143 changed files with 7,668 additions and 7,154 deletions.
4 changes: 4 additions & 0 deletions .behaverc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[behave]
paths = tests/acceptance
junit_directory = tests/reports
junit = yes
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ root = true

# Change these settings to your own preference
indent_style = space
indent_size = 4
indent_size = 4

# We recommend you to keep these unchanged
end_of_line = lf
Expand Down
4 changes: 3 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
[flake8]
max-line-length=90
docstring-convention=google
max-line-length = 88
extend-ignore = E203,D212,D411
101 changes: 101 additions & 0 deletions .github/workflows/django.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Django CI

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

jobs:
test:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.9, "3.10", "3.11", "3.12"]
dj-version: ["3.0.*", "3.1.*", "3.2.*", "4.0.*", "4.1.*", "4.2.*", "5.0.*", "5.1.*"]
drf-version: ["3.11.*", "3.12.*", "3.13.*", "3.14.*", "3.15.*"]
exclude:
- dj-version: '4.0.*'
drf-version: '3.11.*'
- dj-version: '4.0.*'
drf-version: '3.12.*'
- dj-version: '4.1.*'
drf-version: '3.11.*'
- dj-version: '4.1.*'
drf-version: '3.12.*'
- dj-version: '4.2.*'
drf-version: '3.11.*'
- dj-version: '4.2.*'
drf-version: '3.11.*'
- dj-version: '4.2.*'
drf-version: '3.12.*'
- dj-version: '4.2.*'
drf-version: '3.13.*'
- dj-version: '5.0.*'
python-version: 3.9
- dj-version: '5.1.*'
python-version: 3.9
- dj-version: '5.0.*'
drf-version: '3.11.*'
- dj-version: '5.0.*'
drf-version: '3.12.*'
- dj-version: '5.0.*'
drf-version: '3.13.*'
- dj-version: '5.1.*'
drf-version: '3.11.*'
- dj-version: '5.1.*'
drf-version: '3.12.*'
- dj-version: '5.1.*'
drf-version: '3.13.*'
- python-version: 3.12
dj-version: '3.0.*'
- python-version: 3.12
dj-version: '3.1.*'

services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: github_actions
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install 'django==${{ matrix.dj-version }}' 'djangorestframework==${{ matrix.drf-version }}'
- name: Run Tests
run: |
DATABASE_URL=psql://postgres:postgres@127.0.0.1:5432/github_actions coverage run -p runtests.py
DATABASE_URL=psql://postgres:postgres@127.0.0.1:5432/github_actions coverage run -p manage.py behave
coverage combine
- name: Upload coverage data to coveralls.io
run: coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: ${{ join(matrix.*, '-') }}
COVERALLS_PARALLEL: true
coveralls:
name: Indicate completion to coveralls.io
needs: test
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Finished
run: |
pip3 install --upgrade coveralls
coveralls --service=github --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16 changes: 16 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: pre-commit

on:
pull_request:
push:
branches: [main]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/action@v3.0.0
with:
extra_args: flake8 --all-files
39 changes: 39 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
release:
types: [published]

permissions:
contents: read

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build --sdist --wheel
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
63 changes: 0 additions & 63 deletions .github/workflows/test.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,5 @@ db.sqlite3

# PyCharm
.idea/
tests/reports/
profile
43 changes: 43 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
args: ["--profile", "black", "--filter-files"]
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
hooks:
- id: flake8
exclude: ^.*migrations/
additional_dependencies: [flake8-docstrings]
- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint
language: system
types: [python]
exclude: ^.*migrations/
#args:
# [
# "-rn", # Only display messages
# "-sn", # Don't display the score
# ]
#- repo: local
# hooks:
# - id: generate-requirements
# name: generate-requirements
# entry: python generate_requirements.py
# language: python
# pass_filenames: false
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ When making contributions, try to follow these guidelines:

Use `make lint` to check your code for style violations.

We use the `flake8` linter to enforce PEP8 code style.
We use the `flake8` linter to enforce PEP8 code style.
For additional details, see our [Python style guide](https://github.com/AltSchool/Python).

## Documentation
Expand Down
33 changes: 23 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
[![Circle CI](https://circleci.com/gh/AltSchool/dynamic-rest.svg?style=svg)](https://circleci.com/gh/AltSchool/dynamic-rest)
[![PyPi](https://img.shields.io/pypi/v/dynamic-rest.svg)](https://pypi.python.org/pypi/dynamic-rest)

[![Coverage Status](https://coveralls.io/repos/github/BillSchumacher/dynamic-rest/badge.svg?branch=main)](https://coveralls.io/github/BillSchumacher/dynamic-rest?branch=main)

**Dynamic API extensions for Django REST Framework**

See http://dynamic-rest.readthedocs.org for full documentation.
Expand Down Expand Up @@ -42,7 +44,7 @@ empower simple RESTful APIs with the flexibility of a graph query language.
DREST classes can be used as a drop-in replacement for DRF classes, which offer the following features on top of the standard DRF kit:

- Linked relationships
- Sideloaded relationships
- Side-loaded relationships
- Embedded relationships
- Inclusions
- Exclusions
Expand All @@ -67,19 +69,19 @@ over HTTP.

# Requirements

- Python (3.6, 3.7, 3.8)
- Django (2.2, 3.1, 3.2)
- Django REST Framework (3.11, 3.12, 3.13)
- Python (3.9, 3.10, 3.11, 3.12)
- Django (3.1, 3.2, 4.0, 4.1, 4.2, 5.0, 5.1)
- Django REST Framework (3.11, 3.12, 3.13, 3.14, 3.15)

# Installation

1. Install using `pip`:

```bash
pip install dynamic-rest
pip install dynamic-rest-bse
```

(or add `dynamic-rest` to `requirements.txt` or `setup.py`)
(or add `dynamic-rest-bse` to `requirements.txt` or `setup.py`)

2. Add `rest_framework` and `dynamic_rest` to `INSTALLED_APPS` in `settings.py`:

Expand Down Expand Up @@ -112,7 +114,7 @@ This application is hosted at https://dynamic-rest.herokuapp.com but can also be
1. Clone this repository:

```bash
git clone git@github.com:AltSchool/dynamic-rest.git
git clone git@github.com:BillSchumacher/dynamic-rest.git
cd dynamic-rest
```

Expand Down Expand Up @@ -482,6 +484,17 @@ You can filter a user by his name (exact match):
200 OK
```

... or several relationship IDs:

```
-->
GET /users/?filter{groups.in}=1&filter{groups.in}=2
or
GET /users/?filter{name.in}=[1,2]
<--
200 OK
```

... or lack thereof:

```
Expand Down Expand Up @@ -634,9 +647,9 @@ DYNAMIC_REST = {

We actively support the following:

- Python: 3.6, 3.7, 3.8
- Django: 2.2, 3.1, 3.2
- Django Rest Framework: 3.11, 3.12
- Python: 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12
- Django: 2.2, 3.1, 3.2, 4.0, 4.1, 4.2, 5.0, 5.1
- Django Rest Framework: 3.11, 3.12, 3.13, 3.14, 3.15

**Note:** Some combinations are not supported. For up-to-date information on actively supported/tested combinations, see the `tox.ini` file.

Expand Down
Loading

0 comments on commit 58244e6

Please sign in to comment.