AlTosterino / ADR-py

ADR Tools but using Python
28 stars 1 forks source link

Init process does not work. #7

Closed iiwolf closed 1 week ago

iiwolf commented 3 weeks ago

Hello, I just found this package and tried to adr init and adir init docs/adr and I get this error:

│ C:\Users\WolfI\Anaconda3\envs\saga-3.11\Lib\site-packages\adrpy\repositories\adr\repository.py:2 │
│ 0 in create                                                                                      │
│                                                                                                  │
│   17 │                                                                                           │
│   18 │   def create(self, adr_name: str, template: RenderedTemplate) -> None:                    │
│   19 │   │   print(self.settings)                                                                │
│ ❱ 20 │   │   self.settings.adr_dir.mkdir(parents=True, exist_ok=True)                            │
│   21 │   │   with open(                                                                          │
│   22 │   │   │   self.settings.adr_dir / self.__get_filename_with_extension(name=adr_name), "    │
│   23 │   │   ) as file:                                                                          │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ adr_name = '0001-record-architecture-decisions'                                              │ │
│ │     self = <adrpy.repositories.adr.repository.ADRFileRepository object at                    │ │
│ │            0x000001ECF7D664D0>                                                               │ │
│ │ template = RenderedTemplate(                                                                 │ │
│ │            │   name='initial-adr.md',                                                        │ │
│ │            │   content='# 1. Record architecture decisions\n\nDate: 08/07/2024 10:37\n\n##   │ │
│ │            Status\n\nACCEPTED\n'+324                                                         │ │
│ │            )                                                                                 │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'NoneType' object has no attribute 'mkdir'

From the documentation, my understanding is I just run this and initializes the report to use adr properly? Namely, looks like self.settings.adr_dir is not being set.

Thanks!

AlTosterino commented 3 weeks ago

Hey!

Thanks for the report -- I was able to reproduce this issue (wrong order of injection, and how the None path is handled), and I'll fix it today

Have a great day 🎉

AlTosterino commented 3 weeks ago

@iiwolf Hey! Are you able to git clone this PR: https://github.com/AlTosterino/ADR-py/pull/8 and do: pip install -e . inside the cloned directory? It will install adrpy from your local machine and you can check if the problem still exists.

Thanks in advance

iiwolf commented 3 weeks ago

Hey @AlTosterino thank you for the quick response - yes I will try to do that in the next few hours!

AlTosterino commented 2 weeks ago

@iiwolf Hey! Did you have time to check if the issue is resolved? 😃