HamlPy 项目教程

随笔3周前发布 王沛
28 0 0

HamlPy 项目教程

HamlPyA converter of HAML like templates into Django templates.项目地址:https://gitcode.com/gh_mirrors/ha/HamlPy

1. 项目的目录结构及介绍

HamlPy 项目的目录结构如下:

  1. HamlPy/

  2. ├── hamlpy/

  3. │ ├── __init__.py

  4. │ ├── compiler.py

  5. │ ├── parser.py

  6. │ ├── template_tags.py

  7. │ ├── test/

  8. │ │ ├── __init__.py

  9. │ │ ├── test_compiler.py

  10. │ │ ├── test_parser.py

  11. │ │ └── test_template_tags.py

  12. │ └── utils.py

  13. ├── .gitignore

  14. ├── LICENSE

  15. ├── README.md

  16. ├── reference.md

  17. ├── setup.py

  18. └── watch_me.rb

目录介绍

  • hamlpy/: 包含 HamlPy 的核心代码文件。
    • __init__.py: 初始化文件。
    • compiler.py: 编译器代码。
    • parser.py: 解析器代码。
    • template_tags.py: 模板标签代码。
    • test/: 测试文件夹,包含各种测试脚本。
    • utils.py: 工具函数。
  • .gitignore: Git 忽略文件配置。
  • LICENSE: 项目许可证。
  • README.md: 项目说明文档。
  • reference.md: 参考文档。
  • setup.py: 项目安装脚本。
  • watch_me.rb: 观察文件。

2. 项目的启动文件介绍

HamlPy 项目的启动文件主要是 setup.py。这个文件用于安装和配置项目。

setup.py 文件介绍

  1. from setuptools import setup, find_packages

  2. setup(

  3. name='hamlpy',

  4. version='1.7.0',

  5. packages=find_packages(),

  6. install_requires=[],

  7. author='Jesse Miller',

  8. author_email='jesse@lowfatlinux.com',

  9. description='A converter of HAML like templates into Django templates',

  10. long_description=open('README.md').read(),

  11. long_description_content_type='text/markdown',

  12. url='https://github.com/jessemiller/HamlPy',

  13. classifiers=[

  14. 'License :: OSI Approved :: MIT License',

  15. 'Operating System :: OS Independent',

  16. 'Programming Language :: Python',

  17. 'Programming Language :: Python :: 3',

  18. 'Programming Language :: Python :: 3.9',

  19. 'Programming Language :: Python :: 3.10',

  20. 'Programming Language :: Python :: 3.11',

  21. ],

  22. )

功能介绍

  • name: 项目名称。
  • version: 项目版本。
  • packages: 需要包含的包。
  • install_requires: 安装依赖。
  • author: 作者信息。
  • description: 项目描述。
  • long_description: 详细描述,通常从 README.md 文件读取。
  • long_description_content_type: 详细描述的内容类型。
  • url: 项目仓库地址。
  • classifiers: 项目分类信息。

3. 项目的配置文件介绍

HamlPy 项目的配置文件主要是 setup.py.gitignore

setup.py 配置文件介绍

如上所述,setup.py 文件用于安装和配置项目。

.gitignore 配置文件介绍

.gitignore 文件用于指定 Git 版本控制系统忽略的文件和目录。

  1. # Byte-compiled / optimized / DLL files

  2. __pycache__/

  3. *.py[cod]

  4. *$py.class

  5. # C extensions

  6. *.so

  7. # Distribution / packaging

  8. .Python

  9. build/

  10. develop-eggs/

  11. dist/

  12. downloads/

  13. eggs/

  14. .eggs/

  15. lib/

  16. lib64/

  17. parts/

  18. sdist/

  19. var/

  20. wheels/

  21. share/python-wheels/

  22. *.egg-info/

  23. .installed.cfg

  24. *.egg

  25. MANIFEST

  26. # PyInstaller

  27. # Usually these files are written by a python script from a template

  28. # before PyInstaller builds the exe, so as to inject date/other infos into it.

  29. *.manifest

  30. *.spec

  31. # Installer logs

  32. pip-log.txt

  33. pip-delete-this-directory

HamlPyA converter of HAML like templates into Django templates.项目地址:https://gitcode.com/gh_mirrors/ha/HamlPy

© 版权声明

相关文章

暂无评论

您必须登录才能参与评论!
立即登录
暂无评论...