首页 > 编程语言 >自定义一个python pip包

自定义一个python pip包

时间:2022-11-15 11:01:39浏览次数:64  
标签:Language 自定义 python setup polls Programming pip include example

新建一个目录
mkdir example

基本说明文件

  • README.rst
  • LICENSE
  • setup.cfg
  • setup.py
  • MANIFEST.in
  • docs

example/README.rst

点击查看代码
=====
example
=====

Polls is a Django app to conduct Web-based polls. For each question,
visitors can choose between a fixed number of answers.

Detailed documentation is in the "docs" directory.

Quick start
-----------

1. Add "polls" to your INSTALLED_APPS setting like this::

    INSTALLED_APPS = [
        ...
        'example',
    ]

2. Include the polls URLconf in your project urls.py like this::

    path('example/', include('polls.urls')),

3. Run ``python manage.py migrate`` to create the polls models.

4. Start the development server and visit http://127.0.0.1:8000/admin/
   to create a poll (you'll need the Admin app enabled).

5. Visit http://127.0.0.1:8000/example/ to participate in the poll.

example/setup.cfg

点击查看代码
[metadata]
name = example
version = 0.1
description = A Django app to conduct Web-based example
long_description = file: README.rst
url = https://www.example.com/
author = Your Name
author_email = [email protected]
license = BSD-3-Clause  # Example license
classifiers =
    Environment :: Web Environment
    Framework :: Django
    Framework :: Django :: X.Y  # Replace "X.Y" as appropriate
    Intended Audience :: Developers
    License :: OSI Approved :: BSD License
    Operating System :: OS Independent
    Programming Language :: Python
    Programming Language :: Python :: 3
    Programming Language :: Python :: 3 :: Only
    Programming Language :: Python :: 3.6
    Programming Language :: Python :: 3.7
    Programming Language :: Python :: 3.8
    Topic :: Internet :: WWW/HTTP
    Topic :: Internet :: WWW/HTTP :: Dynamic Content

[options]
include_package_data = true
packages = find:
python_requires = >=3.6
install_requires =
    Django >= X.Y  # Replace "X.Y" as appropriate
example/setup.py
from setuptools import setup

setup()
django-polls/MANIFEST.in
include LICENSE
include README.rst
recursive-include polls/static *
recursive-include polls/templates *
recursive-include docs *

文件定义后 将包文件 demo 放入

ptyhon setup.py sdist 
  • 在 dest 目录下 会有一个压缩包文件

参考来源 django 官网

https://docs.djangoproject.com/zh-hans/3.2/intro/reusable-apps/

源码地址

[email protected]:guanchaoguo/demo-pip-django-package.git

标签:Language,自定义,python,setup,polls,Programming,pip,include,example
From: https://www.cnblogs.com/guanchaoguo/p/16891668.html

相关文章

  • Python获得最近的星期五的日期
    要将一周中的某一天作为int,我们使用datetime.datetime.today().weekday();要从datetime中减去days,我们使用datetime.today()-timedelta(days=days_to_subtract),现在我们可......
  • 自定义定时器
    自定义定时器#include<iostream>#include<sys/epoll.h>#include<chrono>#include<functional>#include<memory>#include<set>int64_tgid{0};structNodeBa......
  • 【AGC】远程配置如何传入自定义属性
    ​背景:现在AGC远程配置端侧服务提供的SDK支持传入自定义属性获取和更新云端配置数据了。下面将通过一个demo集成远程配置SDK来实现这一功能。 集成准备1.在AGC创建工......
  • 1710. 卡车上的最大单元数 ----- 贪心算法,自定义sort排序
    请你将一些箱子装在一辆卡车上。给你一个二维数组boxTypes,其中boxTypes[i]=[numberOfBoxesi,numberOfUnitsPerBoxi]:numberOfBoxesi是类型i的箱子的数量。numb......
  • JavaScript自定义数据类型判断函数
    functionjudgeType(ele){letres=typeofele;if(res==="object"){//短路表达式,第一个成立则返回第二个的值,第一个不成立,则返回第一个的值......
  • python 定时认证
    importrequests,time,sys,re,json,schedulefromdatetimeimportdate,datetimeaa1='''Host:10.255.0.2:8081Content-Length:83Cache-Control:max-age=0Upgrade-......
  • 自定义组件
    创建自定义组件类似于页面,一个自定义组件由jsonwxmlwxssjs4个文件组成。要编写一个自定义组件,首先需要在json文件中进行自定义组件声明(将component字段设为true......
  • 自定义页面
    [Page构造器]Page({/***页面的初始数据*/data:{},/***生命周期函数--监听页面加载*/onLoad:function(e){},/**......
  • 自定义组件传参
    参数声明Component({//参数properties:{//这里定义了innerText属性,属性值可以在组件使用时指定innerText:{type:String,value:'def......
  • 自定义组件事件
    子组件<viewbindtap="onItemChildClick"data-item="item">{{item}}</view>Component({methods:{onItemChildClick(event){this.trigger......