cookiecutter-tutor-plugin scaffolding
This commit is contained in:
commit
6e22e88f9b
7
.gitignore
vendored
Normal file
7
.gitignore
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
.*.swp
|
||||
!.gitignore
|
||||
TODO
|
||||
__pycache__
|
||||
*.egg-info/
|
||||
/build/
|
||||
/dist/
|
||||
2
MANIFEST.in
Normal file
2
MANIFEST.in
Normal file
@ -0,0 +1,2 @@
|
||||
recursive-include tutorcredentials/patches *
|
||||
recursive-include tutorcredentials/templates *
|
||||
22
README.rst
Normal file
22
README.rst
Normal file
@ -0,0 +1,22 @@
|
||||
credentials plugin for `Tutor <https://docs.tutor.overhang.io>`__
|
||||
===================================================================================
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
::
|
||||
|
||||
pip install git+https://github.com/lpm0073/tutor-contrib-credentials
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
::
|
||||
|
||||
tutor plugins enable credentials
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
This software is licensed under the terms of the AGPLv3.
|
||||
59
setup.py
Normal file
59
setup.py
Normal file
@ -0,0 +1,59 @@
|
||||
import io
|
||||
import os
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
HERE = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
|
||||
def load_readme():
|
||||
with io.open(os.path.join(HERE, "README.rst"), "rt", encoding="utf8") as f:
|
||||
return f.read()
|
||||
|
||||
|
||||
def load_about():
|
||||
about = {}
|
||||
with io.open(
|
||||
os.path.join(HERE, "tutorcredentials", "__about__.py"),
|
||||
"rt",
|
||||
encoding="utf-8",
|
||||
) as f:
|
||||
exec(f.read(), about) # pylint: disable=exec-used
|
||||
return about
|
||||
|
||||
|
||||
ABOUT = load_about()
|
||||
|
||||
|
||||
setup(
|
||||
name="tutor-contrib-credentials",
|
||||
version=ABOUT["__version__"],
|
||||
url="https://github.com/lpm0073/tutor-contrib-credentials",
|
||||
project_urls={
|
||||
"Code": "https://github.com/lpm0073/tutor-contrib-credentials",
|
||||
"Issue tracker": "https://github.com/lpm0073/tutor-contrib-credentials/issues",
|
||||
},
|
||||
license="AGPLv3",
|
||||
author="Lawrence McDaniel",
|
||||
description="credentials plugin for Tutor",
|
||||
long_description=load_readme(),
|
||||
packages=find_packages(exclude=["tests*"]),
|
||||
include_package_data=True,
|
||||
python_requires=">=3.7",
|
||||
install_requires=["tutor"],
|
||||
entry_points={
|
||||
"tutor.plugin.v1": [
|
||||
"credentials = tutorcredentials.plugin"
|
||||
]
|
||||
},
|
||||
classifiers=[
|
||||
"Development Status :: 3 - Alpha",
|
||||
"Intended Audience :: Developers",
|
||||
"License :: OSI Approved :: GNU Affero General Public License v3",
|
||||
"Operating System :: OS Independent",
|
||||
"Programming Language :: Python",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
],
|
||||
)
|
||||
1
tutorcredentials/__about__.py
Normal file
1
tutorcredentials/__about__.py
Normal file
@ -0,0 +1 @@
|
||||
__version__ = "0.1.0"
|
||||
0
tutorcredentials/__init__.py
Normal file
0
tutorcredentials/__init__.py
Normal file
0
tutorcredentials/patches/.gitignore
vendored
Normal file
0
tutorcredentials/patches/.gitignore
vendored
Normal file
89
tutorcredentials/plugin.py
Normal file
89
tutorcredentials/plugin.py
Normal file
@ -0,0 +1,89 @@
|
||||
from glob import glob
|
||||
import os
|
||||
import pkg_resources
|
||||
|
||||
from tutor import hooks
|
||||
|
||||
from .__about__ import __version__
|
||||
|
||||
|
||||
################# Configuration
|
||||
config = {
|
||||
# Add here your new settings
|
||||
"defaults": {
|
||||
"VERSION": __version__,
|
||||
},
|
||||
# Add here settings that don't have a reasonable default for all users. For
|
||||
# instance: passwords, secret keys, etc.
|
||||
"unique": {
|
||||
# "SECRET_KEY": "\{\{ 24|random_string \}\}",
|
||||
},
|
||||
# Danger zone! Add here values to override settings from Tutor core or other plugins.
|
||||
"overrides": {
|
||||
# "PLATFORM_NAME": "My platform",
|
||||
},
|
||||
}
|
||||
|
||||
################# Initialization tasks
|
||||
# To run the script from templates/credentials/tasks/myservice/init, add:
|
||||
# hooks.Filters.COMMANDS_INIT.add_item((
|
||||
# "myservice",
|
||||
# ("credentials", "tasks", "myservice", "init"),
|
||||
# ))
|
||||
|
||||
################# Docker image management
|
||||
# To build an image with `tutor images build myimage`, add a Dockerfile to templates/credentials/build/myimage and write:
|
||||
# hooks.Filters.IMAGES_BUILD.add_item((
|
||||
# "myimage",
|
||||
# ("plugins", "credentials", "build", "myimage"),
|
||||
# "docker.io/myimage:\{\{ CREDENTIALS_VERSION \}\}",
|
||||
# (),
|
||||
# )
|
||||
# To pull/push an image with `tutor images pull myimage` and `tutor images push myimage`, write:
|
||||
# hooks.Filters.IMAGES_PULL.add_item((
|
||||
# "myimage",
|
||||
# "docker.io/myimage:\{\{ CREDENTIALS_VERSION \}\}",
|
||||
# )
|
||||
# hooks.Filters.IMAGES_PUSH.add_item((
|
||||
# "myimage",
|
||||
# "docker.io/myimage:\{\{ CREDENTIALS_VERSION \}\}",
|
||||
# )
|
||||
|
||||
|
||||
################# You don't really have to bother about what's below this line,
|
||||
################# except maybe for educational purposes :)
|
||||
|
||||
# Plugin templates
|
||||
hooks.Filters.ENV_TEMPLATE_ROOTS.add_item(
|
||||
pkg_resources.resource_filename("tutorcredentials", "templates")
|
||||
)
|
||||
hooks.Filters.ENV_TEMPLATE_TARGETS.add_items(
|
||||
[
|
||||
("credentials/build", "plugins"),
|
||||
("credentials/apps", "plugins"),
|
||||
],
|
||||
)
|
||||
# Load all patches from the "patches" folder
|
||||
for path in glob(
|
||||
os.path.join(
|
||||
pkg_resources.resource_filename("tutorcredentials", "patches"),
|
||||
"*",
|
||||
)
|
||||
):
|
||||
with open(path, encoding="utf-8") as patch_file:
|
||||
hooks.Filters.ENV_PATCHES.add_item((os.path.basename(path), patch_file.read()))
|
||||
|
||||
# Load all configuration entries
|
||||
hooks.Filters.CONFIG_DEFAULTS.add_items(
|
||||
[
|
||||
(f"CREDENTIALS_{key}", value)
|
||||
for key, value in config["defaults"].items()
|
||||
]
|
||||
)
|
||||
hooks.Filters.CONFIG_UNIQUE.add_items(
|
||||
[
|
||||
(f"CREDENTIALS_{key}", value)
|
||||
for key, value in config["unique"].items()
|
||||
]
|
||||
)
|
||||
hooks.Filters.CONFIG_OVERRIDES.add_items(list(config["overrides"].items()))
|
||||
0
tutorcredentials/templates/credentials/apps/.gitignore
vendored
Normal file
0
tutorcredentials/templates/credentials/apps/.gitignore
vendored
Normal file
0
tutorcredentials/templates/credentials/build/.gitignore
vendored
Normal file
0
tutorcredentials/templates/credentials/build/.gitignore
vendored
Normal file
0
tutorcredentials/templates/credentials/tasks/.gitignore
vendored
Normal file
0
tutorcredentials/templates/credentials/tasks/.gitignore
vendored
Normal file
Loading…
x
Reference in New Issue
Block a user