sk-dist 项目教程
1. 项目的目录结构及介绍
sk-dist 项目的目录结构如下:
sk-dist/
├── examples/
│ ├── encoder/
│ │ └── basic_usage.py
│ └── ...
├── sk_dist/
│ ├── __init__.py
│ ├── meta.py
│ └── ...
├── tests/
│ ├── __init__.py
│ └── ...
├── .gitignore
├── LICENSE
├── README.md
├── setup.py
└── ...
目录介绍
examples/
: 包含使用 sk-dist 的示例代码。encoder/
: 编码器示例。basic_usage.py
: 基本用法示例。
sk_dist/
: 项目的主要代码目录。__init__.py
: 初始化文件。meta.py
: 元估计器相关代码。
tests/
: 包含项目的测试代码。__init__.py
: 测试初始化文件。
.gitignore
: Git 忽略文件配置。LICENSE
: 项目许可证文件。README.md
: 项目说明文档。setup.py
: 项目安装配置文件。
2. 项目的启动文件介绍
sk-dist 项目的启动文件主要是 setup.py
,它负责项目的安装和配置。
setup.py
文件介绍
from setuptools import setup, find_packages
setup(
name='sk-dist',
version='0.1.9',
description='Distributed scikit-learn meta-estimators with PySpark',
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
author='Ibotta Inc',
license='Apache 2.0',
packages=find_packages(),
install_requires=[
'scikit-learn>=0.20.0',
'pyspark>=2.4.0',
'pyarrow>=0.8.0'
],
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
)
功能介绍
name
: 项目名称。version
: 项目版本。description
: 项目简短描述。long_description
: 项目详细描述,通常从README.md
文件读取。author
: 项目作者。license
: 项目许可证。packages
: 需要包含的包。install_requires
: 项目依赖的其他库。classifiers
: 项目分类信息。
3. 项目的配置文件介绍
sk-dist 项目的配置文件主要是 .gitignore
和 setup.py
。
.gitignore
文件介绍
.gitignore
文件用于指定 Git 版本控制系统忽略的文件和目录。
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_