<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: NicolasMICAUX</title>
    <description>The latest articles on DEV Community by NicolasMICAUX (@nicolasmicaux).</description>
    <link>https://dev.to/nicolasmicaux</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1127324%2F3dfae5a0-f0fc-4688-a2d6-48fad31fa6dc.png</url>
      <title>DEV Community: NicolasMICAUX</title>
      <link>https://dev.to/nicolasmicaux</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nicolasmicaux"/>
    <language>en</language>
    <item>
      <title>Introducing Search’In: Search Anything in live Python Code with Ease!</title>
      <dc:creator>NicolasMICAUX</dc:creator>
      <pubDate>Wed, 26 Jul 2023 21:33:06 +0000</pubDate>
      <link>https://dev.to/nicolasmicaux/introducing-searchin-search-anything-in-live-python-code-with-ease-1m3l</link>
      <guid>https://dev.to/nicolasmicaux/introducing-searchin-search-anything-in-live-python-code-with-ease-1m3l</guid>
      <description>&lt;p&gt;Have you ever found yourself desperately searching for that one elusive method or variable in a complex Python codebase? You know it’s there somewhere, but it seems to be playing a game of hide-and-seek, leaving you frustrated and wasting precious time scrolling through pages of documentation and source code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cKA0iBrI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xf55vq02s96gwkhx8qg0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cKA0iBrI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xf55vq02s96gwkhx8qg0.png" alt="Search'In logo" width="431" height="431"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Search’In?
&lt;/h2&gt;

&lt;p&gt;Search’In is a tool that allows you to search in live python objects as if you were on Google, just by adding a line in the middle of your code !&lt;/p&gt;

&lt;p&gt;To begin, you’ll need to install Search’In using &lt;code&gt;pip&lt;/code&gt;:&lt;br&gt;&lt;br&gt;
&lt;code&gt;pip install searchin&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Import it into your Python code with just one line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;searchin&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Imagine you have a &lt;code&gt;Human&lt;/code&gt; class, and you're searching for the method or variable named "name." Just do:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;searchin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Human&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;No, you’re not hallucinating: the module is the function. 11 characters saved ;-)&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can search for any string in &lt;strong&gt;any python “entity” : variable, method, object, class, module, etc&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Search for &lt;code&gt;"5"&lt;/code&gt; in a &lt;code&gt;tuple&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;searchin&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="s"&gt;"5"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# &amp;gt;&amp;gt;&amp;gt; "5" found in root.4 : 5
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Search for &lt;code&gt;"mean"&lt;/code&gt; in the method &lt;code&gt;torch.nn.functional.cross_entropy&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;searchin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;functional&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cross_entropy&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"mean"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# "mean" found in cross_entropy. : def cross_entropy( [...] reduction: str = "mean", [...], label_smoothing)
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Search for &lt;code&gt;"grad"&lt;/code&gt; in a &lt;code&gt;torch.nn.Module&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Linear&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;searchin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"grad"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# "grad" found in model.bias
# "grad" found in model.requires_grad_
# "grad" found in model.weight
# "grad" found in model.zero_grad
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hope this will be useful to you! ==&amp;gt; &lt;a href="https://pypi.org/project/searchin/"&gt;https://pypi.org/project/searchin/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The project could have a lot more useful functionnalities. Contributions are welcome! ==&amp;gt; &lt;a href="https://github.com/NicolasMICAUX/searchin"&gt;https://github.com/NicolasMICAUX/searchin&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Maybe this new tool is similar to existing ones, that I’m not aware of ==&amp;gt; if so, &lt;a href="https://github.com/NicolasMICAUX/searchin/discussions"&gt;I would be happy to know which&lt;/a&gt; :)&lt;/em&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>programming</category>
      <category>productivity</category>
      <category>pypi</category>
    </item>
  </channel>
</rss>
