python scratch file_Python项目模板与一个方便的Makefile和助手

cookiecutter-lux-python

Cookiecutter template for a Python package.

The boilerplate Python project that aims to create facility for maintaining of the package easily. It considering tools for building, testing and distribution.

Get Started

This template provides a basic structure for an idiomatic Python package with a convenient Makefile-facility and additional helpers.

Template can be configured using Cookiecutter's CLI or by altering parameters directly in cookiecutter.json.

Requirements

There are a couple of tools for building, packaging, documentation and so on, that must be installed.

GNU sed (brew install gnu-sed for macOS),

ripgrep (optionally),

awk,

Docker,

Virtualenv,

Sphinx (for sphinx-build and sphinx-apidoc).

To check availability of main tools just type make or make doc.

Features

To get help about available Makefile targets type: make help

Creating the virtual environment

Compile Pip requirements from requirements.in to requirements.txt using pip-tools (via Docker): make requirements

Create the new virtual environment based on requirements.txt and requirements-test.txt: make venv

Install the package into a virtual environment in so-called "development mode": source .venv/bin/activate

make install

# ...hard working here...

make uninstall

deactivate

Testing the package

Pytest is used as a test tool by default.

To run tests type (within a virtual environment): make check

Building the package from scratch

Create a source distribution (tarball with sources): make sdist

ls -al dist/*.tar.gz

Create a binary (wheel) distribution: make dist

ls -al dist/*.whl

Dealing with containers

Display system-wide information: make docker-info

Show all images, containers and volumes: make docker-stats

Build the image according to Dockerfile: make docker-build

Run temporary container in an interactive mode: make docker-run

Remove all unused images, built containers and volumes: make docker-clean

Documenting the project using Sphinx

Build an API documentation: make apidoc

Build the documentation as a standalone HTML files: make html

open doc/_build/html/index.html

Clean the project's directory (precompiled and temporary files): make clean

Clean the project's build output (eggs, distributions, builds): make distclean

Delete almost everything (including virtual environment): make mostlyclean

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值