diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000..ba80055353 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,64 @@ +# Define hooks for code formations +# Will be applied on any updated commit files if a user has installed and linked commit hook + +default_language_version: + python: python3.8 + +# Define bot property if installed via https://github.com/marketplace/pre-commit-ci +ci: + autofix_prs: true + autoupdate_commit_msg: '[pre-commit.ci] pre-commit suggestions' + autoupdate_schedule: monthly + # submodules: true + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.3.0 + hooks: + # - id: end-of-file-fixer + - id: trailing-whitespace + - id: check-case-conflict + - id: check-yaml + - id: check-toml + - id: pretty-format-json + - id: check-docstring-first + + - repo: https://github.com/asottile/pyupgrade + rev: v2.37.3 + hooks: + - id: pyupgrade + name: Upgrade code + args: [ --py37-plus ] + + - repo: https://github.com/PyCQA/isort + rev: 5.10.1 + hooks: + - id: isort + name: Sort imports + + - repo: https://github.com/pre-commit/mirrors-yapf + rev: v0.32.0 + hooks: + - id: yapf + name: YAPF formatting + + - repo: https://github.com/executablebooks/mdformat + rev: 0.7.16 + hooks: + - id: mdformat + name: MD formatting + additional_dependencies: + - mdformat-gfm + - mdformat-black + exclude: "README.md|README_cn.md" + + - repo: https://github.com/asottile/yesqa + rev: v1.4.0 + hooks: + - id: yesqa + + - repo: https://github.com/PyCQA/flake8 + rev: 5.0.4 + hooks: + - id: flake8 + name: PEP8 diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000000..996eaa280d --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,12 @@ +# Include the README +include *.md +include requirements.txt + +# Include the license file +include LICENSE + +# Include setup.py +include setup.py + +# Include the data files +recursive-include data * diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000000..f12995da3e --- /dev/null +++ b/setup.cfg @@ -0,0 +1,58 @@ +# Project-wide configuration file, can be used for package metadata and other toll configurations +# Example usage: global configuration for PEP8 (via flake8) setting or default pytest arguments +# Local usage: pip install pre-commit, pre-commit run --all-files + +[metadata] +license_file = LICENSE +description_file = README.md + + +[tool:pytest] +norecursedirs = + .git + dist + build +addopts = + --doctest-modules + --durations=25 + --color=yes + + +[flake8] +max-line-length = 120 +exclude = .tox,*.egg,build,temp +select = E,W,F +doctests = True +verbose = 2 +# https://pep8.readthedocs.io/en/latest/intro.html#error-codes +format = pylint +# see: https://www.flake8rules.com/ +ignore = + E731 # Do not assign a lambda expression, use a def + F405 # name may be undefined, or defined from star imports: module + E402 # module level import not at top of file + F401 # module imported but unused + W504 # line break after binary operator + E127 # continuation line over-indented for visual indent + E231 # missing whitespace after ‘,’, ‘;’, or ‘:’ + E501 # line too long + F403 # ‘from module import *’ used; unable to detect undefined names + + +[isort] +# https://pycqa.github.io/isort/docs/configuration/options.html +line_length = 120 +# see: https://pycqa.github.io/isort/docs/configuration/multi_line_output_modes.html +multi_line_output = 0 + + +[yapf] +based_on_style = pep8 +spaces_before_comment = 2 +COLUMN_LIMIT = 120 +COALESCE_BRACKETS = True +SPACES_AROUND_POWER_OPERATOR = True +SPACE_BETWEEN_ENDING_COMMA_AND_CLOSING_BRACKET = False +SPLIT_BEFORE_CLOSING_BRACKET = False +SPLIT_BEFORE_FIRST_ARGUMENT = False +# EACH_DICT_ENTRY_ON_SEPARATE_LINE = False diff --git a/setup.py b/setup.py new file mode 100644 index 0000000000..580da68668 --- /dev/null +++ b/setup.py @@ -0,0 +1,48 @@ +import re +from pathlib import Path + +import pkg_resources as pkg +from setuptools import find_packages, setup + +# Settings +FILE = Path(__file__).resolve() +ROOT = FILE.parent # root directory +README = (ROOT / "README.md").read_text(encoding="utf-8") +REQUIREMENTS = [f'{x.name}{x.specifier}' for x in pkg.parse_requirements((ROOT / 'requirements.txt').read_text())] + + +def get_version(): + file = ROOT / 'ultralytics/__init__.py' + return re.search(r'^__version__ = [\'"]([^\'"]*)[\'"]', file.read_text(), re.M)[1] + + +setup( + name="ultralytics", # name of pypi package + version=get_version(), # version of pypi package + python_requires=">=3.7.0", + long_description=README, + long_description_content_type="text/markdown", + # url="https://github.com/ultralytics/ultralytics", + project_urls={ + 'Bug Reports': 'https://github.com/ultralytics/ultralytics/issues', + 'Funding': 'https://ultralytics.com', + 'Source': 'https://github.com/ultralytics/ultralytics',}, + author="Ultralytics", + author_email='hello@ultralytics.com', + # package_dir={'': 'ultralytics'}, # Optional, use if source code is in a subdirectory under the project root, i.e. `src/` + packages=find_packages('ultralytics'), # required + include_package_data=True, + install_requires=REQUIREMENTS, + extras_require={ + 'dev': ['check-manifest'], + 'test': ['pytest', 'pytest-cov', 'coverage'],}, + classifiers=[ + "Intended Audience :: Developers", "Intended Audience :: Science/Research", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Topic :: Software Development", "Topic :: Scientific/Engineering", + "Topic :: Scientific/Engineering :: Artificial Intelligence", + "Topic :: Scientific/Engineering :: Image Recognition", "Operating System :: POSIX :: Linux", + "Operating System :: MacOS", "Operating System :: Microsoft :: Windows"], + keywords="machine-learning, deep-learning, vision, ML, DL, AI, YOLO, YOLOv3, YOLOv5, YOLOv8, HUB, Ultralytics") diff --git a/ultralytics/__init__.py b/ultralytics/__init__.py new file mode 100644 index 0000000000..552ea89ce7 --- /dev/null +++ b/ultralytics/__init__.py @@ -0,0 +1 @@ +__version__ = "0.0.1.dev"