From 821e7acb4c5c6f42484ca10d31b8562d1cf95302 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Thu, 23 Dec 2021 21:15:24 +0200
Subject: [PATCH] Python module scaffolding.

Just enough to build and install a wheel. Now all that's left is to
write the code. Easy, right?
---
 .gitlab-ci.yml          |  8 ++++++++
 .pre-commit-config.yaml |  2 +-
 MANIFEST.in             |  5 +++++
 setup.cfg               | 11 +++++++++++
 setup.py                | 41 +++++++++++++++++++++++++++++++++++++++++
 yamltool/__init__.py    |  9 +++++++++
 yamltool/__main__.py    | 15 +++++++++++++++
 7 files changed, 90 insertions(+), 1 deletion(-)
 create mode 100644 MANIFEST.in
 create mode 100644 setup.cfg
 create mode 100644 setup.py
 create mode 100644 yamltool/__init__.py
 create mode 100644 yamltool/__main__.py

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 833e902..d3ab1fb 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,3 +2,11 @@
 include:
   - project: shore/ci-stuff
     file: templates/pre-commit.yml
+  - project: shore/ci-stuff
+    file: templates/python.yml
+
+install-wheel:
+  extends: .install-wheel
+  script:
+    - python3 -m yamltool
+    - yt
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 77487b0..41ea1a5 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -63,7 +63,7 @@ repos:
               --line-length=79
 
   - repo: https://github.com/PyCQA/prospector.git
-    rev: 1.5.1
+    rev: 1.5.3.1
     hooks:
       - id: prospector
         args:
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..3db6801
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,5 @@
+include *.rst
+include *.txt
+exclude .pre-commit-config.yaml
+exclude .gitlab-ci.yml
+exclude .gitignore
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..926019b
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,11 @@
+[bumpversion]
+current_version = 0.0.1
+commit = True
+tag = True
+
+[bdist_wheel]
+universal = 1
+
+[bumpversion:file:setup.py]
+
+[bumpversion:glob:*/__init__.py]
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..0223a08
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,41 @@
+from setuptools import setup, find_packages
+import yamltool
+
+with open("README.rst", "r", encoding="utf-8") as readme:
+    long_description = readme.read()
+
+setup(
+    name="yamltool",
+    version=yamltool.__version__,
+    description=yamltool.__doc__.splitlines()[0],
+    long_description=long_description,
+    long_description_content_type="text/x-rst",
+    url="https://git.shore.co.il/nimrod/yamltool",
+    author="Nimrod Adar",
+    author_email="nimrod@shore.co.il",
+    license="MIT",
+    classifiers=[
+        "Development Status :: 3 - Alpha",
+        "Environment :: Console",
+        "Intended Audience :: Developers",
+        "Intended Audience :: Information Technology",
+        "Intended Audience :: System Administrators",
+        "License :: OSI Approved :: MIT License",
+        "Programming Language :: Python :: 3",
+        "Programming Language :: Python :: 3.6",
+        "Programming Language :: Python :: 3.7",
+        "Programming Language :: Python :: 3.8",
+        "Programming Language :: Python :: 3.9",
+        "Topic :: Software Development",
+        "Topic :: Software Development :: Debuggers",
+        "Topic :: Software Development :: Quality Assurance",
+        "Topic :: Text Processing :: Markup",
+        "Topic :: Utilities",
+    ],
+    keywords="yaml",
+    packages=find_packages(),
+    install_requires=[
+        "ruamel.yaml>=0.15.0",
+    ],
+    entry_points={"console_scripts": ["yt=yamltool.__main__:main"]},
+)
diff --git a/yamltool/__init__.py b/yamltool/__init__.py
new file mode 100644
index 0000000..892e8e9
--- /dev/null
+++ b/yamltool/__init__.py
@@ -0,0 +1,9 @@
+"""YAML tool, a clone of the json.tool Python module for YAML.
+
+This tool provides a simple command line interface to validate and pretty-print
+YAML documents while trying to preserve as much as possible from the original
+documents (like comments and anchors).
+"""
+
+
+__version__ = "0.0.1"
diff --git a/yamltool/__main__.py b/yamltool/__main__.py
new file mode 100644
index 0000000..2346b0e
--- /dev/null
+++ b/yamltool/__main__.py
@@ -0,0 +1,15 @@
+"""YAML tool, a clone of the json.tool Python module for YAML.
+
+This tool provides a simple command line interface to validate and pretty-print
+YAML documents while trying to preserve as much as possible from the original
+documents (like comments and anchors).
+"""
+
+
+def main():
+    """Main entrypoint."""
+    return
+
+
+if __name__ == "__main__":
+    main()
-- 
GitLab