diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 1988873..641c79f 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -12,6 +12,8 @@ updates: commit-message: prefix: "[dependabot] " assignees: - - "anevis: + - "anevis" labels: - "dependabot" + reviewers: + - "anevis" diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 4b2900b..d8ae2c5 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -2,7 +2,7 @@ name: CD Pipeline run-name: CD ๐Ÿ“ฆ๐Ÿš€ on: - workflow_run: + workflow_dispatch: workflows: ['CI Pipeline'] types: [completed] branches: @@ -22,7 +22,7 @@ jobs: - name: Installing Devbox โš™๏ธ uses: jetpack-io/devbox-install-action@v0.8.0 - name: Install all dependencies ๐Ÿ“ฆ - run: devbox run install-dev + run: devbox run install - name: ๐Ÿ“ฆ Package run: devbox run build - name: ๐Ÿš€ Publish to PyPI diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0cc330f..6d3fba0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,7 +15,7 @@ jobs: - name: Installing Devbox โš™๏ธ uses: jetpack-io/devbox-install-action@v0.8.0 - name: Install all dependencies ๐Ÿ“ฆ - run: devbox run install-dev + run: devbox run install - name: ๐Ÿงน Linting & Formatting run: devbox run lint && devbox run format - name: ๐Ÿงช Running Tests diff --git a/README.md b/README.md index 172a27d..06ed141 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,26 @@ A Python utility to take a JSON / YAML file or a python dict / list and create a Markdown file. +## Installation + +```bash +pip install yaml-to-markdown +``` + ## Usage +```bash +$ yaml-to-markdown --help +Convert JSON or YAML to Markdown. +Usage: yaml-to-markdown -o [-y | -j ] + -o, --output-file : Path to the output file as a string [Mandatory]. + -y, --yaml-file : Path to the YAML file as a string [Optional] + -j, --json-file : Path to the JSON file as a string [Optional] + -h, --help: Show this message and exit. +Note: Either yaml_file or json_file is required along with output_file. +Example: yaml-to-markdown -o output.md -y data.yaml +``` + ### In Python Code example: #### Convert a Pyton dictionary to Markdown: diff --git a/devbox.json b/devbox.json index 5bd49d8..837b665 100644 --- a/devbox.json +++ b/devbox.json @@ -13,9 +13,6 @@ "install": [ "pip install -r requirements.txt" ], - "install-dev": [ - "pip install -r requirements.txt -r requirements-dev.txt" - ], "test": [ "pytest src/" ], @@ -29,7 +26,7 @@ "black src/" ], "build": [ - "python setup.py sdist bdist_wheel" + "rm -rf dist/* && python setup.py sdist bdist_wheel" ], "publish": [ "twine upload dist/*" diff --git a/docs/DEVELOPER.md b/docs/DEVELOPER.md index f3cbfb8..3b59290 100644 --- a/docs/DEVELOPER.md +++ b/docs/DEVELOPER.md @@ -35,12 +35,12 @@ devbox shell From within devbox shell ```bash -pip install -r requirements.txt -r requirements-dev.txt +pip install -r requirements.txt ``` From outside devbox shell ```bash -devbox run install-dev +devbox run install ``` ## Code Structure diff --git a/examples/simple_example.py b/examples/simple_example.py new file mode 100644 index 0000000..d44f19d --- /dev/null +++ b/examples/simple_example.py @@ -0,0 +1,11 @@ +from yaml_to_markdown.md_converter import MDConverter + +data = { + "name": "John Doe", + "age": 30, + "city": "Sydney", + "hobbies": ["reading", "swimming"], +} +converter = MDConverter() +with open("output.md", "w") as f: + converter.convert(data, f) diff --git a/requirements-dev.txt b/requirements-dev.txt deleted file mode 100644 index dcc8e95..0000000 --- a/requirements-dev.txt +++ /dev/null @@ -1,28 +0,0 @@ -# Dev dependencies -coverage==7.4.4 -mock==5.1.0 -pytest==8.1.1 -pytest-cov==5.0.0 - -bandit==1.7.8 -black==24.3.0 -flake8==7.0.0 -flake8-bandit==4.1.1 -flake8-black==0.3.6 -flake8-bugbear==24.2.6 -flake8-functions==0.0.8 -isort==5.13.2 -mypy==1.9.0 -pep8-naming==0.13.3 -safety - -# Packaging -setuptools==69.2.0 -twine==5.0.0 -wheel==0.43.0 - -# Typing -types-mock==5.1.0.20240311 -types-orjson==3.6.2 -types-PyYAML==6.0.12.20240311 -types-jsonschema==4.21.0.20240331 diff --git a/requirements.txt b/requirements.txt index 52635c8..a4d3c04 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,32 @@ click==8.1.7 jsonschema[format]==4.21.1 pyyaml==6.0.1 + +# Dev dependencies +coverage==7.4.4 +mock==5.1.0 +pytest==8.1.1 +pytest-cov==5.0.0 + +bandit==1.7.8 +black==24.3.0 +flake8==7.0.0 +flake8-bandit==4.1.1 +flake8-black==0.3.6 +flake8-bugbear==24.2.6 +flake8-functions==0.0.8 +isort==5.13.2 +mypy==1.9.0 +pep8-naming==0.13.3 +safety + +# Packaging +setuptools==69.2.0 +twine==5.0.0 +wheel==0.43.0 + +# Typing +types-mock==5.1.0.20240311 +types-orjson==3.6.2 +types-PyYAML==6.0.12.20240311 +types-jsonschema==4.21.0.20240331 diff --git a/setup.py b/setup.py index 5d804b7..2d7a51b 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,5 @@ +from typing import List + from setuptools import setup, find_packages import calendar import time @@ -8,6 +10,21 @@ with open("README.md", "r") as fh: long_description = fh.read() +long_description = long_description.replace( + "](", "](https://anevis.github.io/yaml-to-markdown/" +) + +with open("requirements.txt", "r") as req_file: + raw_requirements = req_file.readlines() + +requirements: List[str] = [] +for req in raw_requirements: + if req.strip() == "# Dev dependencies": + break + if req.startswith("#") or req.strip() == "": + continue + requirements.append(req.strip()) + setup( name="yaml-to-markdown", version=f"0.1.{ts}", @@ -17,11 +34,7 @@ url="https://anevis.github.io/yaml-to-markdown/", license="MIT", author="anevis", - install_requires=[ - "click==8.1.7", - "jsonschema[format]==4.21.1", - "pyyaml==6.0.1", - ], + install_requires=requirements, entry_points={ "console_scripts": [ "yaml-to-markdown=yaml_to_markdown.convert:main",