commit 24e0a5bb21f75bc5d03ab673dc8a104de9dd7ef1 Author: Cian Hughes Date: Fri Nov 10 13:42:15 2023 +0000 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..61a6b54 --- /dev/null +++ b/.gitignore @@ -0,0 +1,159 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Ruff stuff: +.ruff_cache + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# VSCode project settings +.vscode/ + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d0fd285 --- /dev/null +++ b/LICENSE @@ -0,0 +1,7 @@ +Copyright 2023 Cian Hughes + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..bbf144e --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ + + +## + +# Research Server Documentation + +[link_test](https://i-form-node-deployer.netlify.app) + +## Usage + +# Usage \ No newline at end of file diff --git a/build.py b/build.py new file mode 100644 index 0000000..16858ba --- /dev/null +++ b/build.py @@ -0,0 +1,37 @@ +import subprocess + +import tomlkit as toml + +from scripts_config import readme_files # type: ignore + +def create_readme(): + with open("README.md", "wt") as r: + for header, file in readme_files.items(): + r.write(f"\n\n## {header}\n\n") + with open(file, "rt") as f: + r.write(f.read()) + + +def update_license(): + with open("LICENSE", "rt") as source, open("docs/license.md", "wt") as target: + target.write(source.read()) + + +def build_docs(): + print("Building docs...") + # First, ensure the license is up to date + update_license() + # Then, we build the docs + subprocess.run(["poetry", "run", "mkdocs", "build", "--clean"]) + # Finally, export the readme + print("Exporting readme...") + create_readme() + print("Finished building docs.") + + +def main(): + build_docs() + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/docs/assets/favicon.ico b/docs/assets/favicon.ico new file mode 100644 index 0000000..ca66531 Binary files /dev/null and b/docs/assets/favicon.ico differ diff --git a/docs/assets/logo.png b/docs/assets/logo.png new file mode 100644 index 0000000..2cc31c5 Binary files /dev/null and b/docs/assets/logo.png differ diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..7ec0033 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,3 @@ +# Research Server Documentation + +[link_test](https://i-form-node-deployer.netlify.app) \ No newline at end of file diff --git a/docs/license.md b/docs/license.md new file mode 100644 index 0000000..d0fd285 --- /dev/null +++ b/docs/license.md @@ -0,0 +1,7 @@ +Copyright 2023 Cian Hughes + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/docs/usage.md b/docs/usage.md new file mode 100644 index 0000000..fc56ab5 --- /dev/null +++ b/docs/usage.md @@ -0,0 +1 @@ +# Usage \ No newline at end of file diff --git a/mkdocs.yaml b/mkdocs.yaml new file mode 100644 index 0000000..c6ae7fb --- /dev/null +++ b/mkdocs.yaml @@ -0,0 +1,50 @@ +site_name: I-Form Research Server Documentation +repo_url: https://github.com/Cian-H/I-Form_Research_Server_Docs +repo_name: Cian-H/I-Form_Research_Server_Docs +edit_uri: edit/main/docs/ +docs_dir: docs +site_dir: site + +theme: + name: material + logo: assets/logo.png + favicon: assets/favicon.ico + icon: + repo: fontawesome/brands/github-alt + palette: + # Palette toggle for light mode + - scheme: default + accent: teal + toggle: + icon: material/lightbulb + name: Switch to dark mode + # Palette toggle for dark mode + - scheme: slate + accent: teal + toggle: + icon: material/lightbulb-outline + name: Switch to light mode + +nav: + - Home: index.md + - Getting Started: + - Usage: usage.md + - Reference: + # - FAQ: faq.md + # - Troubleshooting: troubleshooting.md + # - Changelog: changelog.md + - License: license.md + +extra: + version: + provider: mike + +plugins: + #TODO: Add plugins, they seem to be broken at the moment + # - material/optimize + # - material/privacy + # - material/projects + # - material/typeset + - search + # - git-revision-date-localized: + # enable_creation_date: true \ No newline at end of file diff --git a/pyproject copy.toml b/pyproject copy.toml new file mode 100644 index 0000000..416a387 --- /dev/null +++ b/pyproject copy.toml @@ -0,0 +1,30 @@ +[tool.poetry] +name = "research-server-docs" +version = "0.1.0" +description = "Documentation for the I-Form Research Server system" +authors = ["Cian Hughes "] +readme = "README.md" +license = "MIT" + +[tool.poetry.dependencies] +python = ">=3.12,<4.0" +i-form-server-node-deployer = {git = "https://github.com/Cian-H/I-Form_Server_Node_Deployer"} +mkdocs = "^1.5.3" +tomlkit = "^0.12.2" + +[tool.poetry.scripts] +build = "build:main" + +[tool.scripts-config] +node_deployer_src = "{$VIRTUAL_ENV}/src/I-Form_Server_Node_Deployer" + +[tool.scripts-config.readme_files] +"" = "docs/index.md" +"Usage" = "docs/usage.md" + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" + +[tool.black] +line-length = 100 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..17162ef --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,30 @@ +[tool.poetry] +name = "research-server-docs" +version = "0.1.0" +description = "Documentation for the I-Form Research Server system" +authors = ["Cian Hughes "] +readme = "README.md" +license = "MIT" + +[tool.poetry.dependencies] +python = ">=3.8,<4.0" +mkdocs = "^1.5.3" +mkdocs-material = "^9.4.8" +tomlkit = "^0.12.2" + +[tool.poetry.scripts] +build = "build:main" + +[tool.scripts-config] +virtual_env = "{$VIRTUAL_ENV}/src/I-Form_Server_Node_Deployer" + +[tool.scripts-config.readme_files] +"" = "docs/index.md" +"Usage" = "docs/usage.md" + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" + +[tool.black] +line-length = 100 diff --git a/scripts_config.py b/scripts_config.py new file mode 100644 index 0000000..509ae4a --- /dev/null +++ b/scripts_config.py @@ -0,0 +1,46 @@ +import os +from pathlib import Path + +import tomlkit as toml + + +VIRTUAL_ENV = Path(os.environ.get("VIRTUAL_ENV", ".venv")) + + +def insert_env_vars(split_config): + """ + Inserts environment variables into the config file + where they follow the format {$ENV_VAR_NAME} + """ + config_str = toml.dumps(split_config) + split_config = config_str.split("{$") + if len(split_config) > 1: + c_head = split_config[0] + c_tail = split_config[1:] + c_parsed_tail = [ + "".join((os.environ[x0], x1)) for x0, x1 in + ( + (y[:i], y[i+1:]) for i, y in + zip( + (z.find("}") for z in c_tail), + c_tail + ) + ) + ] + config_str = "".join((c_head, *c_parsed_tail)) + return toml.loads(config_str) + + +def parse_config(): + with open("pyproject.toml", "rt") as f: + config = toml.load(f)["tool"]["scripts-config"] + config = insert_env_vars(config) + return config + + +def init(): + config = parse_config() + globals().update(config) + + +init() \ No newline at end of file diff --git a/src/research_server_docs.py b/src/research_server_docs.py new file mode 100644 index 0000000..78c306a --- /dev/null +++ b/src/research_server_docs.py @@ -0,0 +1,3 @@ +""" +This is a dummy file so that we can use poetry as the build system for these docs. +""" \ No newline at end of file