diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 2d9e2c5ee..0e7bc610a 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -11,3 +11,39 @@ updates: - "*" # Group all Action updates into a single larger pull request schedule: interval: weekly + cooldown: + default-days: 7 + + - package-ecosystem: "pip" + directory: "/" + + groups: + test: + patterns: + - "pytest*" + - "attrs" + - "importlib-metadata" + - "pytz" + + docs: + patterns: + - "mkdocs" + - "pylinkvalidator" + + optional: + patterns: + - "coreapi" + - "coreschema" + - "django-filter" + - "django-guardian" + - "inflection" + - "legacy-cgi" + - "markdown" + - "psycopg*" + - "pygments" + - "pyyaml" + + schedule: + interval: weekly + cooldown: + default-days: 7 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8ae01735c..3004ccf1f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,6 +6,10 @@ on: - main pull_request: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: tests: name: Python ${{ matrix.python-version }} @@ -28,7 +32,6 @@ jobs: python-version: ${{ matrix.python-version }} allow-prereleases: true cache: 'pip' - cache-dependency-path: 'requirements/*.txt' - name: Upgrade packaging tools run: python -m pip install --upgrade pip setuptools virtualenv wheel @@ -60,7 +63,7 @@ jobs: python-version: '3.13' - name: Install dependencies - run: pip install -r requirements/requirements-documentation.txt + run: pip install --group docs # Start mkdocs server and wait for it to be ready - run: mkdocs serve & @@ -68,7 +71,6 @@ jobs: - run: if [ $WAIT_TIME == 5 ]; then echo cannot start mkdocs server on http://localhost:8000; exit 1; fi - name: Check links - continue-on-error: true run: pylinkvalidate.py -P http://localhost:8000/ - run: echo "Done" diff --git a/.github/workflows/mkdocs-deploy.yml b/.github/workflows/mkdocs-deploy.yml index ef58e9b77..778c7f127 100644 --- a/.github/workflows/mkdocs-deploy.yml +++ b/.github/workflows/mkdocs-deploy.yml @@ -7,7 +7,7 @@ on: paths: - docs/** - docs_theme/** - - requirements/requirements-documentation.txt + - pyproject.toml - mkdocs.yml - .github/workflows/mkdocs-deploy.yml @@ -25,5 +25,5 @@ jobs: - uses: actions/setup-python@v6 with: python-version: 3.x - - run: pip install -r requirements/requirements-documentation.txt + - run: pip install --group docs - run: mkdocs gh-deploy diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5780c8e31..8895ed954 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,27 +24,21 @@ repos: hooks: - id: blacken-docs additional_dependencies: - - black==25.9.0 + - black==26.1.0 - repo: https://github.com/codespell-project/codespell - # Configuration for codespell is in .codespellrc + # Configuration for codespell is in pyproject.toml rev: v2.4.1 hooks: - id: codespell - args: [ - "--builtin", "clear,rare,code,names,en-GB_to_en-US", - "--ignore-words", "codespell-ignore-words.txt", - "--skip", "*.css", - ] - exclude: locale|kickstarter-announcement.md|coreapi-0.1.1.js additional_dependencies: # python doesn't come with a toml parser prior to 3.11 - "tomli; python_version < '3.11'" - repo: https://github.com/asottile/pyupgrade - rev: v3.21.0 + rev: v3.21.2 hooks: - id: pyupgrade args: ["--py310-plus", "--keep-percent-format"] - repo: https://github.com/tox-dev/pyproject-fmt - rev: v2.11.0 + rev: v2.11.1 hooks: - id: pyproject-fmt diff --git a/codespell-ignore-words.txt b/codespell-ignore-words.txt index 07c9fdb9b..c183affef 100644 --- a/codespell-ignore-words.txt +++ b/codespell-ignore-words.txt @@ -4,4 +4,7 @@ IAM endcode deque thead -lets \ No newline at end of file +lets +fo +malcom +ser \ No newline at end of file diff --git a/docs/api-guide/authentication.md b/docs/api-guide/authentication.md index a00a3873f..e4fff74a6 100644 --- a/docs/api-guide/authentication.md +++ b/docs/api-guide/authentication.md @@ -89,7 +89,7 @@ Note that when a request may successfully authenticate, but still be denied perm ## Django 5.1+ `LoginRequiredMiddleware` -If you're running Django 5.1+ and use the [`LoginRequiredMiddleware`][login-required-middleware], please note that all views from DRF are opted-out of this middleware. This is because the authentication in DRF is based authentication and permissions classes, which may be determined after the middleware has been applied. Additionally, when the request is not authenticated, the middleware redirects the user to the login page, which is not suitable for API requests, where it's preferable to return a 401 status code. +If you're running Django 5.1+ and use the [`LoginRequiredMiddleware`][login-required-middleware], please note that all views from DRF are opted-out of this middleware. This is because the authentication in DRF is based on authentication and permissions classes, which may be determined after the middleware has been applied. Additionally, when the request is not authenticated, the middleware redirects the user to the login page, which is not suitable for API requests, where it's preferable to return a 401 status code. REST framework offers an equivalent mechanism for DRF views via the global settings, `DEFAULT_AUTHENTICATION_CLASSES` and `DEFAULT_PERMISSION_CLASSES`. They should be changed accordingly if you need to enforce that API requests are logged in. diff --git a/docs/api-guide/fields.md b/docs/api-guide/fields.md index cb5730e21..ca6319288 100644 --- a/docs/api-guide/fields.md +++ b/docs/api-guide/fields.md @@ -849,10 +849,6 @@ the [djangorestframework-recursive][djangorestframework-recursive] package provi The [django-rest-framework-gis][django-rest-framework-gis] package provides geographic addons for django rest framework like a `GeometryField` field and a GeoJSON serializer. -## django-rest-framework-hstore - -The [django-rest-framework-hstore][django-rest-framework-hstore] package provides an `HStoreField` to support [django-hstore][django-hstore] `DictionaryField` model field. - [cite]: https://docs.djangoproject.com/en/stable/ref/forms/api/#django.forms.Form.cleaned_data [html-and-forms]: ../topics/html-and-forms.md [FILE_UPLOAD_HANDLERS]: https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-FILE_UPLOAD_HANDLERS @@ -862,8 +858,6 @@ The [django-rest-framework-hstore][django-rest-framework-hstore] package provide [drf-extra-fields]: https://github.com/Hipo/drf-extra-fields [djangorestframework-recursive]: https://github.com/heywbj/django-rest-framework-recursive [django-rest-framework-gis]: https://github.com/djangonauts/django-rest-framework-gis -[django-rest-framework-hstore]: https://github.com/djangonauts/django-rest-framework-hstore -[django-hstore]: https://github.com/djangonauts/django-hstore [python-decimal-rounding-modes]: https://docs.python.org/3/library/decimal.html#rounding-modes [django-current-timezone]: https://docs.djangoproject.com/en/stable/topics/i18n/timezones/#default-time-zone-and-current-time-zone [django-docs-select-related]: https://docs.djangoproject.com/en/stable/ref/models/querysets/#django.db.models.query.QuerySet.select_related diff --git a/docs/api-guide/permissions.md b/docs/api-guide/permissions.md index b8179490e..8acbdf77d 100644 --- a/docs/api-guide/permissions.md +++ b/docs/api-guide/permissions.md @@ -138,7 +138,10 @@ Provided they inherit from `rest_framework.permissions.BasePermission`, permissi return Response(content) !!! note - Composition of permissions supports `&` (and), `|` (or) and `~` (not) operators. + Composition of permissions supports the `&` (and), `|` (or) and `~` (not) operators, and also allows the use of brackets `(` `)` to group expressions. + + Operators follow the same precedence and associativity rules as standard logical operators (`~` highest, then `&`, then `|`). + # API Reference diff --git a/docs/community/3.10-announcement.md b/docs/community/3.10-announcement.md index a2135fd20..898ccde9f 100644 --- a/docs/community/3.10-announcement.md +++ b/docs/community/3.10-announcement.md @@ -145,4 +145,4 @@ continued development by **[signing up for a paid plan][funding]**. [legacy-core-api-docs]:https://github.com/encode/django-rest-framework/blob/3.14.0/docs/coreapi/index.md [sponsors]: https://fund.django-rest-framework.org/topics/funding/#our-sponsors -[funding]: funding.md +[funding]: https://opencollective.com/django-rest-framework diff --git a/docs/community/3.11-announcement.md b/docs/community/3.11-announcement.md index e913d5e0a..02f90d71f 100644 --- a/docs/community/3.11-announcement.md +++ b/docs/community/3.11-announcement.md @@ -111,4 +111,4 @@ continued development by **[signing up for a paid plan][funding]**. *Many thanks to all our [wonderful sponsors][sponsors], and in particular to our premium backers, [Sentry](https://getsentry.com/welcome/), [Stream](https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf), [ESG](https://software.esg-usa.com/), [Rollbar](https://rollbar.com/?utm_source=django&utm_medium=sponsorship&utm_campaign=freetrial), [Cadre](https://cadre.com), [Kloudless](https://hubs.ly/H0f30Lf0), [Lights On Software](https://lightsonsoftware.com), and [Retool](https://retool.com/?utm_source=djangorest&utm_medium=sponsorship).* [sponsors]: https://fund.django-rest-framework.org/topics/funding/#our-sponsors -[funding]: funding.md +[funding]: https://opencollective.com/django-rest-framework diff --git a/docs/community/3.12-announcement.md b/docs/community/3.12-announcement.md index 5264ddd85..dd6dc9610 100644 --- a/docs/community/3.12-announcement.md +++ b/docs/community/3.12-announcement.md @@ -178,4 +178,4 @@ continued development by **[signing up for a paid plan][funding]**. *Many thanks to all our [wonderful sponsors][sponsors], and in particular to our premium backers, [Sentry](https://getsentry.com/welcome/), [Stream](https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf), [ESG](https://software.esg-usa.com/), [Rollbar](https://rollbar.com/?utm_source=django&utm_medium=sponsorship&utm_campaign=freetrial), [Cadre](https://cadre.com), [Kloudless](https://hubs.ly/H0f30Lf0), [Lights On Software](https://lightsonsoftware.com), and [Retool](https://retool.com/?utm_source=djangorest&utm_medium=sponsorship).* [sponsors]: https://fund.django-rest-framework.org/topics/funding/#our-sponsors -[funding]: funding.md +[funding]: https://opencollective.com/django-rest-framework diff --git a/docs/community/3.4-announcement.md b/docs/community/3.4-announcement.md index 2c68b178a..2b3d5df6d 100644 --- a/docs/community/3.4-announcement.md +++ b/docs/community/3.4-announcement.md @@ -177,7 +177,7 @@ The full set of itemized release notes [are available here][release-notes]. [sponsors]: https://fund.django-rest-framework.org/topics/funding/#our-sponsors [moss]: mozilla-grant.md -[funding]: funding.md +[funding]: https://opencollective.com/django-rest-framework [core-api]: https://www.coreapi.org/ [command-line-client]: https://github.com/encode/django-rest-framework/blob/3.4.7/docs/topics/api-clients.md#command-line-client [client-library]: https://github.com/encode/django-rest-framework/blob/3.4.7/docs/topics/api-clients.md#python-client-library diff --git a/docs/community/3.5-announcement.md b/docs/community/3.5-announcement.md index eb3bf7fd5..3b0a22dfc 100644 --- a/docs/community/3.5-announcement.md +++ b/docs/community/3.5-announcement.md @@ -251,7 +251,7 @@ in version 3.3 and raised a deprecation warning in 3.4. Its usage is now mandato --- [sponsors]: https://fund.django-rest-framework.org/topics/funding/#our-sponsors -[funding]: funding.md +[funding]: https://opencollective.com/django-rest-framework [uploads]: https://core-api.github.io/python-client/api-guide/utils/#file [downloads]: https://core-api.github.io/python-client/api-guide/codecs/#downloadcodec [schema-generation-api]: ../api-guide/schemas.md#schemagenerator diff --git a/docs/community/3.6-announcement.md b/docs/community/3.6-announcement.md index 9e45473ee..3f4250db4 100644 --- a/docs/community/3.6-announcement.md +++ b/docs/community/3.6-announcement.md @@ -193,7 +193,7 @@ Once work on those refinements is complete, we'll be starting feature work on realtime support, for the 3.7 release. [sponsors]: https://fund.django-rest-framework.org/topics/funding/#our-sponsors -[funding]: funding.md +[funding]: https://opencollective.com/django-rest-framework [api-docs]: ../topics/documenting-your-api.md [js-docs]: https://github.com/encode/django-rest-framework/blob/3.14.0/docs/topics/api-clients.md#javascript-client-library [py-docs]: https://github.com/encode/django-rest-framework/blob/3.14.0/docs/topics/api-clients.md#python-client-library diff --git a/docs/community/3.7-announcement.md b/docs/community/3.7-announcement.md index 49f68ead2..3a8298817 100644 --- a/docs/community/3.7-announcement.md +++ b/docs/community/3.7-announcement.md @@ -125,6 +125,6 @@ We're still planning to work on improving real-time support for REST framework b This will likely be timed so that any REST framework development here ties in with similar work on [API Star][api-star]. -[funding]: funding.md +[funding]: https://opencollective.com/django-rest-framework [schema-docs]: ../api-guide/schemas.md [api-star]: https://github.com/encode/apistar diff --git a/docs/community/3.8-announcement.md b/docs/community/3.8-announcement.md index eef3ae0c9..7bf0015a9 100644 --- a/docs/community/3.8-announcement.md +++ b/docs/community/3.8-announcement.md @@ -91,7 +91,7 @@ We're currently working towards moving to using [OpenAPI][openapi] as our defaul We're doing some consolidation in order to make this happen. It's planned that 3.9 will drop the `coreapi` and `coreschema` libraries, and instead use `apistar` for the API documentation generation, schema generation, and API client libraries. -[funding]: funding.md +[funding]: https://opencollective.com/django-rest-framework [gh5886]: https://github.com/encode/django-rest-framework/issues/5886 [gh5705]: https://github.com/encode/django-rest-framework/issues/5705 [openapi]: https://www.openapis.org/ diff --git a/docs/community/3.9-announcement.md b/docs/community/3.9-announcement.md index bd886482c..1680d919e 100644 --- a/docs/community/3.9-announcement.md +++ b/docs/community/3.9-announcement.md @@ -203,7 +203,7 @@ web framework, which is building a foundational set of tooling for working with ASGI. -[funding]: funding.md +[funding]: https://opencollective.com/django-rest-framework [gh5886]: https://github.com/encode/django-rest-framework/issues/5886 [gh5705]: https://github.com/encode/django-rest-framework/issues/5705 [openapi]: https://www.openapis.org/ diff --git a/docs/community/contributing.md b/docs/community/contributing.md index da92630d4..006035a33 100644 --- a/docs/community/contributing.md +++ b/docs/community/contributing.md @@ -75,8 +75,7 @@ To run the tests, clone the repository, and then: # Setup the virtual environment python3 -m venv env source env/bin/activate - pip install -e . - pip install -r requirements.txt + pip install -e . --group dev # Run the tests ./runtests.py diff --git a/docs/community/jobs.md b/docs/community/jobs.md index f3ce37d15..7b16330d3 100644 --- a/docs/community/jobs.md +++ b/docs/community/jobs.md @@ -1,6 +1,6 @@ # Jobs -Looking for a new Django REST Framework related role? On this site we provide a list of job resources that may be helpful. It's also worth checking out if any of [our sponsors are hiring][drf-funding]. +Looking for a new Django REST Framework related role? On this site we provide a list of job resources that may be helpful. It's also worth checking out if any of [our sponsors are hiring][sponsors]. ## Places to look for Django REST Framework Jobs @@ -22,7 +22,7 @@ Looking for a new Django REST Framework related role? On this site we provide a Know of any other great resources for Django REST Framework jobs that are missing in our list? Please [submit a pull request][submit-pr] or [email us][anna-email]. -Wonder how else you can help? One of the best ways you can help Django REST Framework is to ask interviewers if their company is signed up for [REST Framework sponsorship][drf-funding] yet. +Wonder how else you can help? One of the best ways you can help Django REST Framework is to ask interviewers if their company is signed up for [REST Framework sponsorship][sponsors] yet. [djangoproject-website]: https://www.djangoproject.com/community/jobs/ @@ -38,6 +38,6 @@ Wonder how else you can help? One of the best ways you can help Django REST Fram [remoteok-com]: https://remoteok.com/remote-django-jobs [remotepython-com]: https://www.remotepython.com/jobs/ [pyjobs-com]: https://www.pyjobs.com/ -[drf-funding]: https://fund.django-rest-framework.org/topics/funding/ +[sponsors]: https://fund.django-rest-framework.org/topics/funding/#our-sponsors [submit-pr]: https://github.com/encode/django-rest-framework [anna-email]: mailto:anna@django-rest-framework.org diff --git a/docs/community/mozilla-grant.md b/docs/community/mozilla-grant.md index 5248f5cc0..9a7491b61 100644 --- a/docs/community/mozilla-grant.md +++ b/docs/community/mozilla-grant.md @@ -37,7 +37,7 @@ at the end of May 2016. I have formed a UK limited company, [Encode](https://www.encode.io/), which will act as the business entity behind REST framework. I will be issuing monthly reports from Encode on progress both towards the Mozilla grant, and for development time -funded via the [REST framework paid plans](funding.md). +funded via the REST framework paid plans. diff --git a/docs/community/project-management.md b/docs/community/project-management.md index 5c7577ec8..7856fedd5 100644 --- a/docs/community/project-management.md +++ b/docs/community/project-management.md @@ -81,14 +81,6 @@ When pushing the release to PyPI ensure that your environment has been installed --- -## Project requirements - -All our test requirements are pinned to exact versions, in order to ensure that our test runs are reproducible. We maintain the requirements in the `requirements` directory. The requirements files are referenced from the `tox.ini` configuration file, ensuring we have a single source of truth for package versions used in testing. - -Package upgrades should generally be treated as isolated pull requests. You can check if there are any packages available at a newer version, by using the `pip list --outdated`. - ---- - ## Project ownership The PyPI package is owned by `@tomchristie`. As a backup `@j4mie` also has ownership of the package. diff --git a/docs/img/drf-rw-api-root.png b/docs/img/drf-rw-api-root.png index 15b498b9b..6e0dd1aea 100644 Binary files a/docs/img/drf-rw-api-root.png and b/docs/img/drf-rw-api-root.png differ diff --git a/docs/img/drf-rw-detail-view.png b/docs/img/drf-rw-detail-view.png index 6e821acda..f2a319254 100644 Binary files a/docs/img/drf-rw-detail-view.png and b/docs/img/drf-rw-detail-view.png differ diff --git a/docs/img/drf-rw-list-view.png b/docs/img/drf-rw-list-view.png index 625b5c7c9..17d0a4633 100644 Binary files a/docs/img/drf-rw-list-view.png and b/docs/img/drf-rw-list-view.png differ diff --git a/docs/index.md b/docs/index.md index fb6d61444..fbbeae430 100644 --- a/docs/index.md +++ b/docs/index.md @@ -68,7 +68,7 @@ each Python and Django series. The following packages are optional: -* [PyYAML][pyyaml], [uritemplate][uriteemplate] (5.1+, 3.0.0+) - Schema generation support. +* [PyYAML][pyyaml], [uritemplate][uritemplate] (5.1+, 3.0.0+) - Schema generation support. * [Markdown][markdown] (3.3.0+) - Markdown support for the browsable API. * [Pygments][pygments] (2.7.0+) - Add syntax highlighting to Markdown processing. * [django-filter][django-filter] (1.0.1+) - Filtering support. @@ -221,7 +221,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. [heroku]: https://www.heroku.com/ [eventbrite]: https://www.eventbrite.co.uk/about/ [pyyaml]: https://pypi.org/project/PyYAML/ -[uriteemplate]: https://pypi.org/project/uritemplate/ +[uritemplate]: https://pypi.org/project/uritemplate/ [markdown]: https://pypi.org/project/Markdown/ [pygments]: https://pypi.org/project/Pygments/ [django-filter]: https://pypi.org/project/django-filter/ diff --git a/docs/topics/documenting-your-api.md b/docs/topics/documenting-your-api.md index edb989290..f4fee104b 100644 --- a/docs/topics/documenting-your-api.md +++ b/docs/topics/documenting-your-api.md @@ -4,10 +4,11 @@ > > — Roy Fielding, [REST APIs must be hypertext driven][cite] -REST framework provides a range of different choices for documenting your API. The following -is a non-exhaustive list of the most popular ones. +REST framework provides a range of different choices for documenting your API. The following is a non-exhaustive list of some of the most popular options. -## Third party packages for OpenAPI support +## Third-party packages for OpenAPI support + +REST framework recommends using third-party packages for generating and presenting OpenAPI schemas, as they provide more features and flexibility than the built-in (deprecated) implementation. ### drf-spectacular @@ -37,9 +38,9 @@ This also translates into a very useful interactive documentation viewer in the ## Built-in OpenAPI schema generation (deprecated) -**Deprecation notice: REST framework's built-in support for generating OpenAPI schemas is -deprecated in favor of 3rd party packages that can provide this functionality instead. -As replacement, we recommend using the [drf-spectacular](#drf-spectacular) package.** +!!! warning + **Deprecation notice:** REST framework's built-in support for generating OpenAPI schemas is deprecated in favor of third-party packages that provide this functionality instead. As a replacement, we recommend using **drf-spectacular**. + There are a number of packages available that allow you to generate HTML documentation pages from OpenAPI schemas. diff --git a/pyproject.toml b/pyproject.toml index da608a26c..502f640bb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,13 +31,57 @@ classifiers = [ "Topic :: Internet :: WWW/HTTP", ] dynamic = [ "version" ] - dependencies = [ "django>=4.2" ] urls.Changelog = "https://www.django-rest-framework.org/community/release-notes/" urls.Funding = "https://fund.django-rest-framework.org/topics/funding/" urls.Homepage = "https://www.django-rest-framework.org" urls.Source = "https://github.com/encode/django-rest-framework" +[dependency-groups] +dev = [ + { include-group = "docs" }, + { include-group = "optional" }, + { include-group = "test" }, +] +test = [ + "importlib-metadata<9.0", + + # Pytest for running the tests. + "pytest==9.*", + "pytest-cov==7.*", + "pytest-django>=4.5.2,<5", + + # Remove when dropping support for Django<5.0 + "pytz", +] +docs = [ + # MkDocs to build our documentation. + "mkdocs==1.6.1", + # pylinkvalidator to check for broken links in documentation. + "pylinkvalidator==0.3", +] +optional = [ + # Optional packages which may be used with REST framework. + "coreapi==2.3.3", + "coreschema==0.0.4", + "django-filter", + "django-guardian>=2.4.0,<3.3", + "inflection==0.5.1", + "legacy-cgi; python_version>='3.13'", + "markdown>=3.3.7", + "psycopg[binary]>=3.1.8", + "pygments>=2.17,<2.20", + "pyyaml>=5.3.1,<6.1", + # setuptools is needed for coreapi (imports pkg_resources) + "setuptools", +] +django42 = [ "django>=4.2,<5.0" ] +django50 = [ "django>=5.0,<5.1" ] +django51 = [ "django>=5.1,<5.2" ] +django52 = [ "django>=5.2,<6.0" ] +django60 = [ "django>=6.0,<6.1" ] +djangomain = [ "django @ https://github.com/django/django/archive/main.tar.gz" ] + [tool.setuptools] [tool.setuptools.dynamic] @@ -63,16 +107,21 @@ known_first_party = [ "rest_framework", "tests" ] [tool.codespell] # Ref: https://github.com/codespell-project/codespell#using-a-config-file -skip = "*/kickstarter-announcement.md,*.js,*.map,*.po" -ignore-words-list = "fo,malcom,ser" +skip = "*/kickstarter-announcement.md,*.js,*.map,*.po,*.css,locale" +ignore-words = "codespell-ignore-words.txt" +builtin = "clear,rare,code,names,en-GB_to_en-US" [tool.pyproject-fmt] max_supported_python = "3.14" +keep_full_version = true [tool.pytest.ini_options] addopts = "--tb=short --strict-markers -ra" testpaths = [ "tests" ] -filterwarnings = [ "ignore:CoreAPI compatibility is deprecated*:rest_framework.RemovedInDRF318Warning" ] +filterwarnings = [ + "ignore:CoreAPI compatibility is deprecated*:rest_framework.RemovedInDRF318Warning", + "ignore:'cgi' is deprecated:DeprecationWarning", +] [tool.coverage.run] # NOTE: source is ignored with pytest-cov (but uses the same). diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index c3a1f1187..000000000 --- a/requirements.txt +++ /dev/null @@ -1,13 +0,0 @@ -# The base set of requirements for REST framework is actually -# just Django and pytz, but for the purposes of development -# and testing there are a number of packages that are useful -# to install. - -# Laying these out as separate requirements files, allows us to -# only included the relevant sets when running tox, and ensures -# we are only ever declaring our dependencies in one place. - --r requirements/requirements-optionals.txt --r requirements/requirements-testing.txt --r requirements/requirements-documentation.txt --r requirements/requirements-packaging.txt diff --git a/requirements/requirements-documentation.txt b/requirements/requirements-documentation.txt deleted file mode 100644 index c7e07acb3..000000000 --- a/requirements/requirements-documentation.txt +++ /dev/null @@ -1,5 +0,0 @@ -# MkDocs to build our documentation. -mkdocs==1.6.0 -mkdocs-material[imaging]==9.7.0 -# pylinkvalidator to check for broken links in documentation. -pylinkvalidator==0.3 diff --git a/requirements/requirements-optionals.txt b/requirements/requirements-optionals.txt deleted file mode 100644 index a19e4d192..000000000 --- a/requirements/requirements-optionals.txt +++ /dev/null @@ -1,11 +0,0 @@ -# Optional packages which may be used with REST framework. -coreapi==2.3.1 -coreschema==0.0.4 -django-filter -django-guardian>=2.4.0,<2.5 -inflection==0.5.1 -legacy-cgi; python_version>="3.13" -markdown>=3.3.7 -psycopg[binary]>=3.1.8 -pygments~=2.17.0 -pyyaml>=5.3.1,<5.4 diff --git a/requirements/requirements-packaging.txt b/requirements/requirements-packaging.txt deleted file mode 100644 index 81f22a35a..000000000 --- a/requirements/requirements-packaging.txt +++ /dev/null @@ -1,8 +0,0 @@ -# Wheel for PyPI installs. -wheel>=0.36.2,<0.40.0 - -# Twine for secured PyPI uploads. -twine>=3.4.2,<4.0.2 - -# Transifex client for managing translation resources. -transifex-client diff --git a/requirements/requirements-testing.txt b/requirements/requirements-testing.txt deleted file mode 100644 index a3821a508..000000000 --- a/requirements/requirements-testing.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Pytest for running the tests. -pytest>=7.0.1,<8.0 -pytest-cov>=4.0.0,<5.0 -pytest-django>=4.5.2,<5.0 -importlib-metadata<5.0 -# temporary pin of attrs -attrs==22.1.0 -pytz # Remove when dropping support for Django<5.0 -setuptools>=77.0.3 diff --git a/tox.ini b/tox.ini index 6980d0bfa..00e5bd57b 100644 --- a/tox.ini +++ b/tox.ini @@ -10,40 +10,40 @@ envlist = docs [testenv] -commands = python -W error::DeprecationWarning -W error::PendingDeprecationWarning runtests.py --coverage {posargs} +commands = pytest --cov --cov-report xml {posargs} envdir = {toxworkdir}/venvs/{envname} setenv = PYTHONDONTWRITEBYTECODE=1 PYTHONWARNINGS=once -deps = - django42: Django>=4.2,<5.0 - django50: Django>=5.0,<5.1 - django51: Django>=5.1,<5.2 - django52: Django>=5.2,<6.0 - django60: Django>=6.0,<6.1 - djangomain: https://github.com/django/django/archive/main.tar.gz - -rrequirements/requirements-testing.txt - -rrequirements/requirements-optionals.txt +dependency_groups = + test + optional + django42: django42 + django50: django50 + django51: django51 + django52: django52 + django60: django60 + djangomain: djangomain [testenv:base] ; Ensure optional dependencies are not required +dependency_groups = + test deps = - django<6.1 - -rrequirements/requirements-testing.txt [testenv:dist] commands = python -W error::DeprecationWarning -W error::PendingDeprecationWarning runtests.py --no-pkgroot --staticfiles {posargs} -deps = - django<6.1 - -rrequirements/requirements-testing.txt - -rrequirements/requirements-optionals.txt +dependency_groups = + test + optional [testenv:docs] skip_install = true -commands = mkdocs build -deps = - -rrequirements/requirements-testing.txt - -rrequirements/requirements-documentation.txt +commands = + mkdocs build +dependency_groups = + test + docs [testenv:py312-djangomain] ignore_outcome = true