-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
init branch + add template usable with cookie-cutter
- Loading branch information
1 parent
fb9bde9
commit a6e0cfa
Showing
28 changed files
with
516 additions
and
0 deletions.
There are no files selected for viewing
160 changes: 160 additions & 0 deletions
160
contrib/examples/submodule_modulator_template/.gitignore
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,160 @@ | ||
# 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 | ||
|
||
# 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 | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# pytype static type analyzer | ||
.pytype/ | ||
|
||
# Cython debug symbols | ||
cython_debug/ | ||
|
||
# PyCharm | ||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can | ||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore | ||
# and can be added to the global gitignore or merged into this file. For a more nuclear | ||
# option (not recommended) you can uncomment the following to ignore the entire idea folder. | ||
#.idea/ |
13 changes: 13 additions & 0 deletions
13
contrib/examples/submodule_modulator_template/cookiecutter.json
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,13 @@ | ||
{ | ||
"project_name": "Minimum template for Modulator submodule", | ||
"project_slug": "{{ cookiecutter.project_name.lower().replace(' ', '_') }}", | ||
"project_description":"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.", | ||
"module_name":"m_test", | ||
"module_desc":"Module de test", | ||
"module_picto": "fa-road", | ||
"active_frontend":true, | ||
"db_schema_name":"pr_test", | ||
"author": "Anonymous", | ||
"author_email": "[email protected]", | ||
"version":"0.0.1" | ||
} |
16 changes: 16 additions & 0 deletions
16
...examples/submodule_modulator_template/{{ cookiecutter.project_slug }}/README.md
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 @@ | ||
# {{cookiecutter.project_name}} | ||
|
||
{{cookiecutter.project_description}} | ||
|
||
## Setup | ||
|
||
Be sure to have `gn_modulator` installed in your Geonature instance. If not, refer to [https://github.com/PnX-SI/gn_modulator](https://github.com/PnX-SI/gn_modulator). | ||
|
||
To install {{cookiecutter.module_name}}, run the following command. | ||
|
||
```shell | ||
source <pathtogeonature>/backend/venv/bin/activate | ||
geonature modulator install -p {{cookiecutter.module_name}} | ||
``` | ||
|
||
**Reminder** As every module in GeoNature, be sure that your user(s) have necessary permissions to access your module. |
1 change: 1 addition & 0 deletions
1
contrib/examples/submodule_modulator_template/{{ cookiecutter.project_slug }}/VERSION
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 @@ | ||
{{cookiecutter.version}} |
2 changes: 2 additions & 0 deletions
2
...template/{{ cookiecutter.project_slug }}/backend/{{cookiecutter.module_name}}/__init__.py
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,2 @@ | ||
MODULE_CODE = "{{cookiecutter.module_name}}" | ||
MODULE_PICTO = "{{cookiecutter.module_picto}}" |
4 changes: 4 additions & 0 deletions
4
...emplate/{{ cookiecutter.project_slug }}/backend/{{cookiecutter.module_name}}/blueprint.py
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 @@ | ||
from flask import Blueprint | ||
from m_test import MODULE_CODE | ||
|
||
blueprint = Blueprint(MODULE_CODE.lower(), __name__) |
5 changes: 5 additions & 0 deletions
5
.../{{ cookiecutter.project_slug }}/backend/{{cookiecutter.module_name}}/conf_schema_toml.py
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,5 @@ | ||
from marshmallow import Schema | ||
|
||
|
||
class GnModuleSchemaConf(Schema): | ||
pass |
Empty file.
Empty file.
Empty file.
40 changes: 40 additions & 0 deletions
40
...}}/backend/{{cookiecutter.module_name}}/migrations/versions/dfsdgf45sdf1_create_tables.py
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,40 @@ | ||
"""init sous-module m_test | ||
Revision ID: dfsdgf45sdf1 | ||
Create Date: 2023-02-01 12:48:24.613956 | ||
""" | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "dfsdgf45sdf1"# TODO : Change it !!! | ||
down_revision = None | ||
branch_labels = "{{cookiecutter.module_name}}" | ||
depends_on = "modulator" | ||
|
||
|
||
def upgrade(): | ||
op.execute("create schema {{cookiecutter.db_schema_name}}") | ||
op.create_table( | ||
"author", | ||
sa.Column("id_author", sa.Integer, primary_key=True), | ||
sa.Column("first_name", sa.String), | ||
sa.Column("last_name", sa.String), | ||
sa.Column("email_address", sa.String), | ||
schema="{{cookiecutter.db_schema_name}}", | ||
) | ||
op.create_table( | ||
"post", | ||
sa.Column("id_post", sa.Integer, primary_key=True), | ||
sa.Column("post_title", sa.String), | ||
sa.Column("post_content", sa.String), | ||
sa.Column("id_author", sa.Integer, sa.ForeignKey("{{cookiecutter.db_schema_name}}.author.id_author")), | ||
schema="{{cookiecutter.db_schema_name}}", | ||
) | ||
|
||
|
||
def downgrade(): | ||
op.drop_table("post", schema="{{cookiecutter.db_schema_name}}") | ||
op.drop_table("author", schema="{{cookiecutter.db_schema_name}}") | ||
op.execute("drop schema {{cookiecutter.db_schema_name}}") |
23 changes: 23 additions & 0 deletions
23
...r_template/{{ cookiecutter.project_slug }}/backend/{{cookiecutter.module_name}}/models.py
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,23 @@ | ||
from geonature.utils.env import db | ||
|
||
class Author(db.Model): | ||
___tablename__ = "author" | ||
__table_args__ = {"schema": "{{cookiecutter.db_schema_name}}"} | ||
id_author = db.Column(db.Integer, primary_key=True) | ||
first_name = db.Column(db.String) | ||
last_name = db.Column(db.String) | ||
email_address = db.Column(db.String) | ||
posts = db.relationship("Post", back_populates="author") | ||
|
||
|
||
class Post(db.Model): | ||
___tablename__ = "post" | ||
__table_args__ = {"schema": "{{cookiecutter.db_schema_name}}"} | ||
|
||
id_post = db.Column(db.Integer, primary_key=True) | ||
post_title = db.Column(db.String) | ||
post_content = db.Column(db.String) | ||
id_author = db.Column( | ||
db.Integer, db.ForeignKey("{{cookiecutter.db_schema_name}}.author.id_author"), nullable=False | ||
) | ||
author = db.relationship(Author, back_populates="posts") |
Empty file.
Empty file.
22 changes: 22 additions & 0 deletions
22
...ecutter.project_slug }}/config/definitions/{{cookiecutter.module_name}}.author.schema.yml
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,22 @@ | ||
type: schema | ||
code: {{cookiecutter.module_name}}.author | ||
title: schema auteur | ||
description: Définition du schema pour les auteurs liés aux posts | ||
meta: | ||
model: {{cookiecutter.module_name}}.models.Author | ||
module_code: {{cookiecutter.module_name}} | ||
genre: M | ||
label: Auteur | ||
label_field_name: first_name | ||
unique: | ||
- email_address | ||
sql_processing: true | ||
properties: | ||
id_author: | ||
title: ID auteur | ||
first_name: | ||
title: Prénom | ||
last_name: | ||
title: Nom de Famille | ||
email_address: | ||
title: "Adresse E-Mail" |
20 changes: 20 additions & 0 deletions
20
...kiecutter.project_slug }}/config/definitions/{{cookiecutter.module_name}}.post.schema.yml
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 @@ | ||
type: schema | ||
code: {{cookiecutter.module_name}}.post | ||
title: schema acteur site | ||
description: Définition du schema pour les acteurs liés aux sites | ||
meta: | ||
model: {{cookiecutter.module_name}}.models.Post | ||
module_code: {{cookiecutter.module_name}} | ||
genre: M | ||
label: Post | ||
label_field_name: post_title | ||
unique: | ||
- id_post | ||
sql_processing: true | ||
properties: | ||
id_post: | ||
title: ID post | ||
post_title: | ||
title: Titre | ||
post_content: | ||
title: Contenu |
15 changes: 15 additions & 0 deletions
15
...ecutter.project_slug }}/config/features/{{cookiecutter.module_name}}.fake_author.data.yml
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,15 @@ | ||
type: data | ||
code: {{cookiecutter.module_name}}.fake_author | ||
title: Données de remplissages | ||
description: Ajout d'auteurs bidons | ||
items: | ||
- schema_code: {{cookiecutter.module_name}}.author | ||
defaults: | ||
id_module: {{cookiecutter.module_name}} | ||
keys: [first_name, last_name, email_address] | ||
items: | ||
- [Bob, "Fokes", "[email protected]"] | ||
- [Anne, "Onyme", "[email protected]"] | ||
- [Jean, "Peste", "[email protected]"] | ||
- [Felicia, "A", "[email protected]"] | ||
- [Fernando, "Zorro", "[email protected]"] |
16 changes: 16 additions & 0 deletions
16
...kiecutter.project_slug }}/config/features/{{cookiecutter.module_name}}.fake_post.data.yml
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 @@ | ||
type: data | ||
code: m_test.fake_post | ||
title: Données de remplissages | ||
description: Ajout de posts bidons | ||
items: | ||
- schema_code: m_test.post | ||
defaults: | ||
id_module: m_test | ||
keys: [post_title, post_content, id_author] | ||
items: | ||
- ["Un raton laveur au lavoir", "lorem ipsum", "[email protected]"] | ||
- ["La rondeur du mystère", "lorem ipsum", "[email protected]"] | ||
- ["La peur de l'erreur: Il hésite", "lorem ipsum", "[email protected]"] | ||
- ["Le festin d'un volcan : un gout de brulé", "lorem ipsum", "[email protected]"] | ||
- ["L'entreprise de minuit : sonnez les cloches", "lorem ipsum", "[email protected]"] | ||
- ["Les derniers mots des fourmis: Oh un Pied !", "lorem ipsum", "[email protected]"] |
15 changes: 15 additions & 0 deletions
15
...ecutter.project_slug }}/config/features/{{cookiecutter.module_name}}.permissions.data.yml
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,15 @@ | ||
type: data | ||
code: m_test.permissions | ||
title: Data permissions m_test | ||
description: Permissions disponibles pour le module m_test | ||
items: | ||
- schema_code: perm.perm_dispo | ||
defaults: | ||
id_module: m_test | ||
keys: [id_object, id_action, scope_filter, label] | ||
items: | ||
- [ALL, C, true, "Créer et importer des posts/auteurs"] | ||
- [ALL, R, true, "Voir les posts/auteurs"] | ||
- [ALL, U, true, "Modifier les posts/auteurs"] | ||
- [ALL, D, true, "Supprimer des posts/auteurs"] | ||
- [ALL, E, true, "Exporter les posts/auteurs"] |
28 changes: 28 additions & 0 deletions
28
...cutter.project_slug }}/config/layouts/{{cookiecutter.module_name}}.author_list.layout.yml
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,28 @@ | ||
type: layout | ||
code: m_test.author_list | ||
title: Layout site list | ||
description: Layout pour la liste de auteurs | ||
|
||
layout: | ||
height_auto: true | ||
items: | ||
- type: section | ||
title: test | ||
items: | ||
- type: message | ||
html: <b>hello word</b> | ||
- type: object | ||
object_code: author | ||
items: | ||
type: form | ||
title: "ddd" | ||
items: | ||
- overflow: true | ||
items: [last_name, first_name, email_address] | ||
- code: utils.buttons_form | ||
- object_code: author | ||
label: "TEST" | ||
items: | ||
- type: object | ||
display: table | ||
items: [last_name, first_name, email_address] |
Oops, something went wrong.