Package: upm-micro-project-manager
uPM - a micro project managerThis neat tool wants to help you organizing project and file templates.
It can create complete file structures in one simple command line and is easily extensibleInstallationTo install uPM just create a virtual environment and use pip to install uPM directly into your projectpython -m venv env
source env/bin/activate
python -m pip install upm-micro-project-manager
upm init -p projectname=myproject python-project .This creates a simple python project with name myproject.
Any occourance of the patternprojectnamein filenames will be replaced by the given valuemyproject.
Inside files, the pattern {{projectname}} will be replaced by the given valuemyprojectYou can set your own parameters in a json based config file named ~/.upm/config.
Additionally, uPM looks in the current directory for a configuration file named .upm which will overlay
the current configuration.Configurationuser setupTo setup uPM properly you should follow these steps.
First, create a config structure for your uPM templates$ mkdir -p ~/.upm/templates
$ vi ~/.upm/configA minimal config file could look like this:{
    "pattern" : {
        "author" : "YourName",
        "author_email" : "here@there.com"
    },
    "template_path" : "~/.upm/templates"
}You are now ready to create templates and any template that contains the pattern {{author}} will automagically
get your name setproject setupAdditionally you can, in your base directory (from where you have to call uPM), create a file .upm which may
contain additional information:{
    "pattern" : {
        "projectname" : "MyTinyProject",
        "project-email" : "admin@mytiny-project.com"
    }
}You also could set your own template_path for this particular project in the same mannor as in user setuppre-created templatesSince nobody wants a templating engine without templates, I started to create some for my projects.
These are also available ongitlab.
Using the upper config file one can use them this way.~$ mkdir ~/.upm && cd $_
.upm$ git clone git@gitlab.com:rapp.jens/upm-templates.git templatesPatterns which are always setThere are some (at least one) pattern which are automatically set by the program. Prevent using their name inside
your pattern configcurrent_dateAny occourance of the word current_date in filenames or {{current_date}} will be replaced by the current datecurrent_yearThis may be helpful for license files where only the year of License generation is neccessary.current_fileThis gives the filename of the current file - some people like to have this in their files.creating your own templatesTo create your own templates, just create a file or file structure like this one:$ mkdir -p python-project/projectname
$ vi python-project/projectname/projectname.pywith its content#!/usr/bin/env python
##############################################################################
# author       # {{author}}
# date         # {{current_date}}
# ---------------------------------------------------------------------------
# description  #
#              #
#              #
##############################################################################
import sys

def main():
    pass


if __name__ == '__main__':
    sys.exit(main())Now you can simply scan your template into your template folder$ upm scan python-project python-projectCreating this project is done by using$ mkdir project && cd $_
$ upm init -pprojectname=MyProject python-project .This creates a project directory like└── MyProject
    └── MyProject.pyCurrently, your scan base must be a directory. If you want to scan a single file, this must be the only file in the given directory.
Here is an example for creating a single python file template.pyfile/
└── namescanning this using the command$ upm scan pyfile python-maincreates a template which can be used to create a single file using upm$ upm init -pname=main.py python-main .Extending existing templatesSometimes, you don't want to begin from scratch but extend some existing project. To do this, it is possible to generate a project
file structure without replacing the pattern using the parameter -n or --no-replace$ upm init --no-replace python-project .Now you can do your stuff and scan againLast wordsThat's all for now. I hope this tool is helpful for some people
Have fun.