yehua - Let you focus on code, instead of setup scaffolding¶
New BSD License
Oct 17, 2020
yehua /’jɛhwa/ is yet another a project template tool for an organisation. It creates a project skeleton, S from the default project template, T, of an organisation. moban, the other tool of moremoban organisation, keeps S in synchronisation with T forever. This use case is what we called: continuous templating.
What’s different with Yehua¶
When the scope is a single project, yehua is no different to cookiecutter and PyScaffold. It will create a project skeleton from pypi-mobans, other templates such as cookiecutter templates, yehua mobans.
When the scope is all projects within an organisation, yehua helps tackle information fragmentation problem, because all new projects after its creation, are still in synchronisation with T. For example, removing python 2.7 test in your travis file, can be done either manually by hand or automatically via moban. What’s the difference? The latter is faster and typo-free option. Here is an example.
PyScaffold version 3 has rolled out ‘–update’ option, recognizing the organisational need of continous templating. Why do not yehua join PyScaffold? Well, moremoban organisation started with ‘–update’ at the start so our architecture and vision are closer to that of cookiecutter:
- we do not want to limit ourselves in pythonsphere. We wanted to serve all IT projects. In our mind, they are all about text templating.
- we split the tool and the templates, serving the previous statement. People can create npm package template and use yehua+moban for continuous templating. Here are a list of examples:
You can install yehua via pip:
$ pip install yehua
or clone it and install it:
$ git clone https://github.com/moremoban/yehua.git $ cd yehua $ python setup.py install
Simply type in and you are taken care of:
It will use pypi-mobans-pkg by default and if it is not installed, it will install latest one. Then pypi-mobans-pkg takes over and will do [these](https://github.com/moremoban/pypi-mobans/blob/dev/yehua.yml) for you:
- Consult you on your project static information which can update as many as you want to.
- Create the Python package folder structure
- Initialize the package as git project
You will simply need to commit it after you will have reviewed the generated files.
Let’s make a python command line utility using yehua. The command will be hello and it prints world.
Step 1 Let’s launch yehua¶
Step 2 Fill-in the meta data for your project¶
At the end, yehua generates a folder named ‘hello’, which contains [all necessary files](https://github.com/moremoban/pypi-mobans).
Step 3 Start coding¶
In above animation, we write up the actual code in hello/main.py
def main(): print('world')
Why is it enough? yehua generates a command utility python and it has pre-wired to invoke hello.main.main() function. You can find it out in setup.py.
Step 4 Install it¶
Now all is done. Let’s install it
You can now run hello at your command line.
Step 5 push to github¶
Suppose you are happy with everything. Please do the following to push it to your github:
$ git commit -am ":sparkle: initial commit"
Then create your project repository in github and do these to push it out:
$ git remote add origin https://github.com/moremoban/hello.git $ git push origin master
You can find the hello project on github.
Step 7 enable travis¶
The generated project already has .travis.yml file. What you will need to do is to register with travis.org if you have not done so. And then go to travis and activate your project.
The original problem I was trying to solve is: I would like to place common paragraphs in the documentation of my projects in a central place (pyexcel-mobans), and all projects could reference it dynamically so that when those common paragraphs get updated, the updates can be easily propagated to all relevant projects. The derived problem is: what can I do to a new project? I found myself doing a lot of copy-and-paste a lot, which lead to the creation of “yehua”. Later, John Vandenberg, an active member of coala, suggested extracting the generic sets of pyexcel-mobans to form pypi-mobans, so that a vanilla python package can be created. Why not cookiecutter? Well, I have not heard of it at the time of creation. But it turns out that this project started to pave the way to be the cookiecutter for organisations.
- Default use case: scaffolding a python package
- Custom use case: scaffolding a npm package
- Enterprise use case: scaffolding all projects in your organisation
NEW BSD License