<?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 Wahib Mzali on Medium]]></title>
        <description><![CDATA[Stories by Wahib Mzali on Medium]]></description>
        <link>https://medium.com/@WahibM?source=rss-6a367473bd3f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*90V2BFVvDB6trkg2uQhoPA.png</url>
            <title>Stories by Wahib Mzali on Medium</title>
            <link>https://medium.com/@WahibM?source=rss-6a367473bd3f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 23:37:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@WahibM/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[DeepCSIM: Detect Duplicate & Similar Code Across Hundreds of Files]]></title>
            <link>https://medium.com/@WahibM/deepcsim-detect-duplicate-and-similar-code-across-your-python-project-20301ec23772?source=rss-6a367473bd3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/20301ec23772</guid>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[python-libraries]]></category>
            <dc:creator><![CDATA[Wahib Mzali]]></dc:creator>
            <pubDate>Sun, 14 Dec 2025 12:48:10 GMT</pubDate>
            <atom:updated>2026-04-11T16:31:03.568Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi everyone 👋</p><p>I’ve just released <strong>DeepCSIM</strong>, an open-source Python library and CLI tool for detecting <strong>code similarity using Abstract Syntax Tree (AST) analysis</strong>.</p><p>DeepCSIM helps you:</p><ul><li>Find duplicate code</li><li>Detect similar code across different files</li><li>Refactor your code by spotting repeated structural patterns</li><li>Enforce the <strong>DRY (Don’t Repeat Yourself)</strong> principle across an entire project</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/0*zwb6VOO-XazJSfvZ.gif" /></figure><h3>Why DeepCSIM instead of IDE tools?</h3><p>Most IDEs can highlight duplicated code, but they usually require you to inspect files manually, one by one.<br> <strong>DeepCSIM scans your entire project at once</strong>, uncovering hidden structural and semantic similarities that are easy to miss during day-to-day development.</p><h3>Installation</h3><pre>pip install deepcsim</pre><h3>Usage</h3><p>DeepCSIM can be used in <strong>three different ways</strong>: as a CLI tool, a local web server, or a Python library.</p><h3>1. Command-Line Interface (CLI)</h3><p>Scan a directory for code duplicates directly from your terminal:</p><pre># Scan current directory<br>deepcsim-cli<br><br># Scan a specific directory<br>deepcsim-cli /path/to/project<br><br># Set similarity threshold (default: 80.0)<br>deepcsim-cli /path/to/project --threshold 90<br><br># Output results in JSON format<br>deepcsim-cli /path/to/project --json</pre><h3>2. Web Server</h3><p>Start the built-in web interface to explore results interactively:</p><pre>deepcsim-server</pre><p>Then open:<br><a href="http://localhost:8000/"><strong>http://localhost:8000/</strong></a></p><h3>3. Python Library</h3><p>Use DeepCSIM programmatically inside your Python code:</p><pre>from deepcsim import compare_source, scan_directory<br>from deepcsim.core.analyzer import CodeAnalyzer  # Optional, advanced usage<br><br># --- Example 1: Compare two code snippets ---<br>source1 = &quot;&quot;&quot;<br>def hello():<br>    print(&quot;Hello world&quot;)<br>&quot;&quot;&quot;<br><br>source2 = &quot;&quot;&quot;<br>def greet():<br>    print(&quot;Hello world&quot;)<br>&quot;&quot;&quot;<br>report = compare_source(source1, source2)<br>print(f&quot;Similarity: {report[&#39;results&#39;][0][&#39;similarity&#39;]}%&quot;)<br><br># --- Example 2: Scan a directory ---<br>results = scan_directory(&quot;/path/to/project&quot;, threshold=80.0)<br>print(f&quot;Found {results[&#39;count&#39;]} similar pairs.&quot;)</pre><h3>Source Code</h3><p>👉 <strong>GitHub:</strong> <a href="https://github.com/whm04/deepcsim">https://github.com/whm04/deepcsim</a></p><p>Feedback, issues, and pull requests are very welcome.<br> If you try DeepCSIM, I’d love to hear your thoughts! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20301ec23772" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Scrape Websites Using Scrapy]]></title>
            <link>https://medium.com/@WahibM/how-to-scrape-websites-using-scrapy-18aed2f3aa26?source=rss-6a367473bd3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/18aed2f3aa26</guid>
            <category><![CDATA[data-extraction]]></category>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[scrapy]]></category>
            <category><![CDATA[hands-on-tutorials]]></category>
            <dc:creator><![CDATA[Wahib Mzali]]></dc:creator>
            <pubDate>Fri, 03 Jan 2025 20:59:04 GMT</pubDate>
            <atom:updated>2025-01-03T21:09:13.771Z</atom:updated>
            <content:encoded><![CDATA[<p>Web scraping has become a crucial tool for gathering data from websites. If you’re looking to scrape data efficiently, Scrapy is one of the best Python libraries out there. In this article, we’ll guide you through the process of setting up and using Scrapy to scrape data from a website.</p><h3>1. What is Scrapy?</h3><p>Scrapy is an open-source framework for web scraping that allows you to extract data from websites and save it in your preferred format, such as JSON or CSV. It’s known for its speed, reliability, and robust functionality.</p><h3>2. Prerequisites</h3><ul><li>Basic knowledge of Python</li><li>Python installed on your system</li><li>Pip package manager installed</li></ul><p>Run the following command to install Scrapy:</p><pre>pip install scrapy</pre><h3>3. Setting Up Your Scrapy Project</h3><pre>scrapy startproject your_project_name</pre><h3>4. Writing Your Spider</h3><p>Now a project named your_project_name has been created, we can follow the output to use genspider to generate one scrapy spider for us. Our target website is <a href="https://ascandi.ch/fr/15-dental3">Ascandi</a> and we plan to crawl all the products of the page for us.</p><pre>cd your_project_name<br>scrapy genspider myspider ascandi.ch</pre><p>Now you have a scrapy project which contains a spider named myspider. Let&#39;s take a look at the project directory.</p><pre>├── scrapy.cfg                # deploy configuration file<br>└── scrapy_spider             # project&#39;s Python module, you&#39;ll import your code from here<br>    ├── __init__.py<br>    ├── items.py              # project items definition file<br>    ├── middlewares.py        # project middlewares file<br>    ├── pipelines.py          # project pipeline file<br>    ├── settings.py           # project settings file<br>    └── spiders               # a directory where spiders are located<br>        ├── __init__.py<br>        └── myspider.py        # spider we just created</pre><p>Here’s a spider to scrape products from the website:</p><pre>import scrapy<br><br>class MyspiderSpider(scrapy.Spider):<br>    name = &quot;product_spider&quot;<br>    start_urls = [<br>        &quot;https://ascandi.ch/fr/15-dental&quot;<br>    ]<br><br>    def parse(self, response):<br>        # Extract product links from the current page<br>        for product_link in response.css(&quot;a.thumbnail.product-thumbnail::attr(href)&quot;).getall():<br>            yield response.follow(product_link, callback=self.parse_product)<br><br>        # Follow the next page link if it exists<br>        next_page_link = response.css(&quot;a.next::attr(href)&quot;).get()<br>        if next_page_link is not None:<br>            yield response.follow(next_page_link, callback=self.parse)<br><br>    def parse_product(self, response):<br>        # Extract product information from the product page<br>        product = {<br>            &quot;name&quot;: response.css(&quot;h1.h1.product-main-title::text&quot;).get(),<br>            &quot;reference&quot;: response.css(&quot;span.available-status &gt; strong::text&quot;).get(),<br>            &quot;image_url&quot;: response.css(&quot;img.thumb.js-thumb::attr(src)&quot;).get()<br>        }<br>        yield product</pre><h3>5. Running Your Spider</h3><p>To run the spider, use:</p><pre>scrapy crawl product_spider -o products.csv</pre><p>This command saves the scraped data into a file called products.csv.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DRSma_S5I_0C2FA4_Ca_4g.png" /></figure><h3>6. Saving Data in Other Formats</h3><p>Scrapy supports multiple output formats. Replace products.csv with products.json to save data in JSONformat.</p><h3>7. Conclusion</h3><p>Scrapy simplifies the process of web scraping with its intuitive framework and tools. With a few lines of code, you can gather data from websites and use it for your projects. Happy scraping!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18aed2f3aa26" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>