make the project ready for release

This commit is contained in:
Sina Atalay 2023-10-14 23:59:57 +02:00
parent b19216b733
commit 146d22f4b6
3 changed files with 134 additions and 6 deletions

View File

@ -67,7 +67,6 @@ jobs:
name: coverage name: coverage
path: .coverage.${{ matrix.python-version }}.${{ matrix.os }} path: .coverage.${{ matrix.python-version }}.${{ matrix.os }}
combine-coverages: combine-coverages:
name: Upload coverage report name: Upload coverage report
needs: [test] needs: [test]
@ -107,3 +106,32 @@ jobs:
SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 50 SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 50
SMOKESHOW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SMOKESHOW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SMOKESHOW_GITHUB_PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} SMOKESHOW_GITHUB_PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
publish:
if: github.event_name == 'release'
name: Publish to PyPI
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Build
run: |
pip install -U build
python -m build
- name: Check version
id: check-tag
uses: samuelcolvin/check-python-version@v4.1
with:
version_file_path: pydantic/version.py
- name: build
run: python -m build
- name: Upload package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

79
pyproject.toml Normal file
View File

@ -0,0 +1,79 @@
[project]
name = 'rendercv'
description = 'CV generator from a YAML/JSON file'
version = '0.1'
authors = [{ name = 'Sina Atalay' }]
requires-python = '>=3.10'
readme = "README.md"
dependencies = [
'annotated-types==0.6.0',
'Jinja2==3.1.2',
'phonenumbers==8.13.22',
'pydantic==2.4.2',
'pydantic-extra-types==2.1.0',
'pydantic_core==2.10.1',
'typing_extensions==4.8.0',
'pyspellchecker==0.7.2',
'ruamel.yaml==0.17.35',
'email-validator==2.0.0.post2',
]
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
[project.urls]
Homepage = 'https://sinaatalay.github.io/rendercv/'
Documentation = 'https://sinaatalay.github.io/rendercv/'
Source = 'https://github.com/sinaatalay/rendercv'
[project.optional-dependencies]
docs = [
"mkdocs",
"mkdocs-material",
"mkdocstrings-python",
]
testing = [
"coverage",
"pytest",
"pytest-cov",
]
linting = [
"black",
"ruff"
]
[build-system]
requires = ['setuptools>=68.0']
build-backend = 'setuptools.build_meta'
[project.scripts]
rendercv = 'rendercv.rendering:main'
# [tool.ruff]
# line-length = 88
[tool.coverage.run]
source = ['rendercv']
relative_files = true
# [tool.coverage.report]
# precision = 2
# exclude_lines = [
# 'pragma: no cover',
# 'raise NotImplementedError',
# 'if TYPE_CHECKING:',
# 'if typing.TYPE_CHECKING:',
# '@overload',
# '@typing.overload',
# '\(Protocol\):$',
# 'typing.assert_never',
# 'assert_never',
# ]
[tool.black]
color = true
line-length = 88
experimental-string-processing = true

View File

@ -8,6 +8,7 @@ from datetime import date
import logging import logging
import time import time
from typing import Optional from typing import Optional
import sys
from rendercv.data_model import RenderCVDataModel from rendercv.data_model import RenderCVDataModel
@ -426,10 +427,10 @@ def run_latex(latex_file_path: str) -> str:
) )
except subprocess.CalledProcessError or subprocess.TimeoutExpired as e: except subprocess.CalledProcessError or subprocess.TimeoutExpired as e:
raise RuntimeError( raise RuntimeError(
"Running TinyTeX has failed with the following error:\n\n" "Running TinyTeX has failed with the following error:\n\ncommand"
f'command "{e.cmd}" return with error (code {e.returncode}): {e.output}\n\n' f" \"{e.cmd}\" return with error (code {e.returncode}): {e.output}\n\nIf"
"If you can't find the problem, please try to re-install RenderCV, or" " you can't find the problem, please try to re-install RenderCV, or open"
" open an issue on GitHub." " an issue on GitHub."
) )
# check if the PDF file is generated: # check if the PDF file is generated:
@ -457,3 +458,23 @@ def run_latex(latex_file_path: str) -> str:
) )
return output_file_path 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)