Skip to content

Commit

Permalink
Fixed README.md, bumped to v0.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowy-pycoder committed Dec 9, 2024
1 parent ac894ef commit adee254
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# paya - Simple tool that converts YAML configuration files to Python objects
# pyya - Simple tool that converts YAML configuration files to Python objects

![PyPI - Downloads](https://img.shields.io/pypi/dd/pyya)
[![ClickPy Dashboard](https://img.shields.io/badge/clickpy-dashboard-orange)](https://clickpy.clickhouse.com/dashboard/pyya)
Expand All @@ -12,7 +12,7 @@

- Very `lightweight` and `simple` API (currently it contains only one function)
- `Easy` to use
- Based on popular and well-tested libraries (like `camel-converter` and `munch`)
- Based on popular and well-tested libraries (like `camel-converter`, `PyYAML` and `munch`)
- Automatically `merge` default and production configuration files
- Convert keys in configuration files to `snake_case`

Expand Down Expand Up @@ -64,9 +64,9 @@ print(json.dumps(config.database))

As you can see, `pyya` automatically merges default config file with production config file.

Under the hood `pyya` uses [munch](https://pypi.org/project/munch/) library to create attribute-stylish dictionaries.
Under the hood `pyya` uses [PyYAML](https://pypi.org/project/PyYAML/) to parse YAML files and [munch](https://pypi.org/project/munch/) library to create attribute-stylish dictionaries.

`paya` automatically adds underscore prefix to Python keywords and can be configured to convert `camelCase` or `PascalCase` keys to `snake_case`.
`pyya` automatically adds underscore prefix to Python keywords and can be configured to convert `camelCase` or `PascalCase` keys to `snake_case`.

If `raise_error_non_identifiers=True`, `pyya` will raise error if section name is not valid Python identifier.

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "pyya"
version = "0.1.1"
version = "0.1.2"
authors = [
{ name="shadowy-pycoder", email="[email protected]" },
]
Expand Down
10 changes: 5 additions & 5 deletions pyya.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: pyya
Version: 0.1.1
Version: 0.1.2
Summary: Convert YAML configuration files to Python objects
Author-email: shadowy-pycoder <[email protected]>
Project-URL: Homepage, https://github.com/shadowy-pycoder/pyya
Expand All @@ -24,7 +24,7 @@ Requires-Dist: munch>=4.0.0
Requires-Dist: pyyaml>=6.0.2
Requires-Dist: types-pyyaml>=6.0.12.20240917

# paya - Simple tool that converts YAML configuration files to Python objects
# pyya - Simple tool that converts YAML configuration files to Python objects

![PyPI - Downloads](https://img.shields.io/pypi/dd/pyya)
[![ClickPy Dashboard](https://img.shields.io/badge/clickpy-dashboard-orange)](https://clickpy.clickhouse.com/dashboard/pyya)
Expand All @@ -38,7 +38,7 @@ Requires-Dist: types-pyyaml>=6.0.12.20240917

- Very `lightweight` and `simple` API (currently it contains only one function)
- `Easy` to use
- Based on popular and well-tested libraries (like `camel-converter` and `munch`)
- Based on popular and well-tested libraries (like `camel-converter`, `PyYAML` and `munch`)
- Automatically `merge` default and production configuration files
- Convert keys in configuration files to `snake_case`

Expand Down Expand Up @@ -90,9 +90,9 @@ print(json.dumps(config.database))

As you can see, `pyya` automatically merges default config file with production config file.

Under the hood `pyya` uses [munch](https://pypi.org/project/munch/) library to create attribute-stylish dictionaries.
Under the hood `pyya` uses [PyYAML](https://pypi.org/project/PyYAML/) to parse YAML files and [munch](https://pypi.org/project/munch/) library to create attribute-stylish dictionaries.

`paya` automatically adds underscore prefix to Python keywords and can be configured to convert `camelCase` or `PascalCase` keys to `snake_case`.
`pyya` automatically adds underscore prefix to Python keywords and can be configured to convert `camelCase` or `PascalCase` keys to `snake_case`.

If `raise_error_non_identifiers=True`, `pyya` will raise error if section name is not valid Python identifier.

Expand Down
10 changes: 5 additions & 5 deletions pyya/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@


logging.basicConfig(format='%(asctime)-15s \t%(levelname)-8s \t%(name)-8s \t%(message)s')
logger = logging.getLogger('paya')
logger = logging.getLogger(__name__)


ConfigType = Dict[str, Any]


class PayaError(RuntimeError): ...
class PyyaError(RuntimeError): ...


def init_config(
Expand All @@ -42,7 +42,7 @@ def _sanitize_section(section: str) -> str:
if raise_error_non_identifiers and not section.isidentifier():
err_msg = f'section `{section}` is not a valid identifier, aborting'
logger.error(err_msg)
raise PayaError(err_msg)
raise PyyaError(err_msg)
if keyword.iskeyword(section):
logger.warning(f'section `{section}` is a keyword, renaming to `_{section}`')
section = f'_{section}'
Expand All @@ -55,7 +55,7 @@ def _sanitize_section(section: str) -> str:
raise FileNotFoundError()
except FileNotFoundError as e:
logger.error(e)
raise PayaError(f'{default_config} file is missing or empty') from None
raise PyyaError(f'{default_config} file is missing or empty') from None
try:
with open(Path(config)) as fstream:
_raw_data: ConfigType = yaml.safe_load(fstream) or {}
Expand All @@ -68,4 +68,4 @@ def _sanitize_section(section: str) -> str:
except Exception as e:
message = f'{default_config} file is corrupted: {repr(e)}'
logger.error(message)
raise PayaError(message) from None
raise PyyaError(message) from None

0 comments on commit adee254

Please sign in to comment.