Commit Graph

99 Commits

Author SHA1 Message Date
gitworkflows 9d74b23670
♻️ Simplify internal docs script (#11777) 2024-07-14 12:10:43 -05:00
Sebastián Ramírez f49da74200
🔨 Update internal scripts and remove unused ones (#11499) 2024-04-29 17:03:14 -07:00
Sebastián Ramírez 2fe1a1387b
🔨 Verify `mkdocs.yml` languages in CI, update `docs.py` (#11009) 2024-01-22 20:26:14 +01:00
Max Su df09e0a3f6
🌐 Initialize translations for Traditional Chinese (#10505)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2024-01-17 18:15:27 +01:00
Sebastián Ramírez 0aee526de9
🔧 Add support for translations to languages with a longer code name, like `zh-hant` (#10950) 2024-01-12 14:38:17 +00:00
Craig Blaszczyk 7eeacc9958
Generate automatic language names for docs translations (#5354)
Co-authored-by: Craig Blaszczyk <craig@boughtbymany.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2024-01-09 20:37:09 +00:00
Sebastián Ramírez 2e14c69c31
👷 Adopt Ruff format (#10517)
* 🔧 Update pre-commit, use ruff format

* ⬆️ Upgrade dependencies, use Ruff for formatting

* 🔧 Update Ruff config

* 🔨 Update lint and format scripts, use Ruff

* 🎨 Format internals with Ruff

* 🎨 Format docs scripts

* 🎨 Format tests

* 🎨 Format extra commas in src for docs

* 📝 Update docs mentioning `@lru_cache()`, use `@lru_cache` instead to keep consistency with the format

* 🎨 Update src for docs, use plain `@lru_cache`

* 🎨 Update src for docs format and docs references
2023-10-25 00:26:06 +04:00
Sebastián Ramírez 9bfbacfe98
🐛 Fix overriding MKDocs theme lang in hook (#10490) 2023-10-21 11:10:18 +04:00
Sebastián Ramírez dc7838eec3
🔥 Drop/close Gitter chat. Questions should go to GitHub Discussions, free conversations to Discord. (#10485) 2023-10-20 12:39:03 +04:00
Sebastián Ramírez 05ca41cfd1
Add reference (code API) docs with PEP 727, add subclass with custom docstrings for `BackgroundTasks`, refactor docs structure (#10392)
*  Add mkdocstrings and griffe-typingdoc to dependencies

* 🔧 Add mkdocstrings configs to MkDocs

* 📝 Add first WIP reference page

* ⬆️ Upgrade typing-extensions to the minimum version including Doc()

* 📝 Add docs to FastAPI parameters

* 📝 Add docstrings for OpenAPI docs utils

* 📝 Add docstrings for security utils

* 📝 Add docstrings for UploadFile

* 📝 Update docstrings in FastAPI class

* 📝 Add docstrings for path operation methods

* 📝 Add docstring for jsonable_encoder

* 📝 Add docstrings for exceptions

* 📝 Add docstsrings for parameter functions

* 📝 Add docstrings for responses

* 📝 Add docstrings for APIRouter

* ♻️ Sub-class BackgroundTasks to document it with docstrings

* 📝 Update usage of background tasks in dependencies

*  Update tests with new deprecation warnings

* 📝 Add new reference docs

* 🔧 Update MkDocs with new reference docs

*  Update pytest fixture, deprecation is raised only once

* 🎨 Update format for types in exceptions.py

* ♻️ Update annotations in BackgroundTask, `Annotated` can't take ParamSpec's P.args or P.kwargs

* ✏️ Fix typos caught by @pawamoy

* 🔧 Update and fix MkDocstrings configs from @pawamoy tips

* 📝 Update reference docs

* ✏️ Fix typos found by @pawamoy

*  Add HTTPX as a dependency for docs, for the TestClient

* 🔧 Update MkDocs config, rename websockets reference

* 🔇 Add type-ignores for Doc as the stubs haven't been released for mypy

* 🔥 Remove duplicated deprecated notice

* 🔇 Remove typing error for unreleased stub in openapi/docs.py

*  Add tests for UploadFile for coverage

* ⬆️ Upgrade griffe-typingdoc==0.2.2

* 📝 Refactor docs structure

* 🔨 Update README generation with new index frontmatter and style

* 🔨 Update generation of languages, remove from top menu, keep in lang menu

* 📝 Add OpenAPI Pydantic models

* 🔨 Update docs script to not translate Reference and Release Notes

* 🔧 Add reference for OpenAPI models

* 🔧 Update MkDocs config for mkdocstrings insiders

* 👷 Install mkdocstring insiders in CI for docs

* 🐛 Fix MkDocstrings insiders install URL

*  Move dependencies shared by docs and tests to its own requirements file

* 👷 Update cache keys for test and docs dependencies

* 📝 Remove no longer needed __init__ placeholder docstrings

* 📝 Move docstring for APIRouter to the class level (not __init__ level)

* 🔥 Remove no longer needed dummy placeholder __init__ docstring
2023-10-18 16:36:40 +04:00
Sebastián Ramírez ea43f227e5
Add support for disabling the separation of input and output JSON Schemas in OpenAPI with Pydantic v2 (#10145)
* 📝 Add docs for Separate OpenAPI Schemas for Input and Output

* 🔧 Add new docs page to MkDocs config

*  Add separate_input_output_schemas parameter to FastAPI class

* 📝 Add source examples for separating OpenAPI schemas

*  Add tests for separated OpenAPI schemas

* 📝 Add source examples for Python 3.10, 3.9, and 3.7+

* 📝 Update docs for Separate OpenAPI Schemas with new multi-version examples

*  Add and update tests for different Python versions

*  Add tests for corner cases with separate_input_output_schemas

* 📝 Update tutorial to use Union instead of Optional

* 🐛 Fix type annotations

* 🐛 Fix correct import in test

* 💄 Add CSS to simulate browser windows for screenshots

*  Add playwright as a dev dependency to automate generating screenshots

* 🔨 Add Playwright scripts to generate screenshots for new docs

* 📝 Update docs, tweak text to match screenshots

* 🍱 Add screenshots for new docs
2023-08-25 21:10:22 +02:00
Sebastián Ramírez 0a8423d792
🔨 Enable linenums in MkDocs Material during local live development to simplify highlighting code (#9769) 2023-06-30 18:23:02 +02:00
Sebastián Ramírez ed297bb2e0
Add Material for MkDocs Insiders features and cards (#9748)
*  Add dependencies for MkDocs Insiders

* 🙈 Add Insider's .cache to .gitignore

* 🔧 Update MkDocs configs for Insiders

* 💄 Add custom Insiders card layout, while the custom logo is provided from upstream

* 🔨 Update docs.py script to dynamically enable insiders if it's installed

* 👷 Add cache for MkDocs Material Insiders' cards

* 🔊 Add a small log to the docs CLI

* 🔊 Tweak logs, only after exporting languages

* 🐛 Fix accessing non existing env var

* 🔧 Invalidate deps cache

* 🔧 Tweak cache IDs

* 👷 Update cache for installing insiders

* 🔊 Log insiders

* 💚 Invalidate cache

* 👷 Tweak cache keys

* 👷 Trigger CI and test cache

* 🔥 Remove cache comment

* ️ Optimize cache usage for first runs of docs

* 👷 Tweak cache for MkDocs Material cards

* 💚 Trigger CI to test cache
2023-06-26 16:05:43 +02:00
Sebastián Ramírez 5656ed09ef
Refactor docs for building scripts, use MkDocs hooks, simplify (remove) configs for languages (#9742)
*  Add MkDocs hooks to re-use all config from en, and auto-generate missing docs files form en

* 🔧 Update MkDocs config for es

* 🔧 Simplify configs for all languages

*  Compute available languages from MkDocs Material for config overrides in hooks

* 🔧 Update config for MkDocs for en, to make paths compatible for other languages

* ♻️ Refactor scripts/docs.py to remove all custom logic that is now handled by the MkDocs hooks

* 🔧 Remove ta language as it's incomplete (no translations and causing errors)

* 🔥 Remove ta lang, no translations available

* 🔥 Remove dummy overrides directories, no longer needed

*  Use the same missing-translation.md file contents for hooks

* ️ Restore and refactor new-lang command

* 📝 Update docs for contributing with new simplified workflow for translations

* 🔊 Enable logs so that MkDocs can show its standard output on the docs.py script
2023-06-25 14:33:58 +02:00
Sebastián Ramírez 51d3a8ff12
🔨 Add MkDocs hook that renames sections based on the first index file (#9737) 2023-06-24 16:47:15 +02:00
Sebastián Ramírez c09e5cdfa7
👷 Refactor Docs CI, run in multiple workers with a dynamic matrix to optimize speed (#9732) 2023-06-24 02:00:12 +02:00
Sebastián Ramírez 7167c77a18
⬆️ Upgrade and fully migrate to Ruff, remove isort, includes a couple of tweaks suggested by the new version of Ruff (#9660) 2023-06-12 00:37:34 +02:00
Sebastián Ramírez 6595658324
⬇️ Separate requirements for development into their own requirements.txt files, they shouldn't be extras (#9655) 2023-06-11 23:38:15 +02:00
Jakepys 392766bcfa
✏ Update `zip-docs.sh` internal script, remove extra space (#5931) 2023-02-09 20:36:46 +01:00
Sebastián Ramírez 9efab1bd96
👷 Refactor CI artifact upload/download for docs previews (#5793) 2022-12-16 22:11:03 +04:00
Sebastián Ramírez 884203676d
👷 Tweak build-docs to improve CI performance (#5699) 2022-11-27 14:22:30 +00:00
Sebastián Ramírez fa74093440
Use Ruff for linting (#5630) 2022-11-13 19:19:04 +01:00
Sebastián Ramírez be3e29fb3c
👷 Switch from Codecov to Smokeshow plus pytest-cov to pure coverage for internal tests (#5583) 2022-11-03 21:00:29 +01:00
Sebastián Ramírez e866a2c7e1
🐛 Fix calling `mkdocs` for languages as a subprocess to fix/enable MkDocs Material search plugin (#5501)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-16 17:01:38 +02:00
Sebastián Ramírez eb1d68c789
🔧 Lint only in Python 3.7 and above (#4006) 2021-10-06 15:08:57 +00:00
Sebastián Ramírez ae22bca9fe
⬆️ Upgrade development `autoflake`, supporting multi-line imports (#3988) 2021-10-05 10:17:31 +00:00
Marcelo Trylesinski fa2c750443
Add the `docs_src` directory to test coverage and update tests (#1904)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-29 11:26:07 +02:00
Sebastián Ramírez 273b2cd646
🐛 Fix docs script to generate a new translation language with overrides boilerplate (#3202) 2021-05-10 09:15:39 +02:00
Sebastián Ramírez da86791224
Add new Deta banner badge with new sponsorship tier 🙇 (#3194) 2021-05-08 19:50:56 +02:00
Sebastián Ramírez 9f89399f5e
🌐 Add docs lang selector widget (#2542)
*  Add language selector widget

* 🔧 Update script to re-generate MkDocs configs, including langs widget

* 🔧 Update languages MkDocs configs, with lang selector widget
2020-12-19 20:54:02 +01:00
Sebastián Ramírez 6e9b771abf
🐛 Fix docs overrides directory for translations (#2541)
* 🙈 Add .gitignore files to keep overrides directories for translations to fix serving live locally during translations

* ♻️ Refactor docs scripts to handle language overrides (newsletter notification)
2020-12-19 19:54:54 +01:00
Sebastián Ramírez e6f8aa8756
Add newsletter: FastAPI and friends (#2509)
*  Add newsletter: FastAPI and friends

* 🔧 Update MkDocs config for announcement

* 🔧 Update generation script to include overrides for announcements
2020-12-13 16:33:46 +01:00
Sebastián Ramírez a42c690496
📝 Add deployment to Deta, the first gold sponsor 🎉 (#2303)
* 📝 Add docs for sponsors

* 📝 Add docs for deploying on Deta

* 🍱 Add Deta docs screenshots

* ♻️ Refactor and separate deployment docs

* 📝 Update internal docs links to Deployment

* 📝 Update links in Deta tutorial

* 🍱 Update sponsors images

* 🔧 Use sponsors data from YAML

* 📝 Update sponsors in languages docs

*  Update docs generation scripts

*  Update README.md testing

* 📝 Update main README

* 🔧 Update fastapi-people action handling individual sponsors

* ✏️ Fix typos in Deta tutorial
2020-11-05 21:50:37 +01:00
Sebastián Ramírez e1755f4fa6
🔥 Cleanup after upgrade for Docs Previews GitHub Action (#2248)
* 🔧 Upload docs artifacts even on push to avoid breaking Preview Docs

* 🔥 Remove replaced GitHub Action get-artifact

* 🔥 Remove GitHub Action Watch Docs Previews, replaced with Preview Docs

* 🔥 Remove commented backup configs in Preview Docs GitHub Action

* 🔥 Remove no longer needed utils scripts
2020-10-25 19:46:32 +01:00
Sebastián Ramírez f88ffd1a0b
️ Build docs for languages in parallel in subprocesses to speed up CI (#2242) 2020-10-25 12:59:13 +01:00
Sebastián Ramírez 8650dee4bc
🐛 Fix docs order generation for partial translations (#2238) 2020-10-24 13:32:59 +02:00
Nima Mashhadi M. Reza da9b5201c4
🔧 Add Flake8 linting (#1774)
Co-authored-by: nimashadix <nimashadix@pop-os.localdomain>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-08-09 12:54:05 +02:00
Sebastián Ramírez aedf5c895a
👷 Re-enable Gitter releases bot (#1831) 2020-08-03 19:28:02 +02:00
Sebastián Ramírez 6ab2841dbb
♻ Update GitHub actions (#1746)
* 🐛 Fix Gitter notification, use development gitter room until next release

* 🔥 Remove trigger docs preview step from build-docs workflow

as it requires a more privileged token, so it's now triggered by the preview docs watcher

* 🔊 Dump context when building to allow debugging how to refactor the Gitter bot
2020-07-20 18:56:13 +02:00
Sebastián Ramírez 7032dfb4f1
Add GitHub Action to watch for missing preview docs (#1740)
* 📝 Update release notes

* 🔊 Make curl verbose when triggering docs preview

* 🔧 Update GitHub Actions circus to use commit hash

*  Add PR docs preview watcher
2020-07-20 16:33:17 +02:00
Sebastián Ramírez b268c39758
Add internal GitHub action to deploy docs previews (#1739)
* 📝 Update release notes

*  Add internal GitHub action to pull docs artifact

* 🙈 Add archive.zip to gitignore
2020-07-19 22:11:28 +02:00
Sebastián Ramírez 4dd386b807
🚀 Preview docs for external PRs (#1738)
* 🍱 Save docs zip when building docs

* 🙈 Add docs.zip artifact to .gitignore

* 🚀 Update deploy artifact name

* ♻️ Upload artifact directory

*  Add WIP trigger docs preview

* ♻️ Update trigger docs preview

* 👷 Update env vars for docs preview

* 👷 Update PR extraction

* 👷 Try to show GitHub event

* 💚 Try to see if GitHub context templates is causing the problem

* 💚 Try to debug context GitHub event

* 🔊 Debug GitHub event context

* 👷 Update debugging action

* 👷 Update debug

* 👷 Update Action

* ♻️ Update script to trigger docs preview

* ️ Try to use Zip again to improve speed

* 🔧 Update zip scripts

*  Add preview docs on event

* 🚀 Trigger deploy preview on PRs

* 🐛 Fix trigger script env vars
2020-07-19 20:49:52 +02:00
Sebastián Ramírez 780d3e65ad
Add XML coverage report for GitHub Actions (#1737) 2020-07-19 14:24:24 +02:00
Sebastián Ramírez 47a630721a
👷 Add GitHub Actions, move from Travis (#1735) 2020-07-19 14:03:38 +02:00
Sebastián Ramírez a5c03ba1b7
External links in docs with data file (#1701)
*  Add mkdocs-markdownextradata-plugin for docs

* 🔧 Update MkDocs config file(s) to include external data

*  Add external links data file

* 📝 Use external data file in External Links

* ♻️ Update data files for langs

The cost is some duplication 😔, these files are updated by the script, but to be able to serve locally they have to be duplicated

*  Update docs script to copy data files

* 🔥 Remove needed duplication of data files for live docs in translations
2020-07-10 14:31:44 +02:00
Sebastián Ramírez 600f15faa0
✔ Improve support for tests in editor (#1699)
* ♻️ Remove required extra steps to test in editor

* 🎨 Format lint script

* 📝 Remove obsolete extra steps required to test in editor from docs

* 🐛 Fix coverage
2020-07-10 11:08:19 +02:00
Brian Mboya fe453f80ed
⬆ Upgrade isort to version 5.x.x (#1670)
* Update isort script to match changes in the new release, isort v5.0.2

* Downgrade isort to version v4.3.21

* Add an alternative flag to --recursive in isort v5.0.2

* Add isort config file

* 🚚 Import from docs_src for tests

* 🎨 Format dependencies.utils

* 🎨 Remove isort combine_as_imports, keep black profile

* 🔧 Update isort config, use pyproject.toml, Black profile

* 🔧 Update format scripts to use explicit directories to format

otherwise it would try to format venv env directories, I have several with different Python versions

* 🎨 Format NoSQL tutorial after re-sorting imports

* 🎨 Fix format for __init__.py

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-07-09 20:06:12 +02:00
Sebastián Ramírez 5984233223
🐛 Fix Enum handling with their own schema definitions (#1463)
* 🐛 Fix extra support for enum with its own schema

*  Fix/update test for enum with its own schema

* 🐛 Fix type declarations

* 🔧 Update format and lint scripts to support locally installed Pydantic and Starlette

* 🐛 Add temporary type ignores while enum schemas are merged
2020-05-23 18:56:18 +02:00
Sebastián Ramírez e4f0947821
Allow Unicode in MkDocs for translations instead of escaped chars (#1419) 2020-05-16 15:17:24 +02:00
Sebastián Ramírez 483bce3ae1
⬆️ Upgrade to MkDocs Material 5 and update docs scripts (#1225)
* ⬆️ Upgrade mkdocs.yml configs for MkDocs Material 5

*  Update docs.py to always update mkdocs.yml

* 🌐 Update mkdocs.yml for translations

* 🔧 Update MkDocs config

*  Add tabs for alternative options

* ⬆️ Update termynal setup with new CSS classes

* 🔧 Sync / Update mkdocs.yml for languages
2020-04-08 06:25:01 +02:00