| title | Documentation Site |
|---|---|
| slug | /readme |
This documentation site is built using Docusaurus 2, a modern static website generator.
https://docusaurus.io/docs/installation#requirements
Follow the CONTRIBUTING_CODE guide in the great_expectations repository to install dev dependencies.
Then run the following command from the repository root to install the rest of the dependencies and build documentation locally (including prior versions) and start a development server:
invoke docsOnce you've run invoke docs once, you can run invoke docs --start to start the development server without copying and building prior versions.
To enable certain features during local development, you may need to set environment variables.
- Create a
.envfile in thedocs/docusaurus/directory by copying the example file:cp docs/docusaurus/.env.example docs/docusaurus/.env
- Edit the
docs/docusaurus/.envfile and add your specific API keys or other necessary values.
This .env file is included in .gitignore and should not be committed to version control.
standard.js is used to lint the project. Please run the linter before committing changes.
invoke docs --lintTo build a static version of the site, this command generates static content into the build directory. This can be served using any static hosting service.
invoke docs --buildDeployment is handled via Netlify.
The following are a few details about other files Docusaurus uses that you may wish to be familiar with.
sidebars.js: JavaScript that specifies the sidebar/navigation used in docs pagesstatic: static assets used in docs pages (such as CSS) live heredocusaurus.config.js: the configuration file for Docusaurusbabel.config.js: Babel config file used when buildingpackage.json: dependencies and scriptsyarn.lock: dependency lock file that ensures reproducibilitysrc/: global components live heredocs/: Current version of docsversioned_docs/: Older versions of docs live here. These are copies ofdocs/from the moment whendocs invoke --version=<VERSION>was run.versioned_sidebars/: Older versions of sidebars live here. Similar toversioned_docs/
sitemap.xml is not in the repo since it is built and uploaded by a netlify plugin during the documentation build process.
This project uses Docusaurus's swizzling feature to customize theme components. Swizzling allows us to override default Docusaurus components with our own implementations.
Ejected components are fully copied into the project, giving complete control but requiring manual updates when Docusaurus upgrades.
- Status: Fully ejected
- Reason: Custom copy button behavior to exclude lines with
code-block-hide-lineclass (configured via Prism magic comments) - Modifications: The copy button filters out hidden lines when copying code blocks
- Upgrade Impact: HIGH - When upgrading Docusaurus, you must manually review and merge changes from the upstream CodeBlock component. Check the Docusaurus changelog for CodeBlock-related changes.
Wrapped components import the original via @theme-original and add custom behavior. These are safer and typically require less maintenance during upgrades.
- Status: Wrapped
- Modifications: Custom icons for different admonition types (info, note, tip, warning, caution, danger, cta)
- Upgrade Impact: LOW - Wrapper should continue working unless Admonition API changes significantly
- Status: Wrapped
- Modifications: Mobile sidebar auto-close behavior when clicking sidebar items
- Upgrade Impact: LOW - Wrapper should continue working unless DocSidebarItems API changes significantly
- Status: Wrapped
- Modifications: Currently a pass-through wrapper (may be customized in the future)
- Upgrade Impact: LOW
- Status: Wrapped
- Modifications: Currently a pass-through wrapper (may be customized in the future)
- Upgrade Impact: LOW
- Status: Wrapped
- Components:
DropdownNavbarItem,DocsVersionDropdownNavbarItem,ComponentTypes - Modifications: Custom navbar item behavior
- Upgrade Impact: LOW - Wrappers should continue working unless NavbarItem API changes significantly
- Status: Wrapped
- Modifications: Custom color mode toggle behavior
- Upgrade Impact: LOW
When upgrading Docusaurus, follow these steps:
-
Review the Changelog: Check the Docusaurus changelog for breaking changes related to swizzled components.
-
Test Wrapped Components: Wrapped components should continue working, but test them to ensure compatibility.
-
Manually Update Ejected Components:
- For CodeBlock: This is the highest priority. You'll need to:
- Compare the new Docusaurus CodeBlock implementation with our custom version
- Manually merge any improvements, bug fixes, or API changes
- Ensure our custom copy button logic (filtering hidden lines) is preserved
- Test thoroughly to ensure code blocks render and copy correctly
- For CodeBlock: This is the highest priority. You'll need to:
-
Swizzle Command Reference: To re-swizzle a component (useful for seeing what changed):
cd docs/docusaurus npm run swizzle @docusaurus/theme-classic <ComponentName> -- --danger
Note: This will show you the latest version, but don't overwrite your customizations without careful review.
-
Testing Checklist:
- Code blocks render correctly
- Copy button works and excludes hidden lines
- Admonitions display with custom icons
- Mobile sidebar behavior works
- Search functionality works
- Navbar components function correctly
- For any pages you have moved or removed, update _redirects to point from the old to the new content location
To add a new version, follow these steps:
- It may help to start with a fresh virtualenv and clone of gx.
- Make sure dev dependencies are installed
pip install -c constraints-dev.txt -e ".[test]"andpip install pyspark - Install API docs dependencies
pip install -r docs/sphinx_api_docs_source/requirements-dev-api-docs.txt - Run
invoke docs version=<MAJOR.MINOR>(substituting your new version numbers) - Commit the new files in
versioned_docs/,versioned_sidebars/and the change inversions.jsonto version control
sequenceDiagram
Participant Code
Participant SphinxBuild as temp_sphinx_api_docs_build_dir/
Participant Docusaurus as docs/docusaurus
Participant DocsBuild as docs/docusaurus/build
Participant Netlify
loop versioning
% invoke api-docs
Code ->> SphinxBuild: sphinx generated html
activate SphinxBuild
SphinxBuild ->> Docusaurus: html converted to .md and store in docs/docusaurus/docs/reference/api
deactivate SphinxBuild
Code ->> Docusaurus: yarn docusaurus docs:version
end
loop invoke docs --build
% invoke api-docs
Code ->> SphinxBuild: sphinx generated html
activate SphinxBuild
SphinxBuild ->> Docusaurus: html converted to .md and store in docs/docusaurus/docs/reference/api
deactivate SphinxBuild
% yarn docusaurus build
activate DocsBuild
Docusaurus ->> DocsBuild: build docs and versioned_*
DocsBuild ->> Netlify: Deploy
deactivate DocsBuild
end