From 8cc44549559ea333df0b3dd5b303256f1462ea31 Mon Sep 17 00:00:00 2001 From: Antony Nevis Date: Sat, 6 Apr 2024 15:57:50 +1100 Subject: [PATCH] Changed name to yaml-to-markdown --- .github/workflows/cd.yaml | 3 +++ README.md | 8 ++++---- devbox.json | 7 ++++--- docs/DEVELOPER.md | 4 ++-- setup.py | 6 +++--- src/{json_to_markdown => yaml_to_markdown}/__init__.py | 0 src/{json_to_markdown => yaml_to_markdown}/convert.py | 6 +++--- .../convert_test.py | 2 +- .../md_converter.py | 2 +- .../md_converter_test.py | 2 +- src/{json_to_markdown => yaml_to_markdown}/utils.py | 0 src/{json_to_markdown => yaml_to_markdown}/utils_test.py | 2 +- 12 files changed, 23 insertions(+), 19 deletions(-) rename src/{json_to_markdown => yaml_to_markdown}/__init__.py (100%) rename src/{json_to_markdown => yaml_to_markdown}/convert.py (92%) rename src/{json_to_markdown => yaml_to_markdown}/convert_test.py (96%) rename src/{json_to_markdown => yaml_to_markdown}/md_converter.py (98%) rename src/{json_to_markdown => yaml_to_markdown}/md_converter_test.py (99%) rename src/{json_to_markdown => yaml_to_markdown}/utils.py (100%) rename src/{json_to_markdown => yaml_to_markdown}/utils_test.py (68%) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index aa675fe..b854bea 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -27,4 +27,7 @@ jobs: run: devbox run build - name: 🚀 Publish to PyPI run: devbox run publish + env: + TWINE_USERNAME: ${{ variables.TWINE_USERNAME }} + TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} - run: echo "🍏 This job's status is ${{ job.status }}." diff --git a/README.md b/README.md index 727ba2b..d185720 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# JSON to Markdown Converter +# YAML to Markdown Converter A Python utility to take a JSON / YAML file or a python dict / list and create a Markdown file. @@ -8,7 +8,7 @@ A Python utility to take a JSON / YAML file or a python dict / list and create a #### Convert a Pyton dictionary to Markdown: ```python -from json_to_markdown.md_converter import MDConverter +from yaml_to_markdown.md_converter import MDConverter data = { "name": "John Doe", @@ -39,12 +39,12 @@ You can also use the command line interface to convert a JSON or YAML file to Ma #### Convert a JSON file to Markdown: ```bash -python json_to_markdown/convert.py --output-file output.md --json-file test.json +python yaml_to_markdown/convert.py --output-file output.md --json-file test.json ``` #### Convert a YAML file to Markdown: ```bash -python json_to_markdown/convert.py --output-file output.md --yaml-file test.yaml +python yaml_to_markdown/convert.py --output-file output.md --yaml-file test.yaml ``` ## Developer Guide diff --git a/devbox.json b/devbox.json index e14dc68..5bd49d8 100644 --- a/devbox.json +++ b/devbox.json @@ -1,10 +1,11 @@ { "$schema": "https://raw.githubusercontent.com/jetpack-io/devbox/0.10.3/.schema/devbox.schema.json", "packages": ["python@3.12.2"], + "env": { + "VENV_DIR": "$HOME/MyFiles/programming/OpenSource/yaml-to-markdown/.devbox/virtenv/python/.venv", + "TWINE_USERNAME": "__token__" + }, "shell": { - "env": { - "VENV_DIR": "$HOME/MyFiles/programming/OpenSource/json-to-markdown/.devbox/virtenv/python/.venv" - }, "init_hook": [ ". $VENV_DIR/bin/activate" ], diff --git a/docs/DEVELOPER.md b/docs/DEVELOPER.md index 9a8b6f2..f3cbfb8 100644 --- a/docs/DEVELOPER.md +++ b/docs/DEVELOPER.md @@ -47,10 +47,10 @@ devbox run install-dev The functionality can be used in the command line or in Python code. -To use the functionality in Python code, you can import the `MDConverter` class from the `json_to_markdown.md_converter` module. +To use the functionality in Python code, you can import the `MDConverter` class from the `yaml_to_markdown.md_converter` module. The `md_converter.py` file contains the `MDConverter` class, which is used by the `convert` function to perform the conversion. -To use the functionality from the command line, you can run the `convert.py` script in the `json_to_markdown` directory. +To use the functionality from the command line, you can run the `convert.py` script in the `yaml_to_markdown` directory. This file contains the `convert` function, which takes a JSON or YAML file and converts it to Markdown. ## Testing diff --git a/setup.py b/setup.py index d198078..d9b85d6 100644 --- a/setup.py +++ b/setup.py @@ -9,11 +9,11 @@ long_description = fh.read() setup( - name="json-to-markdown", + name="yaml-to-markdown", version=f"0.1.{ts}", packages=find_packages(where="src"), package_dir={"": "src"}, - url="https://anevis.github.io/json-to-markdown/", + url="https://anevis.github.io/yaml-to-markdown/", license="MIT", author="anevis", install_requires=[ @@ -23,7 +23,7 @@ ], entry_points={ "console_scripts": [ - "json-to-markdown=json_to_markdown.convert:main", + "yaml-to-markdown=yaml_to_markdown.convert:main", ], }, long_description=long_description, diff --git a/src/json_to_markdown/__init__.py b/src/yaml_to_markdown/__init__.py similarity index 100% rename from src/json_to_markdown/__init__.py rename to src/yaml_to_markdown/__init__.py diff --git a/src/json_to_markdown/convert.py b/src/yaml_to_markdown/convert.py similarity index 92% rename from src/json_to_markdown/convert.py rename to src/yaml_to_markdown/convert.py index c7c684d..238f886 100644 --- a/src/json_to_markdown/convert.py +++ b/src/yaml_to_markdown/convert.py @@ -5,7 +5,7 @@ import click import yaml -from json_to_markdown.md_converter import MDConverter +from yaml_to_markdown.md_converter import MDConverter def _get_json_data(json_file: str) -> Dict[str, Any]: @@ -21,7 +21,7 @@ def _get_yaml_data(yaml_file: str) -> Dict[str, Any]: def _help() -> None: click.echo("Convert JSON or YAML to Markdown.") click.echo( - "Usage: json-to-markdown -o [-y | -j ]" + "Usage: yaml-to-markdown -o [-y | -j ]" ) click.echo( " -o, --output-file : Path to the output file as a string [Mandatory]." @@ -36,7 +36,7 @@ def _help() -> None: click.echo( "Note: Either yaml_file or json_file is required along with output_file." ) - click.echo("Example: json-to-markdown -o output.md -y data.yaml") + click.echo("Example: yaml-to-markdown -o output.md -y data.yaml") @click.command() diff --git a/src/json_to_markdown/convert_test.py b/src/yaml_to_markdown/convert_test.py similarity index 96% rename from src/json_to_markdown/convert_test.py rename to src/yaml_to_markdown/convert_test.py index 0c43c2f..e591fae 100644 --- a/src/json_to_markdown/convert_test.py +++ b/src/yaml_to_markdown/convert_test.py @@ -3,7 +3,7 @@ import pytest -from json_to_markdown.convert import convert +from yaml_to_markdown.convert import convert _JSON_DATA = '{"key": "value"}' diff --git a/src/json_to_markdown/md_converter.py b/src/yaml_to_markdown/md_converter.py similarity index 98% rename from src/json_to_markdown/md_converter.py rename to src/yaml_to_markdown/md_converter.py index 1ee16f9..6833f8f 100644 --- a/src/json_to_markdown/md_converter.py +++ b/src/yaml_to_markdown/md_converter.py @@ -2,7 +2,7 @@ from typing import Any, Dict, IO, List, Optional, Union, Callable -from json_to_markdown.utils import convert_to_title_case +from yaml_to_markdown.utils import convert_to_title_case class MDConverter: diff --git a/src/json_to_markdown/md_converter_test.py b/src/yaml_to_markdown/md_converter_test.py similarity index 99% rename from src/json_to_markdown/md_converter_test.py rename to src/yaml_to_markdown/md_converter_test.py index 75cd1c2..902ed62 100644 --- a/src/json_to_markdown/md_converter_test.py +++ b/src/yaml_to_markdown/md_converter_test.py @@ -5,7 +5,7 @@ import pytest from mock import mock -from json_to_markdown.md_converter import MDConverter +from yaml_to_markdown.md_converter import MDConverter _TABLE_ITEMS = [ { diff --git a/src/json_to_markdown/utils.py b/src/yaml_to_markdown/utils.py similarity index 100% rename from src/json_to_markdown/utils.py rename to src/yaml_to_markdown/utils.py diff --git a/src/json_to_markdown/utils_test.py b/src/yaml_to_markdown/utils_test.py similarity index 68% rename from src/json_to_markdown/utils_test.py rename to src/yaml_to_markdown/utils_test.py index 339e04c..d0d967f 100644 --- a/src/json_to_markdown/utils_test.py +++ b/src/yaml_to_markdown/utils_test.py @@ -1,4 +1,4 @@ -from json_to_markdown.utils import convert_to_title_case +from yaml_to_markdown.utils import convert_to_title_case class TestUtils: