templer.core's Introduction
.. contents:: Introduction ============ This package provides the core functionality of the templer code generation system. Included are a base template class, utility scripts, the templer command-line wrapper and basic templates for basic python namespace packages and nested namespace packages. All functionality of the templer system is inherited from and extends PasteScript_ templates. Templates can be generated using the syntax of that package, but the templer system provides a wrapper script to make it easier for developers to generate packages. .. _PasteScript: http://pythonpaste.org/script/ templer script -------------- This package provides a script, ``templer``. The script acts as a wrapper for PasteScript's ``paster create``, hiding the newbie-error-prone syntax of that command. The ``templer`` script also provides some inline error-checking for project names and other variables as well as additional help. It is recommended to use this script--especially for new users--rather than using ``paster create`` directly. (The resulting packages produced, however, will be the same). For example, to create a new basic namespace package invoke the script like so:: templer basic_namespace This will prompt you to provide a name for your package. The name you provide will be validated to ensure that it fits with the number of namespaces expected by the template you have chosen. Once you have set the name for your new package, You will be asked to choose a set of questions to answer. By default, only the 'easy' questions are selected, allowing you to create a new package with a minimum of interaction. However, you may choose the ``expert`` set, or even choose to answer ``all`` questions if you need more control over the final output of your package. At any time in the question-and-answer process, you may type a ``?`` at the prompt to recieve in-line assistance with the current question. If you wish to quit the process at any time during the questions, simply enter ``q`` at the prompt. Additional Script Functions --------------------------- In addition to interactively generating code, the templer script provides a number of other useful functions: ``templer --help`` provides full listings of the help text for the templer script. ``templer --list`` provides a detailed list of the available templates ``templer --version`` provides the version number of the currently installed templer package Testing ======= This package provides both unit tests for code functions and doctests for each of the provided templates. If you make changes to the package, you must ensure that these tests run successfully before checking them in. Please also contribute tests for any code you create. To run the tests, execute the following:: $ python setup.py test Debugging template issues =========================== If you have problems to execute templates like:: Error in file /Users/mikko/code/mobilize/src/templer.plone/src/templer/plone/templates/nested_plone/setup.py_tmpl: ERROR: 'str' object has no attribute 'VFFSL' Run the templates against pure Paster to get a meaningful traceback:: [~/code/mobilize/src]% ../bin/paster create -t plone_nested plone.app.mobile Selected and implied templates: templer.core#nested_namespace A basic Python project with a nested namespace (2 dots in name) templer.plone#plone_nested A package for Plone add-ons with a nested namespace ... File "/Users/mikko/code/plone-venv/lib/python2.7/site-packages/Cheetah-2.2.1-py2.7-macosx-10.8-x86_64.egg/Cheetah/Template.py", line 997, in __str__ return getattr(self, mainMethName)() File "cheetah_DynamicallyCompiledCheetahTemplate_1345114853_72_55242.py", line 147, in respond AttributeError: 'str' object has no attribute 'VFFSL'
templer.core's People
templer.core's Issues
It's not possible to have variable in filename and that filename as template
For example locale/+project+.pot_tmpl
yields:
ERROR: [Errno 2] No such file or directory: 'path_to_file/.pot'
Templates do not preserve executable permissions
My template:
-rwxr-xr-x 1 ielectric ielectric 466 Aug 25 00:36 pre-commit-check.sh_tmpl
Generated:
-rw-r--r-- 1 ielectric ielectric 463 Aug 26 11:07 pre-commit-check.sh
Replace Cheetah template with jinja2 (or add additional support for jinja2)
Rationale:
- buildout uses ${var} configuration syntax, same as Cheetah. Using jinja2, template output is {{ var }}, making less pain to develop templates
- Cheetah is not known as Jinja2
Replacing Cheetah would mean breaking backwards compatibility with ZopeSkel templates, but bright future. Another option would to be to additionally support Jinja2.
Cheetah and PasteScript pindowns
Is there a specific reason for this?
install_requires=[
'setuptools',
paste_deploy,
"PasteScript>=1.7.2",
"Cheetah>1.0,<=2.2.1",
],
AFAIK pindowns in setup.py should be discouraged. But I know Cheetah etc. API upgrades can cause breakage.
License choice too limited.
When generating a new package, I was just trying to fill in for the license just a string
"Copyright XXX Corporation. All right reserved.", which fails with error "Not a valid value".
When working with internal development-teams of larger corporations, it's generaly not allowed to pick the copyright-license yourself, and the general default there is "All right reserved." This is about code that is normally not going to end up on Pypi, but rather in internal egg-servers.
So at least a proprietary option should be possible.
Also, the allowed options should should be printed to the user. there is a huge usability-difference between:
raise ValidationException("Not a valid value: %s. " % value)
and
raise ValidationException("Not a valid value: %s. \n Allowed values are %s " % (value, self.choices))
Use README.rst by default
Use README.rst instead of README.txt as the default filename
- Technically the extension is more correct: recognized by Github, others
- Setuptools supports README.rst nowadays
Convert all templates to use README.rst?
"bin/templer <template> --list-variables" does not work as described in "bin/templer --help".
When I run:
$ bin/templer --help
I see:
> (You can specify as many of these as you want, in name=value pairs.
> To get the list of variables that a template expects, you can ask for
> this with ``templer <template> --list-variables``).
Though, when I run:
$ bin/templer plone_basic --list-variables
I get:
plone_basic: A package for Plone add-ons
This template creates a package for a basic Plone add-on project with
a single namespace (like Products.PloneFormGen).
To create a Plone project with a name like 'collective.geo.bundle'
(2 dots, a 'nested namespace'), use the 'plone_nested' template.
This template supports local commands. These commands allow you to
add Plone features to your new package.
If you are trying to create a Plone *site* then the best place to
start is with one of the Plone installers. If you want to build
your own Plone buildout, use one of the plone'N'_buildout templates
ERROR: Project name expected 1 dots, supplied '--list-variables' has 0 dots
consider how to replace .zopeskel with .templer
in base.py
.zopeskel is where default configurations are stored. Replace this file with on named .templer
Get rid of PasteScript depenedency.
PasteScript/PasteDeploy are dying because noone wants to maintain it. Pyramid actually stripped off templating functionality into pyramid.scaffolds
, we could steal their code and integrate into templer.core
. Maybe then someday pyramid also depends on templer.core
. Opinions?
PS: This could be a nice todo for ploneconf2012 sprints :)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.