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

Use datetime built-in library #20

Merged
merged 11 commits into from
Jul 27, 2024
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ _tests/files/output-results
#/.idea/usage.statistics.xml already included below
#/.idea/shelf already included below
/.vscode
# For some reason PyCharm randomly decided to not use the uppercase Obsidian-Daylio-Parser.iml file anymore
# One day it's like "Hey, let's switch to obsidian-daylio-parser.iml, that's a much cooler config filename!"
# So I made a lowercase symlink and flipped PyCharm off
/.idea/obsidian-daylio-parser.iml
/.idea/inspectionProfiles/Project_Default.xml
/.idea/Obsidian-Daylio-Parser.bak.iml

Expand Down
3 changes: 1 addition & 2 deletions .idea/Obsidian-Daylio-Parser.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions .idea/runConfigurations/Run_all_tests.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 4 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@ LABEL org.label-schema.name="Obsidian Daylio Parser"
LABEL org.label-schema.description="Convert .csv Daylio backup into markdown notes."
LABEL org.label-schema.url="https://github.com/DeutscheGabanna/Obsidian-Daylio-Parser/"

COPY src /app/src/
COPY _tests /app/_tests/

WORKDIR /app
COPY tests .
RUN pip install daylio-obsidian-parser

RUN mkdir output

ENTRYPOINT [ "python", "src/main.py" ]
CMD [ "_tests/sheet-1-valid-data.csv", "output"]
ENTRYPOINT ["daylio_to_md"]
CMD ["--help"]
13 changes: 13 additions & 0 deletions Dockerfile-test-suite
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM python:3.13.0b2-slim-bookworm

LABEL org.label-schema.schema-version="1.0"
LABEL org.label-schema.name="Obsidian Daylio Parser"
LABEL org.label-schema.description="Convert .csv Daylio backup into markdown notes."
LABEL org.label-schema.url="https://github.com/DeutscheGabanna/Obsidian-Daylio-Parser/"

WORKDIR /app
COPY tests/ .
RUN pip install daylio-obsidian-parser

ENTRYPOINT ["daylio_to_md"]
CMD ["--help"]
13 changes: 11 additions & 2 deletions src/daylio_to_md/__main__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import sys
import logging

from daylio_to_md.config import options
from daylio_to_md.librarian import Librarian
from daylio_to_md.librarian import Librarian, CannotAccessJournalError, EmptyJournalError


def main():
Expand All @@ -17,4 +18,12 @@ def main():


if __name__ == '__main__':
main()
try:
main()
except CannotAccessJournalError as err:
# Invoking help() instead of writing it directly just helps to cut down on duplicate strings
logging.getLogger(__name__).critical(err.__doc__)
sys.exit(1)
except EmptyJournalError as err:
logging.getLogger(__name__).critical(err.__doc__)
sys.exit(2)
3 changes: 3 additions & 0 deletions src/daylio_to_md/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
├── suffix
├── colour
└── header

"""
# https://www.doc.ic.ac.uk/~nuric/posts/coding/how-to-handle-configuration-in-python/

import argparse
import logging
from typing import List, Any
Expand Down
258 changes: 0 additions & 258 deletions src/daylio_to_md/dated_entries_group.py

This file was deleted.

Loading
Loading