Skip to content

Commit

Permalink
Merge pull request #28 from octue/doc-build
Browse files Browse the repository at this point in the history
Fix documentation builds
  • Loading branch information
thclark authored Jan 22, 2024
2 parents 2b688f9 + 29a3b52 commit 049f248
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 66 deletions.
78 changes: 36 additions & 42 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,57 +10,52 @@
"customizations": {
"vscode": {
"settings": {
"austin.mode": "Wall time",
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "always",
"source.fixAll": "always"
}
},
"black-formatter.args": ["--line-length", "120"],
"black-formatter.importStrategy": "fromEnvironment",
"isort.args": ["--profile", "black"],
"isort.importStrategy": "fromEnvironment",
"austin.mode": "Wall time",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"esbonio.server.enabled": true,
"esbonio.sphinx.confDir": "${workspaceFolder}/docs/source",
"jupyter.widgetScriptSources": ["jsdelivr.com", "unpkg.com"],
"prettier.prettierPath": "/usr/local/prettier",
"python.defaultInterpreterPath": "/usr/local/bin/python",
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
"python.formatting.provider": "black",
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
"python.languageServer": "Pylance",
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
"python.linting.enabled": true,
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
// Disabling specific messages:
// Line length to match black settings
// Disable specific messages:
// - To find the details do: /usr/local/py-utils/bin/pylint --list-msgs
// - Disable missing-module-docstring (C0114) because we don't document modules routinely, just their members
// - Disable invalid-name (C0103) because pylint thinks that eg 'x', 'df', 'np' are invalid due to their lengths
"python.linting.pylintArgs": [
"pylint.args": [
"--max-line-length=120",
"--disable=missing-module-docstring,invalid-name"
],
"python.linting.pylintEnabled": true,
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint",
"python.pythonPath": "/usr/local/bin/python",
"python.testing.pytestArgs": [
"--cov=django_svelte_jsoneditor",
"--cov-report=xml:cov.xml"
"--disable=missing-module-docstring,invalid-name",
"--load-plugins=pylint_django"
],
// Scrolling the editor is a nice idea but it doesn't work, always out of sync and impossible to manage
"restructuredtext.preview.scrollEditorWithPreview": false,
"restructuredtext.preview.scrollPreviewWithEditor": false,
"restructuredtext.linter.doc8.extraArgs": ["--max-line-length 180"],
"terminal.integrated.defaultProfile.linux": "zsh"
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"terminal.integrated.defaultProfile.linux": "zsh",
// Handle this: https://github.com/microsoft/vscode-python/issues/693
"python.testing.pytestArgs": ["--no-cov"]
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"[email protected]",
"erikphansen.vscode-toggle-column-selection",
"esbenp.prettier-vscode",
"GitHub.copilot",
"GitHub.copilot-chat",
"github.vscode-github-actions",
"irongeek.vscode-env",
"me-dutour-mathieu.vscode-github-actions",
"mikestead.dotenv",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-python.pylint",
"ms-python.black-formatter",
"ms-python.flake8",
"ms-python.isort",
"ms-toolsai.jupyter",
"ms-toolsai.jupyter-renderers",
"ms-toolsai.jupyter-keymap",
Expand All @@ -70,20 +65,19 @@
"shamanu4.django-intellisense",
"thebarkman.vscode-djaneiro",
"trond-snekvik.simple-rst",
"ms-azuretools.vscode-docker",
"ryanluker.vscode-coverage-gutters",
"ms-python.black-formatter",
"GitHub.copilot"
"4ops.terraform"
]
}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [80, 443, 5500, 8000],

// Use 'postCreateCommand' to run commands after the container is created.
// Note: Reverting to use pip requirements until we can install private dependencies in GHA with poetry
"postCreateCommand": ". .devcontainer/postcreate.sh",
// Use 'postAttachCommand' to run commands after the container is created and attached (ie git is available).
// This is preferential to postCreateCommand as invoking git (eg for private poetry installs or addition of
// git config preferences) doesn't override injected git configs
// https://stackoverflow.com/a/73097009/3556110
"postAttachCommand": ". .devcontainer/postattach.sh",

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",
Expand Down
36 changes: 36 additions & 0 deletions .devcontainer/postattach.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/zsh

# Install dependencies
poetry install

# Auto set up remote when pushing new branches
git config --global --add push.autoSetupRemote 1

# Allow precommit to install properly
git config --global --add safe.directory /workspace

# Install precommit hooks
pre-commit install && pre-commit install -t commit-msg

# Set zsh history location
# This is done in postAttach so it's not overridden by the oh-my-zsh devcontainer feature
#
# We leave you to decide, but if you put this into a folder that's been mapped
# into the container, then history will persist over container rebuilds :)
#
# !!!IMPORTANT!!!
# Make sure your .zsh_history file is NOT committed into your repository, as it can contain
# sensitive information. So in this case, you should add
# .devcontainer/.zsh_history
# to your .gitignore file.
export HISTFILE="/workspace/.devcontainer/.zsh_history"

# Add aliases to zshrc file
echo '# Aliases to avoid typing "python manage.py" repeatedly' >> ~/.zshrc
echo 'alias dj="python manage.py"' >> ~/.zshrc
echo 'alias djmm="python manage.py makemigrations"' >> ~/.zshrc
echo 'alias djm="python manage.py migrate"' >> ~/.zshrc
echo 'alias djr="python manage.py runserver"' >> ~/.zshrc
echo 'alias djreset="python manage.py reset_db -c"' >> ~/.zshrc
echo 'alias djs="python manage.py shell_plus"' >> ~/.zshrc
echo 'alias dju="python manage.py show_urls"' >> ~/.zshrc
10 changes: 0 additions & 10 deletions .devcontainer/postcreate.sh

This file was deleted.

19 changes: 6 additions & 13 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2
Expand All @@ -13,19 +12,13 @@ build:
# nodejs: "19"
# rust: "1.64"
# golang: "1.19"
jobs:
post_create_environment:
- pip install poetry
- poetry config virtualenvs.create false
post_install:
- poetry install

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/source/conf.py

# Optionally build your docs in additional formats such as PDF and ePub
# formats:
# - pdf
# - epub

# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: docs/requirements.txt
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "django-svelte-jsoneditor"
version = "0.4.1"
version = "0.4.2"
description = "A widget for django's JSONField using the latest-and-greatest Json Editor"
authors = ["Tom Clark <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit 049f248

Please sign in to comment.