Skip to content

Commit

Permalink
First commit, for now bootstrap a very basic Anyblok based project
Browse files Browse the repository at this point in the history
  • Loading branch information
Franck Bret committed Sep 21, 2017
0 parents commit 6bfbbf8
Show file tree
Hide file tree
Showing 15 changed files with 325 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Change Log
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

### [Unreleased][unreleased]

#### Added
- package files
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License

Copyright 2017 Franck Bret <[email protected]>.

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.
21 changes: 21 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
============================
cookiecutter-anyblok-project
============================

Bootstrap Anyblok based project

Requirements
------------

Install `cookiecutter` command line: `pip install cookiecutter`

Usage
-----

Generate a new Anyblok project template layout: `cookiecutter gh:franckbret/cookiecutter-anyblok-project`
You will be prompt with some questions to set some configuration values.

License
-------

This project is licensed under the terms of the [Mozilla Public License Version 2.0] https://www.mozilla.org/en-US/MPL/2.0/ (/LICENSE)
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.0
16 changes: 16 additions & 0 deletions cookiecutter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"project_name": "Name of the project",
"project_slug": "{{ cookiecutter.project_name.lower().replace(' ', '-') }}",
"project_short_description": "A short description of the Anyblok based project",
"release_date": "{% now 'local' %}",
"python_name": "{{ cookiecutter.project_name.lower().replace(' ', '_') }}",
"blok_name": "{{ cookiecutter.project_name.lower().replace(' ', '_') }}",
"db_driver_name": ["postgresql"],
"db_name": "{{ cookiecutter.project_name.lower().replace(' ', '_') }}",
"open_source_license": ["Mozilla Public License Version 2.0", "GNU General Public License v3", "MIT license", "BSD license", "ISC license", "Apache Software License 2.0", "Not open source"],
"version": "0.1.0",
"full_name": "Your name",
"email": "Your address email (eq. [email protected])",
"github_username": "Your github username",
"_extensions": ["jinja2_time.TimeExtension"]
}
Empty file.
14 changes: 14 additions & 0 deletions {{cookiecutter.project_slug}}/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
==========
Change Log
==========

All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

[Unreleased][unreleased]
========================

Added
-----

* package files
106 changes: 106 additions & 0 deletions {{cookiecutter.project_slug}}/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{% if cookiecutter.open_source_license == 'Mozilla Public License Version 2.0' %}
This Source Code Form is subject to the terms of the Mozilla Public License,
v. 2.0. If a copy of the MPL was not distributed with this file,You can
obtain one at http://mozilla.org/MPL/2.0/.
Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.full_name }}
{% endif %}

{% if cookiecutter.open_source_license == 'MIT license' %}
MIT License

Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.full_name }}

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.
{% elif cookiecutter.open_source_license == 'BSD license' %}
BSD License

Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.full_name }}
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.

* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
{% elif cookiecutter.open_source_license == 'ISC license' %}
ISC License

Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.full_name }}

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
{% elif cookiecutter.open_source_license == 'Apache Software License 2.0' %}
Apache Software License 2.0

Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.full_name }}

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
{% elif cookiecutter.open_source_license == 'GNU General Public License v3' %}
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

{{ cookiecutter.project_short_description }}
Copyright (C) {% now 'local', '%Y' %} {{ cookiecutter.full_name }}

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.

The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

{% endif %}
26 changes: 26 additions & 0 deletions {{cookiecutter.project_slug}}/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{% set is_open_source = cookiecutter.open_source_license != 'Not open source' -%}
{% for _ in cookiecutter.project_name %}={% endfor %}
{{ cookiecutter.project_name }}
{% for _ in cookiecutter.project_name %}={% endfor %}

{{ cookiecutter.project_short_description }}

{% if is_open_source %}
* Free software: {{ cookiecutter.open_source_license }}
* Documentation: https://{{ cookiecutter.project_slug | replace("_", "-") }}.readthedocs.io.
{% endif %}

Features
--------

* TODO

Credits
---------

.. _`Anyblok`: https://github.com/AnyBlok/AnyBlok

This `Anyblok`_ package was created with `audreyr/cookiecutter`_ and the `franckbret/cookiecutter-anyblok-project`_ project template.

.. _`franckbret/cookiecutter-anyblok-project`: https://github.com/franckbret/cookiecutter-anyblok-project
.. _`audreyr/cookiecutter`: https://github.com/audreyr/cookiecutter
1 change: 1 addition & 0 deletions {{cookiecutter.project_slug}}/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ cookiecutter.version }}
4 changes: 4 additions & 0 deletions {{cookiecutter.project_slug}}/app.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[AnyBlok]
db_name = {{ cookiecutter.project_slug }}
db_driver_name = {{ cookiecutter.db_driver_name }}
install_or_update_bloks = {{ cookiecutter.blok_name }}
70 changes: 70 additions & 0 deletions {{cookiecutter.project_slug}}/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""Setup script for {{ cookiecutter.project_slug }}"""

from setuptools import setup, find_packages

with open('README.rst') as readme_file:
readme = readme_file.read()

with open('CHANGELOG.rst') as changelog_file:
changelog = changelog_file.read()

requirements = [
'anyblok',
{% if cookiecutter.db_driver_name == 'postgresql' %}
'psycopg2'
{% endif %}
]

test_requirements = [
# TODO: put package test requirements here
]

{%- set license_classifiers = {
'MIT license': 'License :: OSI Approved :: MIT License',
'BSD license': 'License :: OSI Approved :: BSD License',
'ISC license': 'License :: OSI Approved :: ISC License (ISCL)',
'Apache Software License 2.0': 'License :: OSI Approved :: Apache Software License',
'GNU General Public License v3': 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)'
} %}

setup(
name='{{ cookiecutter.python_name }}',
version='{{ cookiecutter.version }}',
description="{{ cookiecutter.project_short_description }}",
long_description=readme + '\n\n' + changelog,
author="{{ cookiecutter.full_name.replace('\"', '\\\"') }}",
author_email='{{ cookiecutter.email }}',
url='https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}',
packages=find_packages(),

entry_points={
'bloks': [
'{{ cookiecutter.python_name }}={{ cookiecutter.python_name }}.{{ cookiecutter.blok_name }}:{{ cookiecutter.blok_name.replace('_', '').capitalize() }}'
]
},
include_package_data=True,
install_requires=requirements,
{%- if cookiecutter.open_source_license in license_classifiers %}
license="{{ cookiecutter.open_source_license }}",
{%- endif %}
zip_safe=False,
keywords='{{ cookiecutter.project_slug }}',
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Intended Audience :: Developers',
{%- if cookiecutter.open_source_license in license_classifiers %}
'{{ license_classifiers[cookiecutter.open_source_license] }}',
{%- endif %}
'Natural Language :: English',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
test_suite='tests',
tests_require=test_requirements,
)
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import os
from anyblok.blok import Blok


class {{ cookiecutter.blok_name.replace('_', '').capitalize() }}(Blok):
version = "{{ cookiecutter.version }}"
required = ['anyblok-core']

@classmethod
def import_declaration_module(cls):
from . import model # noqa

@classmethod
def reload_declaration_module(cls, reload):
from . import model # noqa
reload(model)
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#from anyblok import Declarations
#from anyblok.column import Integer, String
#
#
#Model = Declarations.Model
#
#
#@Declarations.register(Model)
#class Example():
# """ Example Model, see more column field
# http://anyblok.readthedocs.io/en/latest/MEMENTO.html#column
# """
# id = Integer(primary_key=True)
# name = String(label="Name", unique=True, nullable=False)
#
# def __str__(self):
# return ('{self.name}').format(self=self)
#
# def __repr__(self):
# msg = ('<Example: {self.name}, {self.id}>')
# return msg.format(self=self)

0 comments on commit 6bfbbf8

Please sign in to comment.