This repository has been archived by the owner on Oct 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Chris Proof of Principle #3
Draft
chrisjsewell
wants to merge
20
commits into
master
Choose a base branch
from
chris-branch
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
4e66943
Add story for exploring a database and querying
ramirezfranciscof 95c80a7
Intermediate data save
ramirezfranciscof b09098b
First finished draft
ramirezfranciscof 7275598
Giovanni's first review
giovannipizzi 8a78577
Minor corrections + renaming of repo
ramirezfranciscof 9f7746d
Fix wrong newline
giovannipizzi f151b28
Add initial documentatio
chrisjsewell bb94f08
Update aiida-crystal17.ipynb
chrisjsewell 9ba2572
update
chrisjsewell 1c28b41
update rtd environment
chrisjsewell d5856a9
Update conf.py
chrisjsewell 827def8
Update conf.py
chrisjsewell 7f709c8
Update conf.py
chrisjsewell cdb2d4d
Update conf.py
chrisjsewell 22e26a1
Update conf.py
chrisjsewell 8996527
Update conf.py
chrisjsewell 15873af
Update conf.py
chrisjsewell e1c48c8
Update conf.py
chrisjsewell 77515d2
Update conf.py
chrisjsewell d7ba97f
Update conf.py
chrisjsewell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.tox | ||
.vscode | ||
_build | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
version: 2 | ||
|
||
conda: | ||
environment: environment.yml | ||
|
||
sphinx: | ||
builder: html | ||
fail_on_warning: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line, and also | ||
# from the environment for the first two. | ||
SPHINXOPTS ?= | ||
SPHINXBUILD ?= sphinx-build | ||
SOURCEDIR = source | ||
BUILDDIR = build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
# aiida-singledocs | ||
# aiida-blog | ||
|
||
Single page or other short miscelaneous documentation | ||
|
||
|
||
### To Do: | ||
|
||
* Autoinstall sphinx... |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
# Configuration file for the Sphinx documentation builder. | ||
# | ||
|
||
# -- Project information ----------------------------------------------------- | ||
|
||
project = "aiida-singledocs" | ||
copyright = "2020, Francisco Ramirez" | ||
author = "Francisco Ramirez, Chris Sewell" | ||
|
||
|
||
version = "0.0.1" | ||
release = version | ||
|
||
# -- General configuration --------------------------------------------------- | ||
|
||
needs_sphinx = "2.0" | ||
extensions = ["myst_nb", "sphinx_panels", "ablog", "sphinx.ext.intersphinx"] | ||
|
||
myst_admonition_enable = True | ||
myst_html_img_enable = True | ||
jupyter_execute_notebooks = "auto" | ||
|
||
blog_path = "stories/index" | ||
blog_title = "Stories" | ||
blog_post_pattern = ["stories/*.md", "stories/*.ipynb"] | ||
post_redirect_refresh = 1 | ||
post_auto_excerpt = 2 | ||
post_auto_image = 1 | ||
fontawesome_included = True | ||
html_sidebars = { | ||
"stories/index": ["tagcloud.html", "archives.html", "sbt-sidebar-nav.html"], | ||
"stories/*": [ | ||
"sidebar-search-bs.html", | ||
"postcard.html", | ||
"recentposts.html", | ||
"tagcloud.html", | ||
"categories.html", | ||
"archives.html", | ||
"sbt-sidebar-nav.html", | ||
"sbt-sidebar-footer.html", | ||
], | ||
} | ||
|
||
intersphinx_mapping = { | ||
"aiida": ("http://aiida-core.readthedocs.io/en/latest/", None), | ||
} | ||
|
||
# The master toctree document. | ||
master_doc = "index" | ||
|
||
# List of patterns, relative to source directory, that match files and | ||
# directories to ignore when looking for source files. | ||
# This pattern also affects html_static_path and html_extra_path . | ||
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] | ||
|
||
# The name of the Pygments (syntax highlighting) style to use. | ||
pygments_style = "sphinx" | ||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
|
||
html_theme = "sphinx_book_theme" | ||
# html_title = f"version: {version}" | ||
# html_favicon = "_static/quantum-mobile-v4-text-square.png" | ||
# html_logo = "_static/quantum_mobile_text_wide.png" | ||
html_theme_options = { | ||
"home_page_in_toc": True, | ||
"repository_url": "https://github.com/aiidateam/aiida-blog", | ||
"repository_branch": "chris-branch", | ||
"use_repository_button": True, | ||
"use_issues_button": True, | ||
"path_to_docs": "docs", | ||
"use_edit_page_button": True, | ||
"launch_buttons": { | ||
"binderhub_url": "https://https://mybinder.org" | ||
}, | ||
} | ||
panels_add_bootstrap_css = False | ||
|
||
|
||
def start_aiida(*args): | ||
from unittest import mock | ||
import os | ||
import subprocess | ||
|
||
subprocess.check_call(["reentry", "scan"]) | ||
from aiida.manage.external import postgres | ||
from aiida.manage.tests import _GLOBAL_TEST_MANAGER, BACKEND_DJANGO | ||
from aiida.common.utils import Capturing | ||
# this is required on READTHEDOCS, since the docker container only contains C.UTF-8 | ||
patch = mock.patch.object( | ||
postgres, | ||
"_CREATE_DB_COMMAND", | ||
( | ||
'CREATE DATABASE "{}" OWNER "{}" ENCODING \'UTF8\' ' | ||
f"LC_COLLATE='{os.environ['LANG']}' LC_CTYPE='{os.environ['LANG']}' " | ||
"TEMPLATE=template0" | ||
), | ||
) | ||
|
||
with Capturing(): # capture output of AiiDA DB setup | ||
with patch: | ||
_GLOBAL_TEST_MANAGER.use_temporary_profile(backend=BACKEND_DJANGO, pgtest=None) | ||
from aiida.manage.configuration import settings | ||
|
||
os.environ["AIIDA_PATH"] = settings.AIIDA_CONFIG_FOLDER | ||
|
||
|
||
def end_aiida(*args): | ||
from aiida.manage.tests import _GLOBAL_TEST_MANAGER | ||
|
||
_GLOBAL_TEST_MANAGER.destroy_all() | ||
|
||
|
||
def setup(app): | ||
app.connect("builder-inited", start_aiida) | ||
app.connect("build-finished", end_aiida) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Welcome to AiiDA Stories | ||
|
||
This site contains a collection of stories inspired in real life situations and use-cases of AiiDA. | ||
You can use these stories to get a general feeling of what can be done with the code and what is like to work with it, as well as taking the procedures in them as templates for when you need to perform similar tasks. | ||
|
||
Each story will specify at the beginning which version of the [Quantum Mobile](https://www.materialscloud.org/work/quantum-mobile) was used in its design/tests. | ||
|
||
Using the correct virtual machine and creating a new profile that starts from a clean database (see the ``quicksetup`` command in the[`AiiDA documentation](https://aiida.readthedocs.io/projects/aiida-core/en/latest/intro/get_started.html#initialise-data-storage)) ensures the reproducibility of the commands if you want to test them out yourself. | ||
|
||
Any other further set-ups required (such as importing databases) will be described in the introduction of the story. | ||
|
||
```{toctree} | ||
:maxdepth: 1 | ||
|
||
Stories <./stories/index> | ||
``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sphuber, quick question, is there a specific reason that
_CREATE_DB_COMMAND
is hard-coded toen_US.UTF-8
. As commented, It's the only sticking point I had on getting this to work on RTD.I'm planning to turn this into a small sphinx-extension,
so would probably want to make a PR to aiida-core, to change this in some way, to avoid this patch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we applied this to have some consistency for the databases that are created by AiiDA, but I was not very close involved in that decision. This was mostly done between @giovannipizzi and @szoupanos if I remember correctly. If I understand correctly, you would apply the same change in
aiida-core
? Instead of hard coding utf-8 as encoding, use whatever is set byos.enivron['LANG']
. I am not sure what the consequences of this would be.What is the exact reason why having utf-8 fails for your use case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No probably just something like
os.environ.get("AIIDA_DB_ENCODING", "en_US.UTF-8")
, so nothing would change unless specified.The RTD docker container does not set up
en_US.UTF-8
or installlocale
. So I don't think there is any way to add it at run time.https://github.com/readthedocs/readthedocs-docker-images/blob/master/Dockerfile