Coder Social home page Coder Social logo

inveniosoftware / cookiecutter-invenio-datamodel Goto Github PK

View Code? Open in Web Editor NEW
2.0 90.0 12.0 77 KB

Cookiecutter template for an Invenio data model.

License: MIT License

Shell 3.83% Python 56.79% Makefile 17.36% Batchfile 17.30% HTML 3.99% Smarty 0.73%

cookiecutter-invenio-datamodel's Introduction

Cookiecutter-Invenio-Datamodel

image

image

image

image

This Cookiecutter template is designed to help you to bootstrap the data model for an Invenio service.

Quickstart

Install the latest Cookiecutter if you haven't installed it yet:

pip install -U cookiecutter

Generate your Invenio datamodel:

cookiecutter https://github.com/inveniosoftware/cookiecutter-invenio-datamodel.git

Features

  • Python package: Python package for your service.
  • Boilerplate files: README including important badges, AUTHORS and CHANGES files.
  • License: MIT file and headers.
  • Installation: Installation script written as setup.py and a requirements calculator for different levels (min, pypi).
  • Tests: Testing setup using pytest.
  • Documentation: Documentation generator using Sphinx. Also includes all files required for Read the Docs. Mocking module to simulate not-installed requirements for faster documentation building.
  • Continuous integration: Support for Travis which tests all requirement levels and adds coverage tests using Coveralls.
  • Your toolchain: Ignores a decent set of files when working with Git and Docker. Gets your editor to adapt project guidelines by providing an EditorConfig file.

Configuration

To generate correct files, please provide the following input to Cookiecutter:

project_name Full project name, might contain spaces.

project_shortname

Project shortname, no spaces allowed, use - as a separator.

package_name

Package/Module name for Python, must follow PEP 0008.

github_repo

GitHub repository of the project in form of USER/REPO, not the full GitHub URL.

description

A short description of the functionality of the module, its length should not extend one line.

author_name

The name of the primary author of the project, not necessarily the same as the copyright holder.

author_email E-Mail address of the primary author.
year Current year.

copyright_holder

Name of the person or organization who acts as the copyright holder of this project.

elasticsearch_version

The version of ElasticSearch you are planning to use. Versions 5.x (v5) and 6.x (v6) supported at the moment.

extension_class

Name of the class that will be exported as setuptools entrypoint and loaded by invenio main app.

config_prefix

Prefix for the configuration keys that the main app will use for this extension.

Further documentation is available on https://cookiecutter-invenio-datamodel.readthedocs.io/

cookiecutter-invenio-datamodel's People

Contributors

chiarabi avatar dinosk avatar egabancho avatar fenekku avatar lnielsen avatar slint avatar switowski avatar tiborsimko avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cookiecutter-invenio-datamodel's Issues

python 3.6 support

When you run the bootstrap script with python 3.6 you get

...
gyp ERR! configure error
gyp ERR! stack Error: Python executable "/Users/lnielsen/envs/my-site/bin/python" is v3.6.4, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.
...\

The problem have been reported before, but not solved as far as I know. Any chance we could get it fixed, so that instructions works for Python 3.6 as well as 3.5

mappings: incorrect PID field type

The PID name field in the ES mapping should be of type keyword.

On a separate note, I guess the bigger issue that a lot of people might come across, is that their marshmallow schema or JSONSchema might change, but they'll forget to update the mapping (or like in this case, they'll have an incorrect mapping). It would be nice to have something which cross-validates the Marshmallow/JSON/ES schemas...

config: add REST API search facets

RECORDS_REST_FACETS, RECORDS_REST_SORT_OPTIONS, RECORDS_REST_DEFAULT_SORT and possibly other configuration variables that apply on the datamodel level should be included in config.py and added via an update in init_config.

This might require some changes in invenio-records-rest as well (investigation needed)

Add missing project files

Similar to inveniosoftware/cookiecutter-invenio-module we need:

.editorconfig
.gitignore
.travis.yml
AUTHORS.rst
LICENSE
README.rst
cookiecutter.json
docs
hooks
run-tests.sh

config: auto install API endpoints

Something like:

# ext.py
def init_config(self, app):
    for k in dir(config):
        if k.startswith('<CFGPREFIX>_'):
            app.config[k] = getattr(config, k)
        elif k == 'RECORDS_REST_ENDPOINTS' \
                    and app.config.get('<CFGPREFIX>_ENDPOINTS_ENABLED', True):
                app.config['RECORDS_REST_ENDPOINTS'].update(getattr(config, k))
# config.py
<CFGPREFIX>_ENDPOINTS_ENABLED

RECORDS_REST_ENDPOINTS = {
    .... # note: name changed (no prefix)
}

Probably the same should happen with Records-UI

This way 1) by default we add the data models endpoints to the configuration and 2) a user can switch them off if they like to change something.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.