Skip to content

Commit

Permalink
Merge pull request #5 from anevis/chore/dependabot-fix
Browse files Browse the repository at this point in the history
Added example file
Fixed the dependabot yaml
Fix long description for PyPI
Make CD manual
  • Loading branch information
anevis authored Apr 7, 2024
2 parents 07fc858 + b958e31 commit 2bfcefb
Show file tree
Hide file tree
Showing 10 changed files with 85 additions and 43 deletions.
4 changes: 3 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ updates:
commit-message:
prefix: "[dependabot] "
assignees:
- "anevis:
- "anevis"
labels:
- "dependabot"
reviewers:
- "anevis"
4 changes: 2 additions & 2 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CD Pipeline
run-name: CD 📦🚀

on:
workflow_run:
workflow_dispatch:
workflows: ['CI Pipeline']
types: [completed]
branches:
Expand All @@ -22,7 +22,7 @@ jobs:
- name: Installing Devbox ⚙️
uses: jetpack-io/[email protected]
- name: Install all dependencies 📦
run: devbox run install-dev
run: devbox run install
- name: 📦 Package
run: devbox run build
- name: 🚀 Publish to PyPI
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Installing Devbox ⚙️
uses: jetpack-io/[email protected]
- 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
Expand Down
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <output_file> [-y <yaml_file> | -j <json_file>]
-o, --output-file <output_file>: Path to the output file as a string [Mandatory].
-y, --yaml-file <yaml_file>: Path to the YAML file as a string [Optional]
-j, --json-file <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:
Expand Down
5 changes: 1 addition & 4 deletions devbox.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
"install": [
"pip install -r requirements.txt"
],
"install-dev": [
"pip install -r requirements.txt -r requirements-dev.txt"
],
"test": [
"pytest src/"
],
Expand All @@ -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/*"
Expand Down
4 changes: 2 additions & 2 deletions docs/DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions examples/simple_example.py
Original file line number Diff line number Diff line change
@@ -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)
28 changes: 0 additions & 28 deletions requirements-dev.txt

This file was deleted.

29 changes: 29 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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
23 changes: 18 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import List

from setuptools import setup, find_packages
import calendar
import time
Expand All @@ -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}",
Expand All @@ -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",
Expand Down

0 comments on commit 2bfcefb

Please sign in to comment.