Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.0.6 release #9

Merged
merged 8 commits into from
Oct 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/actions/run-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ runs:
flags: unittests
name: yogger
fail_ci_if_error: false
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
!environment.yml
!codecov.yml
!requirements-doc.txt
!requirements-test.txt

!src/
!src/*
Expand Down
13 changes: 9 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
PYTHON=python3
APP_NAME=yogger

install:
${PYTHON} -m pip install .
Expand All @@ -7,14 +8,20 @@ install-dev:
${PYTHON} -m pip install -e .

test:
@echo 'Running tests'
${PYTHON} -m pytest tests
@echo 'Done'

lint:
@echo 'Linting code'
${PYTHON} -m pylint src
@echo 'Done'

format:
@echo 'Formatting code'
${PYTHON} -m isort src tests docs/render_readme.py
${PYTHON} -m black src tests docs/render_readme.py
@echo 'Done'

build:
@echo 'Building package'
Expand All @@ -25,12 +32,10 @@ publish:
@echo 'Building package'
${PYTHON} -m build
@echo 'Uploading package'
${PYTHON} -m twine upload dist/yogger-*.tar.gz dist/yogger-*.whl
${PYTHON} -m twine upload dist/${APP_NAME}-*.tar.gz dist/${APP_NAME}-*.whl
@echo 'Done'

readme:
@echo 'Generating README.md'
@cd docs && ${PYTHON} render_readme.py
@echo 'Copying README.md'
@cp ./docs/README.md ./README.md
${PYTHON} docs/render_readme.py
@echo 'Done'
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ You should have received a copy of the GNU General Public License along with thi

---

- [Requirements](#requirements)
- [Installing](#installing)
- [Usage](#usage)
- [Library](#library)
[Requirements](#requirements)
[Installing](#installing)
[Usage](#usage)
[Library](#library)

## Installing

Expand All @@ -63,7 +63,7 @@ Development version from [**GitHub**](https://github.com/Phosmic/yogger):


![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/Phosmic/yogger/ubuntu.yml?style=flat-square)
![Codecov](https://img.shields.io/codecov/c/github/Phosmic/yogger/master?flag=unittests&style=flat-square&token=XMJZIW8ZL3)
![Codecov](https://img.shields.io/codecov/c/github/Phosmic/yogger/main?flag=unittests&style=flat-square&token=SUCI63OAKC)
![GitHub](https://img.shields.io/github/license/Phosmic/yogger?style=flat-square)


Expand Down
12 changes: 8 additions & 4 deletions docs/config.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
{
"packages_dir": "../src",
"packages_dir": "./src",
"packages": ["yogger"],
"output_file": "README.md",
"output_file": "./README.md",
"main_template": "main.md.jinja",
"templates_dir": "./templates",
"templates_dir": "./docs/templates",
"rendered_filename": "rendered_libs.md",
"template_data": {
"pypi": {
"name": "yogger",
"full_name": "Yogger"
},
"codecov": {
"branch": "main",
"graphing_token": "SUCI63OAKC"
},
"repo": {
"name": "yogger",
"full_name": "Yogger",
"owner": "Phosmic",
"badge_style": "flat-square",
"primary_branch": "master",
"primary_branch": "main",
"actions_template": "ubuntu.yml"
}
}
Expand Down
14 changes: 9 additions & 5 deletions docs/render_readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from pydoc_markdown.contrib.renderers.markdown import MarkdownRenderer
from pydoc_markdown.interfaces import Context

logger = logging.getLogger(__name__)
logger: logging.Logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)


Expand Down Expand Up @@ -114,13 +114,14 @@ def main() -> None:
"-c",
"--config",
type=Path,
default="config.json",
default=Path("docs/config.json"),
help="Path to the config file.",
)
args = parser.parse_args()
config_file_path: Path = args.config

# Load the config
with open(args.config, mode="r", encoding="utf-8") as file:
with open(config_file_path.resolve(), mode="r", encoding="utf-8") as file:
config = json.loads(file.read())

# Generate the library documentation
Expand All @@ -133,12 +134,15 @@ def main() -> None:

# Render the markdown readme
# TODO: Move this to a separate function?
loader = FileSystemLoader(config["templates_dir"])
templates_dir_path = Path(config["templates_dir"])
loader = FileSystemLoader(templates_dir_path.resolve())

environment = Environment(loader=loader, auto_reload=False)
template = environment.get_template(config["main_template"])
rendered = template.render(**config["template_data"])

with open(config["output_file"], mode="w", encoding="utf-8") as file:
output_file_path = Path(config["output_file"])
with open(output_file_path.resolve(), mode="w", encoding="utf-8") as file:
file.write(rendered)


Expand Down
4 changes: 2 additions & 2 deletions docs/templates/install.md.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ Development version from [**GitHub**](https://github.com/{{ repo.owner }}/{{ rep

{% if repo.badge_style %}
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/{{ repo.owner }}/{{ repo.name }}/{{ repo.actions_template }}?style={{ repo.badge_style }})
![Codecov](https://img.shields.io/codecov/c/github/{{ repo.owner }}/{{ repo.name }}/{{ repo.primary_branch }}?flag=unittests&style={{ repo.badge_style }}&token=XMJZIW8ZL3)
![Codecov](https://img.shields.io/codecov/c/github/{{ repo.owner }}/{{ repo.name }}/{{ codecov.branch }}?flag=unittests&style={{ repo.badge_style }}&token={{ codecov.graphing_token }})
![GitHub](https://img.shields.io/github/license/{{ repo.owner }}/{{ repo.name }}?style={{ repo.badge_style }})
{% else %}
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/{{ repo.owner }}/{{ repo.name }}/{{ repo.actions_template }})](https://github.com/{{ repo.owner }}/{{ repo.name }})
[![Codecov](https://img.shields.io/codecov/c/github/{{ repo.owner }}/{{ repo.name }}/{{ repo.primary_branch }}?flag=unittests&token=XMJZIW8ZL3)](https://github.com/{{ repo.owner }}/{{ repo.name }})
[![Codecov](https://img.shields.io/codecov/c/github/{{ repo.owner }}/{{ repo.name }}/{{ codecov.branch }}?flag=unittests&token={{ codecov.graphing_token }})](https://github.com/{{ repo.owner }}/{{ repo.name }})
[![GitHub](https://img.shields.io/github/license/{{ repo.owner }}/{{ repo.name }})](https://github.com/{{ repo.owner }}/{{ repo.name }})
{% endif %}

Expand Down
4 changes: 4 additions & 0 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pytest>=7.0.0
pytest-cov
pytest-xdist>=2.2.0
# pytest-asyncio>=0.17
2 changes: 1 addition & 1 deletion src/yogger/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
)
from .pformat import pformat

__version__ = "0.0.6a"
__version__ = "0.0.6"

__all__ = [
"configure",
Expand Down
4 changes: 2 additions & 2 deletions src/yogger/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
stack = inspect.stack()
if len(stack) > 2:
path = _dump(stack=stack[2:][::-1], err=None, dump_path=None)
super().log(level, DUMP_MSG, path=path)
super().log(level, DUMP_MSG.format(path=path))

Check warning on line 42 in src/yogger/base.py

View check run for this annotation

Codecov / codecov/patch

src/yogger/base.py#L42

Added line #L42 was not covered by tests

def warning(self, *args, **kwargs) -> None:
self._log_with_stack(logging.WARNING, *args, **kwargs)
Expand Down Expand Up @@ -198,12 +198,12 @@
Returns:
str: Representation of the stack.
"""
msg = ""
msg += _stack_dumps(stack=stack, package_name=package_name)

Check warning on line 202 in src/yogger/base.py

View check run for this annotation

Codecov / codecov/patch

src/yogger/base.py#L201-L202

Added lines #L201 - L202 were not covered by tests
if err is not None:
msg += "\n\n"
msg += _exception_dumps(err=err)
return msg

Check warning on line 206 in src/yogger/base.py

View check run for this annotation

Codecov / codecov/patch

src/yogger/base.py#L204-L206

Added lines #L204 - L206 were not covered by tests


def dump(
Expand Down Expand Up @@ -288,7 +288,7 @@
trace = inspect.trace()
if len(trace) > 1:
path = _dump(stack=trace[1:], err=err, dump_path=dump_path)
_logger.fatal(DUMP_MSG, path=path)
_logger.fatal(DUMP_MSG.format(path=path))

Check warning on line 291 in src/yogger/base.py

View check run for this annotation

Codecov / codecov/patch

src/yogger/base.py#L291

Added line #L291 was not covered by tests

raise

Expand Down
Loading