Codebase Layout

Source Code

project_example_for_python/ contains the codebase of the project. The tests/ directory contains the unit and integration tests.

Documentation

  • docs/ contains the project documentation.

    • contributing/ contains information on contributing to the project.

Python Packaging

MANIFEST.in

Files listed here are included in the archive of your package which is released. If there is a file in your codebase and it’s not listed here and it’s not a Python file it will not be in the released package.

recursive-include with * at the end says to include everything under a given directory.

include README.rst
include LICENSE
recursive-include project_example_for_python *

entry_points.txt

See Python’s Creating and discovering plugins documentation for how entry points are used to export plugins as well as setuptool’s Entry Points https://setuptools.pypa.io/en/latest/userguide/entry_point.html>_ documentation.

LICENSE

Your project’s LICENSE

Copyright (c) 2021-2022 Intel

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

README.rst

This file is included in the archive of your package which is released. It is also displayed on PyPi if you upload your package to PyPi.

setup.py

This file is only around due to changes in the Python Packaging ecosystem. Eventually it will no longer be required. It exists to point to the setup.cfg file until that file alone will suffice.

import sys
import site
import setuptools

# See https://github.com/pypa/pip/issues/7953
site.ENABLE_USER_SITE = "--user" in sys.argv[1:]

setuptools.setup(use_scm_version=True)

pyproject.toml

This file is defined and it’s format is outlined or referenced in:

  • PEP-518

  • setuptools Dependency Management <https://setuptools.pypa.io/en/latest/userguide/dependency_management.html>_

  • PEP-517

  • PEP-440

This file and setup.cfg define your package and it’s build and run time dependencies.

requires = ["setuptools>=44", "wheel", "setuptools_scm[toml]>=3.4.3"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]

[tool.black]
exclude = '''
(
  /(
      \.eggs         # exclude a few common directories in the
    | \.git          # root of the project
    | \.hg
    | \.mypy_cache
    | \.tox
    | \.venv
    | _build
    | buck-out
    | build
    | dist
  )
)
'''

setup.cfg

This file and pyproject.toml define your package and it’s run time dependencies.

  • setuptools quickstart <https://setuptools.pypa.io/en/latest/userguide/quickstart.html>_

[metadata]
name = project-example-for-python
description = DFFML blank project-example-for-python
long_description = file: README.rst
author = John Andersen
author_email = johnandersenpdx@gmail.com
maintainer = John Andersen
maintainer_email = johnandersenpdx@gmail.com
url = https://github.com/intel/project-example-for-python
license = MIT
# keywords = dffml
classifiers =
    Development Status :: 3 - Alpha
    Intended Audience :: Developers
    License :: OSI Approved :: MIT License
    Natural Language :: English
    Operating System :: OS Independent
    Programming Language :: Python :: 3 :: Only
    Programming Language :: Python :: 3.7
    Programming Language :: Python :: Implementation :: CPython
    Programming Language :: Python :: Implementation :: PyPy

[options]
zip_safe = False
include_package_data = True
packages = find:
# entry_points = file: entry_points.txt
setup_requires =
    setuptools_scm[toml]>=3.4.3
# install_requires =
#     dffml>=0.4.0

[options.extras_require]
dev =
    coverage
    codecov
    sphinx
    sphinx_rtd_theme
    twine
    setuptools_scm[toml]>=3.4.3
    black==23.3.0
    importlib_metadata>=4.8.1;python_version<"3.8"