<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Architecture on Ashlynn Antrobus</title><link>https://ashlynnantrobus.dev/tags/architecture/</link><description>Recent content in Architecture on Ashlynn Antrobus</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Mon, 26 Aug 2024 23:01:24 +0000</lastBuildDate><atom:link href="https://ashlynnantrobus.dev/tags/architecture/index.xml" rel="self" type="application/rss+xml"/><item><title>Unit Testing Difficulty is an Indicator of (Low) Code Quality</title><link>https://ashlynnantrobus.dev/posts/unit-testing-difficulty-is-an-indicator-of-low-code-quality/</link><pubDate>Mon, 26 Aug 2024 23:01:24 +0000</pubDate><guid>https://ashlynnantrobus.dev/posts/unit-testing-difficulty-is-an-indicator-of-low-code-quality/</guid><description>&lt;p&gt;When I first read about unit testing, I’ll admit, it sounded like one of those things that only seasoned developers would bother with. It seemed like a maze of confusing terms and intimidating processes that only experts could navigate.  I didn’t write my first test for over a year after I started my coding journey. Until then, my version of testing was typing &lt;code&gt;python my\_project.py&lt;/code&gt; in the terminal. Or, I will sheepishly admit, just hitting the “Run” button in VS Code (and Replit before that). Then waiting for it to crash and debugging from there. It was my version of compiled languages developers who claim that if the code compiles, it must be free of errors.&lt;/p&gt;</description></item><item><title>Evolution of a codebase</title><link>https://ashlynnantrobus.dev/posts/evolution-of-a-codebase/</link><pubDate>Mon, 15 Jul 2024 04:27:52 +0000</pubDate><guid>https://ashlynnantrobus.dev/posts/evolution-of-a-codebase/</guid><description>&lt;p&gt;When I wrote the first version of Lorebinders, I hadn&amp;rsquo;t yet started exploring object oriented programming. v1 has comprised by a series of functions strung in a row, one, calling the next.&lt;/p&gt;&#10;&lt;p&gt;Unfortunately (or maybe fortunately!), that code was gone before I discovered version control. It is gone for ever.&lt;/p&gt;&#10;&lt;p&gt;For the first refactoring, I organized it a little better, but still depended sole on functions like these:&lt;/p&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;def search_names(chapters: list, folder_name: str, num_chapters: int, character_lists: list, character_lists_index: int) -&amp;gt; list:&#10;&#10; character_lists_path = os.path.join(folder_name, &amp;#34;character_lists.json&amp;#34;)&#10; role_script = ner_role_script(folder_name)&#10; model = &amp;#34;gpt_three&amp;#34;&#10; max_tokens = 1000&#10; temperature = 0.2&#10;&#10; with tqdm(total = num_chapters, unit = &amp;#34;Chapter&amp;#34;, ncols = 40, bar_format = &amp;#34;|{l_bar}{bar}|&amp;#34;, position = 0, leave = True) as progress_bar:&#10; for chapter_index, chapter in enumerate(chapters):&#10; progress_bar.set_description(f&amp;#34;\033[92mProcessing chapter {chapter_index + 1} of {num_chapters}&amp;#34;, refresh = True)&#10; if chapter_index &amp;lt; character_lists_index:&#10; progress_bar.update(1)&#10; continue&#10; chapter_number = chapter_index + 1&#10; prompt = f&amp;#34;Text: {chapter}&amp;#34;&#10; character_list = cf.call_gpt_api(model, prompt, role_script, temperature, max_tokens)&#10; chapter_tuple = (chapter_number, character_list)&#10; character_lists.append(chapter_tuple)&#10; cf.append_json_file(chapter_tuple, character_lists_path)&#10; progress_bar.update(1)&#10; cf.clear_screen()&#10; return character_lists&#10;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;When I started v2, leaning into object oriented programing principles, I quickly learned that classes don&amp;rsquo;t make dependency and coupling any simpler. I needed to initialize the API class, get the text from the chapter, and save the response to the chapter. It looked easy to organize when each class was was separate.&lt;/p&gt;</description></item><item><title>Back to the __future__ and import annotations</title><link>https://ashlynnantrobus.dev/posts/back-to-the-__future__-and-import-annotations/</link><pubDate>Sun, 30 Jun 2024 22:56:25 +0000</pubDate><guid>https://ashlynnantrobus.dev/posts/back-to-the-__future__-and-import-annotations/</guid><description>&lt;p&gt;After last week, I thought I was done with module import errors. Turns out, I had only just started with them.&lt;/p&gt;&#10;&lt;p&gt;After months of hard work, I have finally written all of the code for my LoreBinders project. Now to see if it works!&lt;/p&gt;&#10;&lt;p&gt;So I wrote tests for everything, typed &lt;code&gt;pytest&lt;/code&gt; into the terminal and hit enter.&lt;/p&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;ImportError while importing test module &amp;#39;vscode\ProsePal\lorebinders\tests\test_ai_factory.py&amp;#39;.&#10;Hint: make sure your test modules/packages have valid Python names.&#10;Traceback:&#10; from lorebinders._managers import EmailManager, RateLimitManager&#10;src\lorebinders\_managers.py:4: in &#10;from _types import AIModelRegistry, APIProvider, Model, ModelFamily&#10;src\lorebinders_types.py:12: in&#10;from _managers import AIProviderManager, EmailManager, ErrorManager&#10;src\lorebinders_managers.py:4: in&#10;from _types import AIModelRegistry, APIProvider, Model, ModelFamily&#10;E ImportError: cannot import name &amp;#39;AIModelRegistry&amp;#39; from partially initialized module &amp;#39;_types&amp;#39; (most likely due to a circular import)&#10;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;15 times. Different modules, same problem.&lt;/p&gt;</description></item></channel></rss>