Fix partial installation errors (#326)

* make dependencies more flexible

* Fix partial installation errors
This commit is contained in:
Sina Atalay
2025-01-25 17:11:54 -05:00
committed by GitHub
parent 0439f14d77
commit 3f31496af3
7 changed files with 38 additions and 72 deletions

View File

@@ -56,12 +56,13 @@ requires-python = '>=3.10'
# RenderCV depends on these packages. They will be installed automatically when RenderCV
# is installed:
dependencies = [
'Jinja2==3.1.5', # to generate Typst and Markdown files
'Jinja2>=3.1.3', # to generate Typst and Markdown files
'phonenumbers==8.13.53', # to validate phone numbers
'email-validator==2.2.0', # to validate email addresses
'pydantic==2.10.5', # to validate and parse the input file
'pycountry==24.6.1', # for ISO 639-3 validation
'pydantic-extra-types==2.10.2', # to validate some extra types
'ruamel.yaml==0.18.6', # to parse YAML files
]
classifiers = [
"Intended Audience :: Science/Research",
@@ -72,6 +73,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
] # go to https://pypi.org/classifiers/ to see all classifiers
@@ -79,18 +81,18 @@ dynamic = ["version"] # We will use hatchling to generate the version number
[project.optional-dependencies]
full = [
'ruamel.yaml==0.18.6', # to parse YAML files
'typer==0.15.1', # to create the command-line interface
"markdown==3.7", # to convert Markdown to HTML
"watchdog==6.0.0", # to poll files for updates
"typst==0.12.2", # to render PDF from Typst source files
"rendercv-fonts==0.3.0", # some font files for RenderCV
"packaging==24.2", # to validate the version number
'typer==0.15.1', # to create the command-line interface
"markdown==3.7", # to convert Markdown to HTML
"watchdog==6.0.0", # to poll files for updates
"typst==0.12.3", # to render PDF from Typst source files
"rendercv-fonts", # some font files for RenderCV
"packaging==24.2", # to validate the version number
]
[project.urls]
# Here, we can specify the URLs related to RenderCV. They will be listed under the
# "Project links" section in PyPI. See https://pypi.org/project/rendercv/
"Web App" = 'https://rendercv.com'
Source = 'https://github.com/rendercv/rendercv'
Documentation = 'https://docs.rendercv.com'
Changelog = 'https://docs.rendercv.com/changelog'

View File

@@ -5,18 +5,23 @@ CLI and [Rich](https://rich.readthedocs.io/en/latest/) to provide a nice-looking
interface.
"""
from .commands import (
app,
cli_command_create_theme,
cli_command_new,
cli_command_no_args,
cli_command_render,
)
try:
from .commands import (
app,
cli_command_create_theme,
cli_command_new,
cli_command_no_args,
cli_command_render,
)
__all__ = [
"app",
"cli_command_create_theme",
"cli_command_new",
"cli_command_no_args",
"cli_command_render",
]
__all__ = [
"app",
"cli_command_create_theme",
"cli_command_new",
"cli_command_no_args",
"cli_command_render",
]
except ImportError as e:
from .. import _parial_install_error_message
raise ImportError(_parial_install_error_message) from e

View File

@@ -7,18 +7,12 @@ import copy
import pathlib
from typing import Annotated, Optional
import typer
from rich import print
from .. import __version__, data
from . import printer, utilities
try:
import typer
except ImportError as e:
from .. import _parial_install_error_message
raise ImportError(_parial_install_error_message) from e
app = typer.Typer(
rich_markup_mode="rich",
add_completion=False,

View File

@@ -8,6 +8,7 @@ from collections.abc import Callable
from typing import Optional
import jinja2
import packaging.version
import pydantic
import rich
import rich.live
@@ -15,15 +16,8 @@ import rich.panel
import rich.progress
import rich.table
import rich.text
try:
import typer
except ImportError as e:
from .. import _parial_install_error_message
raise ImportError(_parial_install_error_message) from e
import packaging.version
import ruamel.yaml
import typer
from rich import print
from .. import __version__, data
@@ -267,12 +261,6 @@ def handle_and_print_raised_exceptions_without_exit(function: Callable) -> Calla
Returns:
The wrapped function.
"""
try:
import ruamel.yaml
except Exception as e:
from .. import _parial_install_error_message
raise ImportError(_parial_install_error_message) from e
@functools.wraps(function)
def wrapper(*args, **kwargs):

View File

@@ -13,14 +13,10 @@ import urllib.request
from collections.abc import Callable
from typing import Any, Optional
try:
import typer
except ImportError as e:
from .. import _parial_install_error_message
raise ImportError(_parial_install_error_message) from e
import packaging.version
import typer
import watchdog.events
import watchdog.observers
from .. import data, renderer
from . import printer
@@ -424,14 +420,6 @@ def run_a_function_if_a_file_changes(file_path: pathlib.Path, function: Callable
file_path (pathlib.Path): The path of the file to watch for.
function (Callable): The function to be called on file modification.
"""
try:
import watchdog.events
import watchdog.observers
except Exception as e:
from .. import _parial_install_error_message
raise ImportError(_parial_install_error_message) from e
# Run the function immediately for the first time
function()

View File

@@ -9,6 +9,7 @@ import pathlib
from typing import Optional
import pydantic
import ruamel.yaml
from . import models, reader
@@ -22,13 +23,6 @@ def dictionary_to_yaml(dictionary: dict) -> str:
Returns:
The YAML string.
"""
try:
import ruamel.yaml
except Exception as e:
from .. import _parial_install_error_message
raise ImportError(_parial_install_error_message) from e
yaml_object = ruamel.yaml.YAML()
yaml_object.encoding = "utf-8"
yaml_object.width = 60

View File

@@ -9,6 +9,7 @@ import re
from typing import Optional
import pydantic
import ruamel.yaml
from . import models
from .models import entry_types
@@ -225,12 +226,6 @@ def read_a_yaml_file(file_path_or_contents: pathlib.Path | str) -> dict:
Returns:
The content of the YAML file as a dictionary.
"""
try:
import ruamel.yaml
except Exception as e:
from .. import _parial_install_error_message
raise ImportError(_parial_install_error_message) from e
if isinstance(file_path_or_contents, pathlib.Path):
# Check if the file exists: