mirror of
https://github.com/rendercv/rendercv.git
synced 2026-10-25 13:48:49 -04:00
move entry function to __main__.py
This commit is contained in:
1 parent
965e9e4a34
commit
8285fe7c79
3 files changed
+10
-41
No files matched your search
+2
-2
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = 'rendercv'
|
||||
description = 'LaTeX CV generator from a YAML/JSON file'
|
||||
version = '0.2'
|
||||
version = '0.3'
|
||||
authors = [{ name = 'Sina Atalay' }]
|
||||
requires-python = '>=3.10'
|
||||
readme = "README.md"
|
||||
@@ -35,7 +35,7 @@ Documentation = 'https://sinaatalay.github.io/rendercv/'
|
||||
Source = 'https://github.com/sinaatalay/rendercv'
|
||||
|
||||
[project.scripts]
|
||||
rendercv = 'rendercv.rendering:main'
|
||||
rendercv = 'rendercv.__main__:main'
|
||||
|
||||
[project.optional-dependencies]
|
||||
docs = ["mkdocs", "mkdocs-material", "mkdocstrings-python"]
|
||||
|
||||
+7
-18
@@ -1,31 +1,20 @@
|
||||
"""
|
||||
This module is a script to run the RenderCV and generate a CV as a PDF. It is an entry
|
||||
point for the RenderCV package.
|
||||
"""
|
||||
import os
|
||||
import logging
|
||||
import sys
|
||||
import os
|
||||
|
||||
from rendercv.rendering import read_input_file, render_template, run_latex
|
||||
from .rendering import read_input_file, render_template, run_latex
|
||||
|
||||
|
||||
def main(args=sys.argv[1:]):
|
||||
"""
|
||||
This is the main function to run RenderCV.
|
||||
"""
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
if len(args) != 1:
|
||||
def main():
|
||||
if len(sys.argv) < 2:
|
||||
raise ValueError("Please provide the input file path.")
|
||||
elif len(args) == 1:
|
||||
input_file_path = args[0]
|
||||
elif len(sys.argv) == 2:
|
||||
input_file_path = sys.argv[1]
|
||||
else:
|
||||
raise ValueError(
|
||||
"More than one input is provided. Please provide only one input, which is"
|
||||
" the input file path."
|
||||
)
|
||||
|
||||
# input_file_path = sys.argv[1]
|
||||
file_path = os.path.join(os.getcwd(), input_file_path)
|
||||
data = read_input_file(file_path)
|
||||
output_latex_file = render_template(data)
|
||||
@@ -33,4 +22,4 @@ def main(args=sys.argv[1:]):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(args=["tests/inputs/personal.yaml"])
|
||||
main()
|
||||
+1
-21
@@ -11,7 +11,7 @@ from typing import Optional
|
||||
import sys
|
||||
from importlib.resources import files
|
||||
|
||||
from rendercv.data_model import RenderCVDataModel
|
||||
from .data_model import RenderCVDataModel
|
||||
|
||||
from jinja2 import Environment, PackageLoader
|
||||
from ruamel.yaml import YAML
|
||||
@@ -464,23 +464,3 @@ def run_latex(latex_file_path: str) -> str:
|
||||
)
|
||||
|
||||
return output_file_path
|
||||
|
||||
|
||||
def main():
|
||||
"""
|
||||
This is the main function to run RenderCV.
|
||||
"""
|
||||
if len(sys.argv) < 2:
|
||||
raise ValueError("Please provide the input file path.")
|
||||
elif len(sys.argv) == 2:
|
||||
input_file_path = sys.argv[1]
|
||||
else:
|
||||
raise ValueError(
|
||||
"More than one input is provided. Please provide only one input, which is"
|
||||
" the input file path."
|
||||
)
|
||||
|
||||
file_path = os.path.join(os.getcwd(), input_file_path)
|
||||
data = read_input_file(file_path)
|
||||
output_latex_file = render_template(data)
|
||||
run_latex(output_latex_file)
|
||||
Reference in new issue
Block a user