Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Make a project in 1 minute from a project template but keep updating it forever

License

NotificationsYou must be signed in to change notification settings

moremoban/yehua

Repository files navigation

https://codecov.io/github/moremoban/yehua/coverage.pnghttps://pepy.tech/badge/yehua/monthhttps://img.shields.io/github/stars/moremoban/yehua.svg?style=social&maxAge=3600&label=Starhttps://img.shields.io/static/v1?label=continuous%20templating&message=%E6%A8%A1%E7%89%88%E6%9B%B4%E6%96%B0&color=blue&style=flat-squarehttps://img.shields.io/static/v1?label=coding%20style&message=black&color=black&style=flat-squarehttps://readthedocs.org/projects/yehua/badge/?version=latesthttps://raw.githubusercontent.com/pyexcel/pyexcel.github.io/master/images/patreon.pngJoin the chat at https://gitter.im/chfw_yehua/Lobby

Introduction

https://github.com/moremoban/yehua/raw/dev/yehua-usage.gif

yehua /'jɛhwa/ is yet another a project template tool for an organisation. It creates a project skeleton, Sfrom the default project template, T, of an organisation.moban, the othertool of moremoban organisation, keeps S in synchronisation with T forever. Thisuse case is what we called:continuous templating.

https://github.com/moremoban/yehua/raw/dev/docs/source/_static/yehua-story.png

Cookiecutter users

Yes, we now support cookiecutter templates. It has been requested since 2018Europython. Simply there is tons of cookiecutter templates out there.

https://github.com/moremoban/yehua/raw/dev/docs/source/_static/yehua-cookiecutter.gif

What you do is to replace 'cookiecutter' with 'yh':

$ pip install yehua[cookiecutter]$ yh gh:audreyr/cookiecutter-pypackage

And what moremoban promise is, whenever your source template changes, youcan synchronize them any time with another moremoban's command 'moban':

$ moban

Yes, you need a separate command, which replaces your effort to synchronizethe upstream templates all the time.

What's different with Yehua

When the scope is a single project,yehua is no different tocookiecutter andPyScaffold. It will create a project skeleton frompypi-mobans, other templates suchas cookiecutter templates, yehua mobans.

When the scope is all projects within an organisation,yehua helps tackleinformation fragmentation problem, because all new projects after its creation,are still in synchronisation with T. For example, removing python 2.7 testin your travis file, can be done either manually by hand or automatically viamoban. What's the difference? The latter is faster and typo-free option. Here isan example.

PyScaffold version 3 has rolled out '--update' option, recognizing the organisationalneed of continous templating. Why do notyehua joinPyScaffold? Well,moremoban organisation started with '--update' at the start so our architectureand vision are closer to that ofcookiecutter:

  1. we do not want to limit ourselves in pythonsphere. We wanted to serve allIT projects. In our mind, they are all about text templating.
  2. 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:

Installation

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

For offline usage, you need to get pypi-mobans-pkg installed:

$ pip install yehua[pypi-mobans]

or:

$ pip install pypi-mobans-pkg

Usage

Simply type in and you are taken care of:

$ yh

It will use pypi-mobans-pkg by default and if it is not installed, it willinstall latest one. Then pypi-mobans-pkg takes over and will do[these](https://github.com/moremoban/pypi-mobans/blob/dev/yehua.yml)for you:

  1. Consult you on your project static information which can update asmany as you want to.
  2. Create the Python package folder structure
  3. Initialize the package as git project

You will simply need to commit it after you will have reviewed thegenerated files.

Tutorial

Let's make a python command line utility using yehua. The commandwill be hello and it prints world.

Step 1 Let's launch yehua

slide1

Step 2 Fill-in the meta data for your project

slide2

At the end, yehua generates a folder named 'hello', which contains [all necessaryfiles](https://github.com/moremoban/pypi-mobans).

Step 3 Start coding

https://github.com/moremoban/yehua/raw/dev/docs/source/_static/yehua-hello.gif

In above animation, we write up the actual code in hello/main.py

defmain():print('world')

Why is it enough? yehua generates a command utility python andit has pre-wired to invoke hello.main.main() function. Youcan find it out in setup.py.

Step 4 Install it

Now all is done. Let's install it

slide7

You can now run hello at your command line.

Step 5 push to github

Suppose you are happy with everything. Please do the following topush 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 thehello project on github.

Step 7 enable travis

The generated project already has .travis.yml file. What youwill need to do is to register with travis.org if you have notdone so. And then go to travis and activate your project.

Background

The original problem I was trying to solve is: I would like to placecommon paragraphs in the documentation of my projects in a centralplace (pyexcel-mobans), and all projects could reference it dynamicallyso that when those common paragraphs get updated, the updates can beeasily propagated to all relevant projects. The derived problem is:what can I do to a new project? I found myself doing a lot ofcopy-and-paste a lot, which lead to the creation of "yehua". Later,John Vandenberg, an active member of coala, suggested extracting thegeneric sets of pyexcel-mobans to form pypi-mobans, so thata vanilla python package can be created. Why not cookiecutter?Well, I have not heard of it at the time of creation. But it turns outthat this project started to pave the way to be the cookiecutterfor organisations.

Why to choose "yehua"? Here isthe little story behind thechoice of name. And thismusic video would help bridge thecultural gap between you and me.

License

NEW BSD License

It embeds MIT licensedcutie fromHans Schülein. Please refer to LICENSE file for more details

About

Make a project in 1 minute from a project template but keep updating it forever

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

  •  

Packages

No packages published

Contributors4

  •  
  •  
  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp