PyFabricate is a Mac OS X application that simplifies the creation of Python projects. Since I authored it, obviously it is an opinionated version of what I think a Python project should look like. Additionally, I have a certain toolset that I use to enable me to write Python Mac OS X applications. However, I tried to create a bit of customization by exposing the templates from which I create project files. More on this later.
PyFabricate uses a wizard-like interface to query for the project details.
The developer uses HomeBrew to install the opinionated dependencies.
The project name is the same as the module package name
Get the current release from here.
Copy this file to your Mac OS applications folder. The application is Apple code signed so you will get a simple message you have to acknowledge the first time you execute it.
The following is a sample of the initial skeleton that PyFabricator creates. It does now show the virtual environment that it creates. More on this later.
Essentially, PyFabricate creates the src and tests directories. In the project root directory it creates the following files:
Additionally, PyFabricate creates all the python package files (__init__.py) in all the appropriate places. And finally, it places two sets of logging configurations files, one for your application and one for your unit tests.
At the end of the fabrication, PyFabricate creates a Python virtual environment. Because of technical limitations PyFabricate cannot use a pyenv version of Python to create the virtual environment. Thus, it depends on a homebrew installed version.
The wizard UI is a 4 step process where PyFabricate gathers sufficient project details that it uses to populate the skeleton templates. The templates use the following self-explanatory substitution tokens.
Token Name | Description |
---|---|
PROJECT_NAME | Used to construct the base project directory and is the Python module name |
DESCRIPTION | Placed as the description in the generated pyproject.toml |
OWNER_NAME | Placed as the author name and maintainer name in the generated pyproject.toml |
OWNER_EMAIL | Placed as the email address for botht the author and the maintainer in the generated pyproject.toml |
KEYWORDS | Used as the project keywords in the generated pyproject.toml |
PYTHON_VERSION | Used in the generated .gitignore file to exclude the directory that contains the virtual environment. Additionally appended as the directory name for the generated virtual environment. For example, 'pyenv-3.12.0' |
The following is an annotated graphic of the pyroject.toml template.
This step is an introduction to PyFabricate. After this step, PyFabricate does a best effort to ensure that its execution dependencies are met. If not, the developer cannot proceed past this step.
At this step PyFabricate collects project specific information. Most of this serves to populate the pyproject.toml template.
PyFabricate assumes that the developer keeps all of his Python projects in a single subdirectory. This is an opinionated view and is simply an organizational preference.
PyFabricate queries pyenv for the developer installed Python versions. These are the only ones from which PyFabricate can create Python virtual environments.
At the end of the wizard, PyFabricate presents a log as it creates the project. The following is an example log.
As mentioned earlier the developer can customize some aspects of the project generation. PyFabricate stores the templates it uses in $HOME/.config/pyfabricate/templates as noted below.
For example, a developer may want to use a difference license. Simply, replace the LICENSE.template file
PyFabricate is currently only at version 0.5.0. I am currently investigating adding additional features and removing limitations.
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3