<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Noel on Medium]]></title>
        <description><![CDATA[Stories by Noel on Medium]]></description>
        <link>https://medium.com/@noelvalent?source=rss-2ffcd15bc9ea------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*BMsvF6tfq3BgkRhrTrZFkw.png</url>
            <title>Stories by Noel on Medium</title>
            <link>https://medium.com/@noelvalent?source=rss-2ffcd15bc9ea------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 22:33:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@noelvalent/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Noel’s memoirs of April]]></title>
            <link>https://noelvalent.medium.com/noels-memoirs-of-april-d1dbec2956c7?source=rss-2ffcd15bc9ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/d1dbec2956c7</guid>
            <category><![CDATA[english]]></category>
            <category><![CDATA[memoir]]></category>
            <dc:creator><![CDATA[Noel]]></dc:creator>
            <pubDate>Wed, 11 May 2022 11:05:29 GMT</pubDate>
            <atom:updated>2022-05-11T11:05:29.594Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*ABs0cxvsbeLBFmWdbv5tWA.jpeg" /></figure><p>It has already been 4 months since I started writing my monthly memoir.<br>At first, I started with the goal of documenting my achievements for a month and quickly figuring out what I did wrong, but unfortunately, it seems that these plans and directions are quickly crumbling as a number of problems start to overlap.</p><h3>Blog Posting Achievements</h3><p>A total of 5 blog posts wrote this month.</p><ul><li>Features of PyCharm used for Python study and research (<a href="https://medium.com/enklabs/features-of-pycharm-used-for-python-study-and-research-abe6c82e0bd7">Link</a>)</li><li>Analysis of CPython (<a href="https://medium.com/enklabs/analysis-of-cpython-3cbde900eced">Link</a>)</li><li>Multipass — An easy-to-use Ubuntu virtual environment (<a href="https://medium.com/enklabs/multipass-an-easy-to-use-ubuntu-virtual-environment-79c235b52b37">Link</a>)</li><li>Try the Python dependency manager Poetry (<a href="https://medium.com/enklabs/try-the-python-dependency-manager-poetry-b116b6df2c6b">Link</a>)</li><li>Deploying the JDA discord bot with Docker (<a href="https://medium.com/enklabs/deploying-the-jda-discord-bot-with-docker-dea1d986a094">Link</a>)</li></ul><p>Actually, the purpose of blogging was to record the results of my research, and I think that the sub-topics I wrote this time fit my purpose well.</p><p>There were also new topics that I hadn’t planned at all. In the case of Multipass, I was introduced to it by a friend and I felt it was so interesting that I wrote it to share with others, and <em>Deploying the JDA discord bot with Docker</em> is written for future me.</p><h3>About Music</h3><p>Recently, I haven’t been able to deal with speech synthesis engines like Vocaloid and Synthesizer V. Last month I was swamped, and I spent some time figuring out a sequencer program to practice on in the future.</p><h3>E.T.C</h3><p>Since I bought an m1 MacBook, I used it for the first time fully.</p><p>It does not mean that it was used just for development, but that it took advantage of Arm architecture. Recently, while all my servers were cleaned up, a new deployment strategy and server architecture were formed, and all x86-based servers were migrated to Arm-based.</p><p>In this process, I had to re-develop the chatbot from scratch, but the price/performance ratio is quite good, and by Dockerizing all the server apps, the deployment process itself is significantly simplified.</p><p>I will write about practical change in a new post next month.</p><h3>From now on</h3><p>This month, I’m going to proceed with development focusing on the development of the <strong>Unity AI simulator </strong>and remaking <strong>the Purine library</strong>, which we could not do last month. Also as the Cubase dongle key has recently disappeared, we are aiming to complete a self-composed song through a trial version as well.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d1dbec2956c7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[노엘의 4월 회고록]]></title>
            <link>https://noelvalent.medium.com/%EB%85%B8%EC%97%98%EC%9D%98-4%EC%9B%94-%ED%9A%8C%EA%B3%A0%EB%A1%9D-f014ce9ed37d?source=rss-2ffcd15bc9ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/f014ce9ed37d</guid>
            <category><![CDATA[memoir]]></category>
            <category><![CDATA[korean]]></category>
            <dc:creator><![CDATA[Noel]]></dc:creator>
            <pubDate>Wed, 11 May 2022 10:43:52 GMT</pubDate>
            <atom:updated>2022-05-11T10:46:00.858Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*ABs0cxvsbeLBFmWdbv5tWA.jpeg" /></figure><p>벌써 월간 회고록을 작성하기 시작한 지 4개월이 되었습니다.<br>처음에는 내가 한 달 동안 이룬 업적을 기록하고 잘못한 것을 빠르게 파악하자는 취지로 시작했으나, 여러 가지 문제가 겹치기 시작하면서 이러한 계획과 방향이 빠르게 무너지는 것 같습니다.</p><h3>블로그 포스팅 성과</h3><p>이번 달에는 총 5개의 블로그 포스트가 작성되었습니다.</p><ul><li>Python 공부 및 연구를 위해 사용하는 PyCharm의 기능들(<a href="https://medium.com/enklabskr/python-%EA%B3%B5%EB%B6%80-%EB%B0%8F-%EC%97%B0%EA%B5%AC%EB%A5%BC-%EC%9C%84%ED%95%B4-%EC%82%AC%EC%9A%A9%ED%95%98%EB%8A%94-pycharm%EC%9D%98-%EA%B8%B0%EB%8A%A5%EB%93%A4-29255b02837f">링크</a>)</li><li>CPython 분석하기(<a href="https://medium.com/enklabskr/cpython-%EB%B6%84%EC%84%9D%ED%95%98%EA%B8%B0-5549f3c9f0f8">링크</a>)</li><li>Multipass — 쉽게 사용하는 우분투 가상환경(<a href="https://medium.com/enklabskr/multipass-%EC%89%BD%EA%B2%8C-%EC%82%AC%EC%9A%A9%ED%95%98%EB%8A%94-%EC%9A%B0%EB%B6%84%ED%88%AC-%EA%B0%80%EC%83%81-%ED%99%98%EA%B2%BD-5d302b403fd8">링크</a>)</li><li>파이썬 의존성 관리자 Poetry를 사용해보자(<a href="https://medium.com/enklabskr/%ED%8C%8C%EC%9D%B4%EC%8D%AC-%EC%9D%98%EC%A1%B4%EC%84%B1-%EA%B4%80%EB%A6%AC%EC%9E%90-poetry%EB%A5%BC-%EC%82%AC%EC%9A%A9%ED%95%B4%EB%B3%B4%EC%9E%90-29ec3ac1d898">링크</a>)</li><li>JDA discord bot을 Docker로 배포하기(<a href="https://medium.com/enklabskr/jda-discord-bot%EC%9D%84-docker%EB%A1%9C-%EB%B0%B0%ED%8F%AC%ED%95%98%EA%B8%B0-fdf1b827c197">링크</a>)</li></ul><p>원래 블로그 운영 목적이 내가 연구한 결과물을 기록해 보자는 취지였고, 이번에 작성한 소제들은 제 취지 잘 맞는 소제들이었다고 생각합니다.</p><p>그중에는 전혀 계획하지 않았던 새로운 소제들이 있었는데, Multipass의 경우 친구의 소개로 접했고 너무 신기하다고 느껴서 다른 이들과 공유하기 위해 작성했고, JDA Docker 배포 글의 경우, 제가 필요에 의해 연구하고 그 결과를 미래의 저를 위해 다시 기록한 내용이기도 합니다.</p><h3>음악 분야</h3><p>최근에 보컬로이드와 신디사이저 V 같은 음성 합성 엔진을 다루지 못하고 있습니다. 지난달 너무 바쁘기도 했고, 앞으로 연습할 시퀀서 프로그램을 모색하는 데 시간을 좀 사용했습니다.</p><h3>그 외</h3><p>m1 맥북을 구매하고 처음으로 이 맥북을 활용했습니다.</p><p>단순히 개발로서 활용했다는 의미가 아니라 Arm 특성을 활용했다는 의미인데, 최근 서버를 전부 정리하면서 새로운 배포 전략 및 서버 아키텍처를 구성하면서 x86 기반 서버를 전부 Arm 기반으로 이주했습니다.</p><p>이 과정에서 챗봇을 처음부터 다시 개발해야 했습니다만, 가격 대비 성능이 상당히 저렴하고, 모든 서버 앱을 Dockerize 함으로써 배포 과정 자체도 상당히 줄어들었습니다.</p><p>실질적인 변화는 다음 달에 새로운 포스트로 작성할 예정입니다.</p><h3>앞으로</h3><p>이번 달에는 지난달에 못했던 유니티 ai 시뮬레이터, 푸린 도서관 리메이크를 중심으로 개발을 진행하려고 하며, 최근 큐베이스 동글키가 사라짐에 따라 체험판을 통해 자작곡 한 곡을 완성해 보는 것을 목표로 하고 있습니다.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f014ce9ed37d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JDA discord bot을 Docker로 배포하기]]></title>
            <link>https://noelvalent.medium.com/jda-discord-bot%EC%9D%84-docker%EB%A1%9C-%EB%B0%B0%ED%8F%AC%ED%95%98%EA%B8%B0-fdf1b827c197?source=rss-2ffcd15bc9ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/fdf1b827c197</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[korean]]></category>
            <category><![CDATA[engineering]]></category>
            <dc:creator><![CDATA[Noel]]></dc:creator>
            <pubDate>Tue, 03 May 2022 12:36:27 GMT</pubDate>
            <atom:updated>2022-05-03T12:36:27.618Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D4n1nY6WGsQiWXt6JhfGUQ.png" /></figure><p>최근에 지금까지 개발한 웹 서비스를 Docker로 옮기는 작업을 하고 있습니다. 하지만 파이썬이 스크립트 언어임에도 불구하고 파이썬으로 개발된 애플리케이션이 제 랩탑에서 빌드 했을 때, 아키텍처 에러가 종종 발생합니다.</p><p>개발용 랩탑이 m1 맥북인 제게는 예상치 못한 치명적인 이슈인데, 심지어 디스코드 봇의 경우 제가 작성한 코드보다 라이브러리 기능이 더 많아서 프로젝트 자체를 사용할 수 없는 상황이 되기도 하였습니다. (google translation api의 grpc 관련 이슈였습니다.)</p><p>이러한 이유로 다시 개발할 필요가 있었고, 또한 JVM 언어에도 관심을 가지고 있어서 챗봇 애플리케이션을 자바 옮기기로 결정했습니다.</p><p>하지만 배포에 대한 자료가 부족하기도 하고, 자바에 대한 경험이 없다 보니 봇을 로컬에서 배포하고 Docker로 옮기는데 어려움이 많았습니다.</p><h3>build.gradle 수정</h3><p>제가 가장 먼저 한 작업은 build.gradle을 수정하는 것입니다.</p><p>안드로이드를 위해 gradle을 사용했을 때와 다르게 run script가 없어서 jar를 만들어야 하는데, 특정 메타데이터나 의존성 라이브러리가 없다는 이슈가 발생했습니다.</p><pre>Gradle - no main manifest attribute</pre><p>이 이슈 해결을 위해 jar에 대해서 특정 속성을 build.gradle에 직접 추가해 주었습니다.</p><pre>tasks.jar {<br>    manifest.attributes[&#39;Main-Class&#39;] = &#39;BotEntry&#39;<br>}</pre><p>패키지가 없어서 클래스 이름만 덩그러니 있는데, 패키지 경로를 적으면 됩니다.</p><p>또한 의존성 클래스가 존재하지 않는다는 이슈도 발생하였습니다.</p><pre>Exception in thread &quot;main&quot; java.lang.NoClassDefFoundError:</pre><p>이에 대해서 여러 가지 방법을 찾아보았지만 배포를 하는 과정에서 가장 편한 작업은 의존성 라이브러리를 포함시키는 작업이었고, 이를 위해 shadowJar 플러그인을 이용했습니다.</p><pre>plugins {<br>    id &#39;java&#39;<br>    id &quot;com.github.johnrengelman.shadow&quot; version &quot;7.1.2&quot;<br>}</pre><pre>...</pre><pre>tasks.jar {<br>    finalizedBy shadowJar<br>    manifest.attributes[&#39;Main-Class&#39;] = &#39;BotEntry&#39;<br>}</pre><p>Jar가 많은 정보를 가지게 하고 이를 명령어로 실행하니 봇이 정상적으로 동작했습니다.</p><p>구글의 일부 기능을 사용할 때, 아래와 같은 정책 이슈가 발생하기도 하였습니다만..</p><pre>Could not find policy &#39;pick_first&#39;</pre><p>이를 해결하기 위해 아래의 구문이 추가되었습니다.</p><pre>shadowJar {<br>    mergeServiceFiles()<br>}</pre><h3>Docker 이미지 만들기</h3><p>이제 빌드와 실행이 성공했으니 다음 과정은 Docker 이미지로 빌드 하는 것입니다.</p><p>제가 사용한 Dockerfile전문입니다.</p><pre>FROM gradle:7.4.2-jdk17 AS build</pre><pre>MAINTAINER &quot;nv.noelvalent@gmail.com&quot;</pre><pre>COPY . /opt/gTranstateOnDiscord<br>WORKDIR /opt/gTranstateOnDiscord</pre><pre>RUN gradle jar --no-daemon</pre><pre>FROM openjdk:17</pre><pre>RUN mkdir /opt/app</pre><pre>COPY --from=build /opt/gTranstateOnDiscord/build/libs/gTranstateOnDiscord-1.0-SNAPSHOT-all.jar /opt/app/gTranstateOnDiscord-1.0-SNAPSHOT-all.jar</pre><pre>ENTRYPOINT [&quot;java&quot;, &quot;-Djava.security.egd=file:/dev/./urandom&quot;,&quot;-jar&quot;,&quot;/opt/app/gTranstateOnDiscord-1.0-SNAPSHOT-all.jar&quot;]</pre><p>Gradle 이미지로 Jar 파일을 생성하고, 이후 빌드 된 Jar 파일을 jdk 이미지로 카피한 뒤 java 명령어를 사용하여 앱을 실행했습니다.</p><h3>마무리</h3><p>jda가 일부 마인크래프트 PaaS 서비스에도 쓰이는 것으로 알고 있으나 이에 대한 배포 가이드를 모르기도 했고, 자바 애플리케이션 배포에 대한 경험이 없어서 조금 많이 헤맸던 것 같습니다.</p><p>이 글이 저와 같이 Docker를 이용해서 챗봇을 서비스하고 싶은 누군가에 도움이 되었으면 좋겠습니다.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fdf1b827c197" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying the JDA discord bot with Docker]]></title>
            <link>https://noelvalent.medium.com/deploying-the-jda-discord-bot-with-docker-dea1d986a094?source=rss-2ffcd15bc9ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/dea1d986a094</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[english]]></category>
            <dc:creator><![CDATA[Noel]]></dc:creator>
            <pubDate>Tue, 03 May 2022 12:34:31 GMT</pubDate>
            <atom:updated>2022-05-03T12:34:31.484Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D4n1nY6WGsQiWXt6JhfGUQ.png" /></figure><p>Recently, I am working on moving the web service I have developed so far to Docker. But even though Python is a scripting language, when an application developed with Python is built on my laptop, architecture errors often occur.</p><p>This is an unexpected and fatal issue for me, whose development laptop is an m1 MacBook, and even the Discord bot has more library functions than the code I wrote, so the project itself became unusable. (It was an issue with grpc of Google Translate API.)</p><p>For this reason, it was necessary to re-develop, and I was also interested in the JVM language, so I decided to move the chatbot application to Java.</p><p>However, there were a lot of difficulties in deploying the bot locally and moving it to Docker because of a lack of deployment materials and no experience in Java.</p><h3>Modify build.gradle</h3><p>The first thing I did was edit the build.gradle.</p><p>Unlike when using gradle for Android, there is no run script, so you need to create a jar, but there is an issue that there is no specific metadata or dependency library.</p><pre>Gradle - no main manifest attribute</pre><p>To solve this issue, I added a specific property for the jar directly to build.gradle.</p><pre>tasks.jar {<br>    manifest.attributes[&#39;Main-Class&#39;] = &#39;BotEntry&#39;<br>}</pre><p>There is no package, so only the class name is there, just write the package path.</p><p>There was also an issue where the dependency class didn’t exist.</p><pre>Exception in thread &quot;main&quot; java.lang.NoClassDefFoundError:</pre><p>I looked for several ways to do this, but the most convenient task in the process of deployment was to include the dependency library, and for this, the shadowJar plugin was used.</p><pre>plugins {<br>    id &#39;java&#39;<br>    id &quot;com.github.johnrengelman.shadow&quot; version &quot;7.1.2&quot;<br>}<br><br>...<br><br>tasks.jar {<br>    finalizedBy shadowJar<br>    manifest.attributes[&#39;Main-Class&#39;] = &#39;BotEntry&#39;<br>}</pre><p>When I let Jar have a lot of information and run it as a command, the bot works normally.</p><p>When using some of Google’s features, the following policy issues may occur.</p><pre>Could not find policy &#39;pick_first&#39;</pre><p>To solve this, the<em> mergeServiceFiles()</em> below has been added.</p><pre>shadowJar {<br>    mergeServiceFiles()<br>}</pre><h3>Create a Docker image</h3><p>Now that the build and execution are successful, the next step is to build the Docker image.</p><p>This is the full Dockerfile I used.</p><pre>FROM gradle:7.4.2-jdk17 AS build</pre><pre>MAINTAINER &quot;nv.noelvalent@gmail.com&quot;</pre><pre>COPY . /opt/gTranstateOnDiscord<br>WORKDIR /opt/gTranstateOnDiscord</pre><pre>RUN gradle jar --no-daemon</pre><pre>FROM openjdk:17</pre><pre>RUN mkdir /opt/app</pre><pre>COPY --from=build /opt/gTranstateOnDiscord/build/libs/gTranstateOnDiscord-1.0-SNAPSHOT-all.jar /opt/app/gTranstateOnDiscord-1.0-SNAPSHOT-all.jar</pre><pre>ENTRYPOINT [&quot;java&quot;, &quot;-Djava.security.egd=file:/dev/./urandom&quot;,&quot;-jar&quot;,&quot;/opt/app/gTranstateOnDiscord-1.0-SNAPSHOT-all.jar&quot;]</pre><p>I created a Jar file with the Gradle image, copied the built Jar file as a JDK image, and then ran the app using the java command.</p><h3>Wrap-up</h3><p>I know that JDA is also used for some Minecraft PaaS services, but I didn’t know the deployment guide for it, and I seem to have wandered a bit because I have no experience in deploying Java applications.</p><p>I hope this article is helpful to someone like me who wants to service a chatbot using Docker.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dea1d986a094" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Try the Python dependency manager Poetry]]></title>
            <link>https://noelvalent.medium.com/try-the-python-dependency-manager-poetry-b116b6df2c6b?source=rss-2ffcd15bc9ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/b116b6df2c6b</guid>
            <category><![CDATA[english]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[engineering]]></category>
            <dc:creator><![CDATA[Noel]]></dc:creator>
            <pubDate>Sun, 01 May 2022 15:19:05 GMT</pubDate>
            <atom:updated>2022-05-01T15:19:05.152Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GZoNKszTayN6ZNQuujUmJg.png" /></figure><p>While writing Reasons to Use Pycharm (<a href="https://medium.com/enklabs/features-of-pycharm-used-for-python-study-and-research-abe6c82e0bd7">link</a>), I found out that there is a dependency manager other than pip.</p><p>It is a package manager similar to Cargo of Rust language and NPM of Node.js.</p><p>In the meantime, I did not feel any inconvenience while using pip, so I did not think to find another package manager. Poetry provides some of the features that pip lacks.</p><p>In this article, we are going to briefly learn what Poetry is and try to use it.</p><h3><strong>What is Poetry?</strong></h3><p>Like pip, it is a dependency manager that manages and packages dependencies.</p><p>In addition, it is possible to directly manage the virtual environment as a global application.</p><p>The great thing about poetry is that it allows you to log information and dependencies of packages through pyproject.toml and is itself a tool for managing multiple environments.</p><p>Of course, there is also the venv module, but creating it in a separate cache directory instead of creating it within the project means that when uploading to git, there is no need to add it to gitignore, and it can be managed with a single tool without a separate tool such as pyenv in a Linux environment.</p><p>Also, it helps to develop a Python package by creating a whl file or tar.gz with a simple command and deploying it to pypi.</p><h3>Install Poetry</h3><p>It is installed through a simple script code.</p><pre>curl -sSL &lt;https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py&gt; | python -</pre><p>For Windows, a PowerShell script is also provided.</p><pre>(Invoke-WebRequest -Uri &lt;https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py&gt; -UseBasicParsing).Content | python -</pre><p>If it works when you enter the following command, the installation is complete.</p><pre>poetry --version</pre><pre># Poetry version 1.1.13</pre><h3>Basic usage of Poetry</h3><h4>Create new project</h4><pre>poetry new poetry-demo</pre><p><em>poetry-demo</em> is the name of the new project you want to create.</p><h4>Initialize existed project</h4><pre>cd pre-existing-project<br>poetry init</pre><h4>Run project</h4><pre>poetry run python your_script.py</pre><p>If you are in a specific folder, you also need to specify a relative path.<br>When poetry run is used, it runs using the virtual environment created in the cache directory.</p><h4>Install dependancy</h4><p>To install the specified dependency library in pyproject, you can use the install command. (Same principle as npm install.)</p><pre>poetry install</pre><h4>Update dependancy</h4><p>Update the list of dependencies that are already registered in <em>pyproject.toml</em> or <em>poetry.lock</em>.</p><pre>poetry update</pre><h4>Add new dependancy</h4><p>Unlike npm, you add new dependencies with <strong><em>add command </em></strong>rather than <em>install</em>.</p><pre>poetry add new-library</pre><h4>Remove dependancy</h4><pre>poetry remove new-library</pre><h4>Show dependancies</h4><pre>poetry show</pre><h4>Export dependancies</h4><p>It exports the file in a different format such as the requirements.txt.</p><pre>poetry export -f requirements.txt &gt; requirements.txt</pre><h4>Manage env</h4><p>Rather than directly installing and creating a virtual environment, Poetry is similar to creating a new virtual environment using multiple versions that have already been created.</p><p>You can regist and remove the base interpreter to use with the commands below.</p><pre># Indicate which version of Python to use<br>poetry env use /path/to/python3</pre><pre># Registered Env List<br>poetry env list</pre><pre># Delete registered env<br>poetry env remove /path/to/python3</pre><h3>Setting up a Django project using Poetry</h3><p>For the exercise, let’s create and run a Django application.</p><pre># Create new poetry project<br>poetry new djangoProject</pre><pre>cd djangoProject<br># Add a dependancy<br>poetry add django <br># Create Django project<br>poetry run django-admin startproject demoproject .<br># Add new app<br>poetry run python manage.py startapp poll<br># Run the server<br>poetry run python manage.py runserver</pre><h3>Poetry pros and cons</h3><h4>Pros</h4><p>- It is good to list the dependencies that I installed. (In the case of PIP, when extracting requirements.txt, additional dependencies are included in addition to the libraries I added, making it difficult to see and manage.)<br>- Optimized for Pypi deployments<br>- Virtual environment does not exist inside the project<br>- Supported by PyCharm</p><h4>Cons</h4><p>- A separate cache directory exists (I think this is an advantage, but it can also be a disadvantage)<br>- It can be still unstable.<br>- An unknown error occurred in environment management (There was a difficulty in registering a new environment in an environment using asdf-vm.)</p><h3>Wrap-up</h3><p>I haven’t used it in a deployment yet so I don’t understand Poetry exactly.</p><p>But, it seems to be a package manager that can be expected as the things that felt regretful in pip have been resolved.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b116b6df2c6b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[파이썬 의존성 관리자 Poetry를 사용해보자]]></title>
            <link>https://noelvalent.medium.com/%ED%8C%8C%EC%9D%B4%EC%8D%AC-%EC%9D%98%EC%A1%B4%EC%84%B1-%EA%B4%80%EB%A6%AC%EC%9E%90-poetry%EB%A5%BC-%EC%82%AC%EC%9A%A9%ED%95%B4%EB%B3%B4%EC%9E%90-29ec3ac1d898?source=rss-2ffcd15bc9ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/29ec3ac1d898</guid>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[korean]]></category>
            <dc:creator><![CDATA[Noel]]></dc:creator>
            <pubDate>Sun, 01 May 2022 14:53:54 GMT</pubDate>
            <atom:updated>2022-05-01T15:20:00.844Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GZoNKszTayN6ZNQuujUmJg.png" /></figure><p>Pycharm을 써야 하는 이유(<a href="https://medium.com/enklabskr/python-%EA%B3%B5%EB%B6%80-%EB%B0%8F-%EC%97%B0%EA%B5%AC%EB%A5%BC-%EC%9C%84%ED%95%B4-%EC%82%AC%EC%9A%A9%ED%95%98%EB%8A%94-pycharm%EC%9D%98-%EA%B8%B0%EB%8A%A5%EB%93%A4-29255b02837f">링크</a>)를 작성하던 중 pip 말고 다른 의존성 관리자가 있다는 것을 알게 되었습니다.</p><p>Rust 언어의 Cargo와 Node.js의 NPM과 유사한 모습을 가지고 있는 패키지 관리자입니다.</p><p>그동안 pip만을 이용하면서도 큰 문제가 발생한 적이 없어서 별도로 이런 패키지 관리자를 찾을 생각을 못 했었는데, Poetry는 파이썬 패키지를 구성하면서 NPM이나 Cargo는 가지고 있었지만 Python에서 쓰지 못해 아쉬웠던 몇몇 기능을 쓸 수 있게 해주는 흥미로운 친구였습니다.</p><p>이번 글에서는 간단하게 Poetry가 무엇인지 알아보고 사용해 보려고 합니다.</p><h3>Poetry란?</h3><p>pip와 같이 의존성을 관리해 주고 패키징도 해주는 의존성 관리자입니다.<br>또한 직접 환경 관리가 가능합니다.</p><p>poetry가 가지는 가장 큰 장점이라고 하면 pyproject.toml을 통해 패키지의 정보와 의존성을 기록할 수 있고 그 자체로 여러 환경을 관리할 수 있는 도구라는 점입니다.</p><p>물론 venv 모듈도 있지만 프로젝트 내에 생성하는 대신 별도의 캐시 디렉터리에 생성하는 것은 git에 올릴 때, gitignore에 별도로 추가할 필요도 없고 리눅스 환경에서 pyenv와 같은 별도의 도구 없이 단일 도구로 관리가 가능함을 의미합니다.</p><p>또한 간단한 명령어로 whl 파일이나 tar.gz을 생성하고 pypi에 배포 또한 지원해서 파이썬 패키지 개발에 도움을 줍니다.</p><h3>Poetry 설치하기</h3><p>간단한 스크립트 코드를 통해서 설치가 가능합니다.</p><pre>curl -sSL &lt;https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py&gt; | python -</pre><p>윈도우즈의 경우, 파워쉘 스크립트도 제공됩니다.</p><pre>(Invoke-WebRequest -Uri &lt;https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py&gt; -UseBasicParsing).Content | python -</pre><p>다음의 명령어를 입력했을 때, 정상적으로 동작한다면 설치가 완료된 것입니다.</p><pre>poetry --version</pre><pre># Poetry version 1.1.13</pre><h3>Poetry의 기본 사용법</h3><h4>프로젝트 생성</h4><pre>poetry new poetry-demo</pre><p>poetry-demo는 새로 생성할 프로젝트 이름입니다.<br>자유롭게 변경하시면 됩니다.</p><h4>기존 프로젝트 초기화</h4><pre>cd pre-existing-project<br>poetry init</pre><h4>프로젝트 실행</h4><pre>poetry run python your_script.py</pre><p>특정 폴더에 있다면 상대 경로 지정도 필요합니다.<br>poetry run 명령어를 사용하면 캐시 디렉터리에 생성된 가상환경을 이용해서 실행됩니다.</p><h4>의존성 설치</h4><p>pyproject에 지정된 의존성 라이브러리를 설치할 때에는 install 명령을 사용하면 됩니다. (npm install과 같은 원리입니다.)</p><pre>poetry install</pre><h4>의존성 업데이트</h4><p>이미 등록된 의존성 목록을 업데이트할 경우 다음과 같이 할 수 있습니다.</p><pre>poetry update</pre><p>이때, pyproject.toml과 poetry.lock도 업데이트됩니다.</p><h4>의존성 추가</h4><p>npm과 다르게 install이 아닌 add로 새로운 의존성을 추가합니다.</p><pre>poetry add new-library</pre><h4>의존성 삭제</h4><pre>poetry remove new-library</pre><h4>의존성 목록 보기</h4><pre>poetry show</pre><h4>의존성 목록 출력</h4><p>기존의 requirements.txt와 같은 다른 형태의 파일로 출력해 줍니다.</p><pre>poetry export -f requirements.txt &gt; requirements.txt</pre><h4>환경 관리</h4><p>Poetry는 가상 환경을 직접 설치하고 생성하기보다는 이미 생성된 여러 버전을 사용하여 새로운 가상환경을 생성해 주는 것에 더 가깝습니다.</p><p>아래의 명령들로 사용할 base interpreter를 설치 및 삭제할 수 있습니다.</p><pre># 이미 존재하는 파이썬 버전 알리기<br>poetry env use /path/to/python3<br># 등록된 환경 목록<br>poetry env list<br># 등록된 환경 삭제<br>poetry env remove /path/to/python3</pre><h3>Poetry를 이용해서 Django 환경 설정하기</h3><p>실습을 위하여 일련의 과정을 통해 Django 애플리케이션을 생성하고 실행해 보겠습니다.</p><pre># 새로운 프로젝트 생성<br>poetry new djangoProject</pre><pre>cd djangoProject<br># 의존성 추가<br>poetry add django <br># django 프로젝트 생성<br>poetry run django-admin startproject demoproject .<br># 새로운 앱 추가<br>poetry run python manage.py startapp poll<br># 서버 실행<br>poetry run python manage.py runserver</pre><h3>Poetry 장단점</h3><h4>장점</h4><ul><li>설치된 의존성 목록을 파악하기 좋다. (PIP의 경우, requirements.txt를 추출할 때, 내가 추가한 라이브러리 외에도 추가 종속성이 같이 포함되어서 보기도 어렵고 관리가 힘들다.)</li><li>Pypi 배포에 최적화됨</li><li>가상환경이 프로젝트 내부에 존재하지 않음</li><li>PyCharm에서 지원함</li></ul><h4>단점</h4><ul><li>별도의 캐시 디렉터리가 존재함 (장점이기도 하지만 단점이 될 수 있는 요소라고 생각합니다)</li><li>아직은 불안정하다.</li><li>환경 관리에서 알 수 없는 오류 발생 (asdf-vm을 사용하는 환경에서 새로운 환경 등록에 어려움이 있었습니다.)</li></ul><h3>마무리</h3><p>아직까지 배포에서 사용해 보지 않아서 정확하게 Poetry를 이해하지 못했습니다만, pip에서 아쉽다고 느낀 점들이 해결된 만큼 기대할 만한 패키지 관리자인 것 같습니다.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29ec3ac1d898" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Multipass — An easy-to-use Ubuntu virtual environment]]></title>
            <link>https://noelvalent.medium.com/multipass-an-easy-to-use-ubuntu-virtual-environment-79c235b52b37?source=rss-2ffcd15bc9ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/79c235b52b37</guid>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[english]]></category>
            <category><![CDATA[ubuntu]]></category>
            <dc:creator><![CDATA[Noel]]></dc:creator>
            <pubDate>Mon, 18 Apr 2022 15:20:20 GMT</pubDate>
            <atom:updated>2022-04-18T15:20:20.204Z</atom:updated>
            <content:encoded><![CDATA[<h3>Multipass — An easy-to-use Ubuntu virtual environment</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*mORnHr_XcRKORu50Q64KPQ.png" /></figure><p>Backend or server-side developers often configure virtual environments to test server environments. I mainly use virtual machines such as VMware and Virtual Box, and recently I use Docker.</p><p>In the case of Docker, unlike virtual machines, it has the characteristic of being light, but it has the disadvantage that it is not suitable for the purpose of configuring a test environment and it is a little difficult for beginners to use.</p><p>For this reason, virtual machines have been frequently used mainly for pre-configuration of deployment environments and configuration of test environments.</p><p>However, on my M1 MacBook, no stable solution except Parallels has been provided yet, and in the case of VMware, there was a problem that the GUI could not be used due to a Wayland bug.</p><p>In this situation, a friend told me about Multipass developed in Ubuntu, and I still use it often for testing various deployments.</p><h3>What is Multipass?</h3><p>According to the official website, Multipass is <strong>Ubuntu VMs on demand for any workstation</strong>.</p><p>In other words, it can be seen as a virtual machine solution that configures the Ubuntu virtual environment in any environment.</p><p>It helps to set up a virtual environment on the system like WSL and to manage it easily.</p><h3>How to install</h3><p>After visiting the website(<a href="https://multipass.run/">https://multipass.run/</a>), you can install it through the guidelines provided.</p><p>In Mac and Windows OS, anyone can easily install it using the installer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KhNdMHJsYLZSwOcBLuzHFA.png" /></figure><h3>How to use</h3><p>CLI commands for power users as well as GUI are provided.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*W8h3Pvix6E1f_vNova1xTw.png" /></figure><p>This makes it simple to manage multiple virtual machines.<br>However, it seems that CLI commands are required to create a new virtual environment.</p><p>Detailed instructions can be found on the homepage.</p><h3>Test simple webserver</h3><p>Since it is the same version as the Ubuntu server os, the installation progress is not different.</p><pre>sudo apt update -y; <br>sudo apt install -y apache2; <br>sudo systemctl status apache2;</pre><h4>Testing screenshot</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bUPU9m3tTcfXy3oRdqj6qg.png" /></figure><h3>Review</h3><p>There was a limitation that only the Ubuntu operating system could be used, but I think it was a good virtual machine to use lightly.</p><p>Since Amazon Linux is not provided for virtual machine use, I often use Ubuntu for server testing.</p><p>I haven’t used it in conjunction with an IDE like Docker, but it seems to be the best tool for occasional deployment practice.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79c235b52b37" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Multipass — 쉽게 사용하는 우분투 가상 환경]]></title>
            <link>https://noelvalent.medium.com/multipass-%EC%89%BD%EA%B2%8C-%EC%82%AC%EC%9A%A9%ED%95%98%EB%8A%94-%EC%9A%B0%EB%B6%84%ED%88%AC-%EA%B0%80%EC%83%81-%ED%99%98%EA%B2%BD-5d302b403fd8?source=rss-2ffcd15bc9ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/5d302b403fd8</guid>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[korean]]></category>
            <category><![CDATA[ubuntu]]></category>
            <dc:creator><![CDATA[Noel]]></dc:creator>
            <pubDate>Mon, 18 Apr 2022 15:10:54 GMT</pubDate>
            <atom:updated>2022-04-18T15:15:51.585Z</atom:updated>
            <content:encoded><![CDATA[<h3>Multipass — 쉽게 사용하는 우분투 가상 환경</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*mORnHr_XcRKORu50Q64KPQ.png" /></figure><p>백엔드 또는 서버단 개발자들은 서버 환경 테스트를 위해 가상 환경을 자주 구성합니다. 주로 VMWare, Virtual Box와 같은 가상 머신을 주로 이용하고, 최근에는 Docker를 사용하곤 합니다.</p><p>Docker의 경우, 가상 머신과 다르게 가볍다는 특징이 있지만, 테스트 환경 구성을 위한 용도에 맞지 않으며 초보자가 사용하기에 조금 어렵다는 단점이 있습니다.</p><p>이러한 이유로 주로 배포 환경 사전 구성 및 테스트 환경 구성을 위해서 가상 머신을 자주 사용해왔습니다.</p><p>하지만 제 M1 맥북에서는 Parallels를 제외한 안정적인 솔루션이 아직 제공되지 않고 있고 vmware의 경우 wayland 버그로 인해 GUI를 사용할 수 없는 문제가 있었습니다.</p><p>이러한 상황에서 친구가 우분투에서 개발한 Multipass를 알려줬고 지금도 여러 배포 테스트를 위해 종종 사용하고 있습니다.</p><h3>Multipass란 무엇인가?</h3><p>Multipass는 <strong>Ubuntu VMs on demand for any workstation (모든 워크스테이션에 대한 주문형 Ubuntu VM)</strong> 입니다.</p><p>즉, 어떤 환경에서든 우분투 가상환경을 구성해 주는 가상머신 솔루션이라고 볼 수 있습니다.</p><p>이는 WSL과 같이 가상 환경을 시스템에 구축해 주고 이를 쉽게 관리할 수 있도록 도움을 줍니다.</p><h3>설치 방법</h3><p>홈페이지(<a href="https://multipass.run/">https://multipass.run/</a>)에 방문 후, 제공된 가이드라인을 통해 설치를 하면 됩니다.</p><p>맥과 윈도우 환경에서는 인스톨러를 사용해서 누구나 쉽게 설치할 수 있습니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KhNdMHJsYLZSwOcBLuzHFA.png" /></figure><h3>사용 방법</h3><p>파워유저를 위한 CLI 명령어 뿐만 아니라 GUI도 제공이 되고 있습니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*W8h3Pvix6E1f_vNova1xTw.png" /></figure><p>이를 통해 간단하게 여러 가상 머신을 관리할 수 있습니다.<br>하지만 새로운 가상환경 생성을 위해서는 명령어가 필요한 것으로 보입니다.</p><p>자세한 명령어는 홈페이지에서 볼 수 있습니다.</p><h3>간단하게 웹 서버 테스트해보기</h3><p>우분투 서버 os와 동일한 버전이기 때문에 설치 방법은 동일합니다.</p><pre>sudo apt update -y; <br>sudo apt install -y apache2; <br>sudo systemctl status apache2;</pre><p>실행 중인 모습</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bUPU9m3tTcfXy3oRdqj6qg.png" /></figure><h3>후기</h3><p>우분투 운영체제만 이용할 수 있다는 제약이 있었지만 가볍게 사용하기 좋은 가상 머신이었다고 생각합니다.</p><p>아마존 리눅스가 가상 머신 용도로 제공되지 않아서 서버 테스트 용도로 우분투를 자주 사용하곤 하는데, m1 맥북뿐만 아니라 기존 PC에서도 쉽게 제어가 가능한 점은 개발 환경 구축에 대한 스트레스를 많이 줄여주었습니다.</p><p>Docker처럼 IDE와 연계해서 사용해 보지는 못했지만, 간간이 배포 연습을 하기에는 최고의 도구인 것 같습니다.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d302b403fd8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Analysis of CPython]]></title>
            <link>https://noelvalent.medium.com/analysis-of-cpython-3cbde900eced?source=rss-2ffcd15bc9ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/3cbde900eced</guid>
            <category><![CDATA[english]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Noel]]></dc:creator>
            <pubDate>Fri, 15 Apr 2022 20:05:06 GMT</pubDate>
            <atom:updated>2022-04-15T20:05:06.172Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/665/1*BLGnsKOzhD9g2khvvrlcBQ.png" /></figure><p>Sometimes, beginners in programming often ask questions about things that have been taken for granted by developers.</p><p>How arithmetic operations work, the difference between using operators to manipulate objects and using methods…</p><p>Most of the developers say, “It’s just like that”, “Just accept it.”</p><p>However, it is necessary to analyze the source code of the implementation of the language in order to deal with the essential content rather than the function provided as a library, and in the case of Python, CPython is an example.</p><p>If you’re studying Python but don’t know which interpreter you’re using, you’re most likely using CPython.</p><p>Various interpreters exist, but in this article, we will only focus on CPython.</p><blockquote>Before reading</blockquote><blockquote>It is probably difficult to cover everything in this article, and there are many shortcomings.</blockquote><blockquote>As the author of this article, I am a student in the IT department, and I may not have enough professional skills to read.</blockquote><blockquote>Basically, in this article, I will explain the process I went through while exploring and analyzing.</blockquote><h3>Download the source code</h3><p>Python is an open-source language.</p><p>You can easily download it from Python.org(<a href="http://python.org/">http://Python.org</a>) or Github (<a href="https://github.com/python/cpython">https://github.com/python/cpython</a>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NIUhhNEyQaHJEWuKPQ1-oQ.png" /></figure><h3>Open the file and prepare it for analysis</h3><p>Open the project using an IDE you are familiar with.<br>In general, I would recommend Visual Studio or Clion.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S6JZCWtQyqsuyFCdWMChMg.png" /></figure><h4>Begin analysis</h4><p>From here on, I will explain using an example.<br>The scenario I prepared is as follows.</p><blockquote>In order to explain the difference between list extend and addition operator, we are going to analyze the internal structure.</blockquote><blockquote>I want to know what <strong><em>extend()</em></strong> returns, and if it returns anything other than None.</blockquote><p>First, I explored how the list is being defined inside.<br>Then I found the most plausible struct among the code that the List goes into.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*c_epN6ah4kR7AfCWSj00YQ.png" /></figure><p>In JetBrains IDE, you can use find in files to search for a specific structure throughout the project. (Ctrl + Shift + f / Cmd + Shift + f)</p><p>You can find the <strong>PyListObject </strong>in a specific location.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7e6134b337f9f402d322fd1aa06b3304/href">https://medium.com/media/7e6134b337f9f402d322fd1aa06b3304/href</a></iframe><p>Also, I found <strong>_PyList_Extend </strong>corresponding to the extend function here.</p><p>One more search, in the same way, will find the implementation.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e9663dd60579536b18c5db15b5616891/href">https://medium.com/media/e9663dd60579536b18c5db15b5616891/href</a></iframe><p>And I have <strong>list_extend </strong>in the same file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c2a9bf50a42581444c5359a766b8b80d/href">https://medium.com/media/c2a9bf50a42581444c5359a766b8b80d/href</a></iframe><p>You can see that there is code that sends a goto statement as an error label, but it only returns NULL as a result.</p><h3>Wrap-up</h3><p>Analyzing the implementation so diligently does not significantly improve coding skills, and in practice, perhaps this analysis does not occur much.</p><p>At best, I just analyze the library to the extent of tearing it apart.</p><p>Most of the time, you can get what you want by just analyzing builtins.py or site-package.</p><p>However, I think analyzing the implementation of this language is the most useless challenge to enjoy IT as a student.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3cbde900eced" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CPython 분석하기]]></title>
            <link>https://noelvalent.medium.com/cpython-%EB%B6%84%EC%84%9D%ED%95%98%EA%B8%B0-5549f3c9f0f8?source=rss-2ffcd15bc9ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/5549f3c9f0f8</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[korean]]></category>
            <dc:creator><![CDATA[Noel]]></dc:creator>
            <pubDate>Fri, 15 Apr 2022 19:47:02 GMT</pubDate>
            <atom:updated>2022-04-15T19:58:47.708Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/665/1*BLGnsKOzhD9g2khvvrlcBQ.png" /><figcaption>python 3.10 release image</figcaption></figure><p>가끔 프로그래밍 입문자들은 종종 의외로 개발자로서 너무 당연하게 받아들여져 온 것들에 대해 질문을 하곤 합니다.</p><p>산술 연산이 어떻게 동작하는지, 연산자를 사용해서 객체를 다루는 것과 메서드를 사용하는 것의 차이 등…</p><p>대다수의 개발자들은 “원래 그런 것이다.”, “그냥 받아들여라.”라는 느낌으로 말씀하시는 분도 계시고, 종종 해당 언어 선에서 설명을 해주시곤 합니다.</p><p>하지만 그도 그럴 것이 라이브러리로 제공된 함수가 아닌 본질적인 내용을 다루기 위해서는 해당 언어의 구현체 소스 코드를 분석할 필요가 있으며, Python의 경우 CPython이 그 예시입니다.</p><p>만약 당신이 Python을 공부하고 있지만 어떤 인터프리터를 사용하는지 모르시는 경우, 높은 확률로 CPython을 사용하고 계신 겁니다.</p><p>다양한 인터프리터가 존재하지만 이 글에서는 CPython에 대해서만 다뤄보겠습니다.</p><blockquote>들어가기에 앞서…</blockquote><blockquote>아마 이 글에서 모든 내용을 다루기 어렵고 부족한 부분도 많을 겁니다.</blockquote><blockquote>이 글의 작성자인 저는 IT 학과에 재학 중인 학생이며, 글을 읽는 충분히 전문적인 실력을 가지지 못했을 지도 모릅니다.</blockquote><blockquote>기본적으로 이 글에서는 제가 탐색 및 분석하면서 겪은 과정에 대해서 설명할 것이며, 아쉬운 부분이나 추가 팁에 대해서는 댓글로 지적을 해주시면 감사하겠습니다.</blockquote><h3>소스코드를 다운로드 하기</h3><p>파이썬은 오픈 소스 언어입니다.<br><a href="http://python.org/">Python.org</a> 또는 Github(<a href="https://github.com/python/cpython">cpython</a>)에서 쉽게 다운로드 할 수 있습니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NIUhhNEyQaHJEWuKPQ1-oQ.png" /></figure><h3>파일 열고 분석을 준비하기</h3><p>자신이 익숙하다고 느끼는 IDE를 이용해서 해당 프로젝트를 엽니다.<br>일반적으로 Visual Studio나 Clion을 추천드리고 싶습니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S6JZCWtQyqsuyFCdWMChMg.png" /></figure><h4>분석을 시작하기</h4><p>여기서부터는 예시를 이용해서 설명을 하겠습니다.</p><p>제가 준비한 시나리오는 다음과 같습니다.</p><blockquote>list의 extend와 더하기 연산자의 차이를 설명하기 위해서 내부 구조를 분석하려고 합니다.<br>extend가 무엇을 반환하는지, None 이외의 다른 값을 반환하는지 알고 싶습니다.</blockquote><p>저는 가장 먼저 list가 내부에서 어떻게 정의가 되고 있는지 탐색했습니다.<br>저는 List가 들어가는 코드 중 가장 그럴듯한 구조체를 찾았습니다.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*c_epN6ah4kR7AfCWSj00YQ.png" /></figure><p>Jetbrain IDE에서는 find in files를 이용해서 프로젝트 전체를 대상으로 특정 구조체를 탐색할 수 있습니다. (Ctrl + Shift + f / Cmd + Shift + f)</p><p>특정 위치에서 <strong>PyListObject</strong>를 찾을 수 있습니다.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7e6134b337f9f402d322fd1aa06b3304/href">https://medium.com/media/7e6134b337f9f402d322fd1aa06b3304/href</a></iframe><p>또한 이곳에 extend함수에 해당하는 _PyList_Extend를 찾았습니다.</p><p>같은 방식으로 검색을 한 번 더 시도하면 구현부를 찾을 수 있습니다.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e9663dd60579536b18c5db15b5616891/href">https://medium.com/media/e9663dd60579536b18c5db15b5616891/href</a></iframe><p>그리고 같은 파일에 list_extend가 있습니다.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c2a9bf50a42581444c5359a766b8b80d/href">https://medium.com/media/c2a9bf50a42581444c5359a766b8b80d/href</a></iframe><p>goto문으로 error레이블로 보내버리는 코드가 있기는 하지만 결과적으로 NULL을 반환하는 것을 알 수 있습니다.</p><h3>마무리</h3><p>이렇게 열심히 구현체를 분석을 한다고 해서 코딩 실력이 크게 늘어나지도 않고, 실무에서도 아마 이렇게까지 분석할 일이 크게 발생하지도 않습니다.</p><p>기껏해야 해당 라이브러리를 뜯어보는 정도로만 분석하곤 하죠.</p><p>대부분 builtins.py나 site-package만 분석해도 원하는 것을 얻을 수 있기도 하고요.</p><p>하지만 이런 언어의 구현체를 분석하는 것이야말로 학생으로 IT를 즐길 수 있는 가장 쓸데없어 보이는 도전이 아닌가 생각합니다.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5549f3c9f0f8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>