<?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>Forem: gudata</title>
    <description>The latest articles on Forem by gudata (@gudata).</description>
    <link>https://forem.com/gudata</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%2F157605%2Fa0a752f5-a987-47ec-88fb-fb9520fd81fd.jpeg</url>
      <title>Forem: gudata</title>
      <link>https://forem.com/gudata</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/gudata"/>
    <language>en</language>
    <item>
      <title>“Git Quick” VS Code Extension Review</title>
      <dc:creator>gudata</dc:creator>
      <pubDate>Fri, 24 May 2024 14:30:08 +0000</pubDate>
      <link>https://forem.com/gudata/git-quick-vs-code-extension-review-ln7</link>
      <guid>https://forem.com/gudata/git-quick-vs-code-extension-review-ln7</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsbsvqvctngc6a4uzq2yp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsbsvqvctngc6a4uzq2yp.png" alt="Image description" width="800" height="156"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;The “Git Quick” extension for Visual Studio Code is designed to streamline your workflow with Git by providing instant commands for staging, committing, and restoring files directly from the editor. &lt;/p&gt;

&lt;h2&gt;
  
  
  Main Features
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Instant Staging and Committing
&lt;/h3&gt;

&lt;p&gt;The standout feature of “Git Quick” is the git-quick-commit command. This command allows you to commit the file currently in focus with remarkable speed. Here’s how it works:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Automatic Staging: As soon as you invoke the command (from the command palette or shortcut), the extension stages the current file for you.&lt;/li&gt;
&lt;li&gt;Prompt for Commit Message: You will then be prompted to enter a commit message, ensuring that your changes are documented appropriately – and most import with the right scope!&lt;/li&gt;
&lt;li&gt;File Save: If the file has unsaved changes, Git Quick will automatically save it before proceeding with the commit.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This feature is particularly useful for developers who need to make frequent commits without losing focus on their current task.&lt;/p&gt;

&lt;p&gt;Also it helps commit frequently and put the right commit messages to the right files. No more one commit message for 10 unrelated files! &lt;/p&gt;

&lt;h3&gt;
  
  
  Quick Restore
&lt;/h3&gt;

&lt;p&gt;The git-quick-restore command is another powerful feature of Git Quick. It allows you to quickly revert the current file to its state at the most recent commit. This is equivalent to discarding all local changes made to the file:&lt;/p&gt;

&lt;p&gt;Instant Revert: With a single command, you can undo any unwanted changes, making it a lifesaver during experimentation or bug fixing.&lt;br&gt;
No Activation if Unchanged: The command will only activate if there are changes to the file, ensuring that you don’t accidentally revert unchanged files.&lt;/p&gt;

&lt;h3&gt;
  
  
  Additional Features
&lt;/h3&gt;

&lt;p&gt;git-quick-checkout: This is an alias for the git-quick-restore command, providing flexibility in how you interact with the extension.&lt;/p&gt;

&lt;p&gt;Multiple Repository Support: If you have multiple Git repositories open, Quick Git will automatically detect and apply the command to the appropriate repository.&lt;/p&gt;

&lt;p&gt;Integration with VS Code Git Extension: It relies on the built-in Git functionality of VS Code, meaning there are no external dependencies to worry about.&lt;/p&gt;

&lt;h2&gt;
  
  
  User Experience
&lt;/h2&gt;

&lt;p&gt;Quick Git enhances the Git workflow by minimizing interruptions and keeping you in your coding environment. The automatic saving of files and seamless integration with VS Code’s Git extension make it a natural part of the development process.&lt;/p&gt;

&lt;p&gt;No Distractions&lt;/p&gt;

&lt;p&gt;Non-Intrusive: The extension won’t activate if the current file hasn’t changed, which prevents unnecessary prompts and distractions.&lt;/p&gt;

&lt;p&gt;Focus Retention: By allowing you to commit or restore files directly from the editor, it helps maintain your focus on coding rather than switching contexts to the terminal or another Git client.&lt;/p&gt;

&lt;h2&gt;
  
  
  Future Potential
&lt;/h2&gt;

&lt;p&gt;The current feature set of Git Quick is already impressive, but the promise of additional “quick” commands in the future makes it an exciting tool to watch. Potential future enhancements could include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Quick Branch Switching: Instantly switch branches without navigating through multiple menus.&lt;/li&gt;
&lt;li&gt;Quick Merge/Rebase: Simplify complex Git operations to a single command.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=gudasoft.git-quick"&gt;Download link&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The Git Quick extension for VS Code is a highly efficient tool for developers looking to speed up their Git workflow. With instant staging, committing, and restoring capabilities, it reduces the friction of version control tasks and keeps you focused on coding. As it stands, it’s a valuable addition to any developer’s toolkit, with promising features on the horizon.&lt;/p&gt;

&lt;p&gt;For more information and to download the extension, visit the &lt;a href="https://github.com/gudasoft/git-quick"&gt;Git Quit repository&lt;/a&gt;. Also, check out other great projects from &lt;a href="https://gudasoft.com/products/"&gt;Gudasoft&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx3d8q7vqu6xq9jo2s68v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx3d8q7vqu6xq9jo2s68v.png" alt="Image description" width="800" height="222"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>vscode</category>
      <category>git</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Airflow Development with Docker</title>
      <dc:creator>gudata</dc:creator>
      <pubDate>Sun, 18 Dec 2022 22:26:30 +0000</pubDate>
      <link>https://forem.com/gudata/airflow-development-with-docker-161o</link>
      <guid>https://forem.com/gudata/airflow-development-with-docker-161o</guid>
      <description>&lt;h2&gt;
  
  
  Airflow tooling and code structure
&lt;/h2&gt;

&lt;p&gt;The airflow should be easy to work with and develop.&lt;/p&gt;

&lt;p&gt;The new astro-cli tool from astronomers is intended to help users work with their cloud and it doesn't cover all the development workflows.&lt;/p&gt;

&lt;p&gt;It does not play well with docker because there is not enough provisioning for the docker in docker communication.&lt;/p&gt;

&lt;p&gt;The dags that I am currently developing will be located at the root of the project in the dags&lt;/p&gt;

&lt;p&gt;The dags which are ready to commit and will go to production are stored at dags-production.&lt;/p&gt;

&lt;p&gt;Here is an example structure&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/
  dags/
    include/
      helpers/
        company_name/
          module_name/

  dags-production/
    team/
      dags/
        us-east-1/
          include/
            helpers/
          *.dag
        eu-central-1/
            include/
              helpers/
            *.dag
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Airflow writes every second in its home folder. That's why I am using a memory file system.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Make a virtual environment
&lt;/h3&gt;

&lt;p&gt;I will choose to use the local folder airflow/ to keep all the airflow libraries.&lt;/p&gt;

&lt;p&gt;Airflow has a lot of dependencies and I don't want to pollute my regular python project with them.&lt;/p&gt;

&lt;p&gt;Airflow, after all, is just a regular tool and should stay separate from our code.&lt;/p&gt;

&lt;p&gt;If you don't have poetry installed do it now&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -sSL &amp;lt;https://install.python-poetry.org&amp;gt; | python3 -
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Then let's prepare the airflow folder&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir airflow
echo "airflow" &amp;gt;&amp;gt; .gitignore
sudo mount -t tmpfs -o size=50m tmpfs ./airflow
poetry --directory ./airflow init --name=airflow --description=airflow --author=me --no-interaction
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now it's time to install it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Install in a virtual environment
&lt;/h3&gt;

&lt;p&gt;We will use poetry to initialize a new virtual environment from the ./airflow folder.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;poetry --directory ./airflow shell
cd ..
export PROJECT_HOME=$(realpath ./)
export AIRFLOW_HOME=${PROJECT_HOME}/airflow
export AIRFLOW__CORE__LOAD_EXAMPLES=False
export AIRFLOW__CORE__DAGS_FOLDER=./dags
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now let's install Airflow using the constraints file&lt;/p&gt;

&lt;p&gt;We will follow the steps from here &lt;a href="https://airflow.apache.org/docs/apache-airflow/stable/start/local.html"&gt;https://airflow.apache.org/docs/apache-airflow/stable/start/local.html&lt;/a&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;AIRFLOW_VERSION=2.5.0
PYTHON_VERSION="$(python --version | cut -d " " -f 2 | cut -d "." -f 1-2)"

CONSTRAINT_URL="https://raw.githubusercontent.com/apache/airflow/constraints-${AIRFLOW_VERSION}/constraints-${PYTHON_VERSION}.txt"
pip install "apache-airflow==${AIRFLOW_VERSION}" --constraint "${CONSTRAINT_URL}"

pip install apache-airflow-providers-docker apache-airflow-providers-amazon
pip install apache-airflow-providers-postgres
pip install apache-airflow-providers-redis
pip install apache-airflow-providers-mysql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;We will delete all the sample DAGs. We want to see our DAGs much quicker.&lt;/p&gt;

&lt;p&gt;Airflow will also work faster because it won't parse a lot of DAGs.&lt;/p&gt;

&lt;p&gt;We will look for something like '/home/USER/.cache/pypoetry/virtualenvs/airflow-4vTX1qLp-py3.9'&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;poetry env info

echo "Show what we will delete"
find /home/guda/.cache/pypoetry/virtualenvs | grep example_dags

echo "Do actual delete"
find /home/guda/.cache/pypoetry/virtualenvs | grep example_dags | xargs rm -rf  "{}"

echo "Or do it that way"
pip show pip
find /home/guda/.cache/pypoetry/virtualenvs/bookings-bQ2s_Hyz-py3.8/lib/python3.8/site-packages | grep example_dags
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;In case you forgot to delete the sample dags, it will be quicker to delete the airflow database and start again.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rm airflow/airflow.db
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Finally, run it&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;airflow standalone
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Next time run with (the password is in standalone_admin_password.txt)&lt;/p&gt;

&lt;h2&gt;
  
  
  Run Airflow next time
&lt;/h2&gt;

&lt;p&gt;You can always consult what is the default password by running&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cat airflowstandalone_admin_password.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;We can do poetry shell in the ./airflow folder, and then run airflow standalone or other airflow commands.&lt;/p&gt;

&lt;p&gt;But it is faster to prefix the airflow commands with poetry --directory ./airflow run&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export PROJECT_HOME=$(realpath ./)
export AIRFLOW_HOME=${PROJECT_HOME}/airflow
export AIRFLOW__CORE__LOAD_EXAMPLES=False
export AIRFLOW__CORE__DAGS_FOLDER=./dags

poetry --directory ./airflow run airflow standalone
poetry --directory ./airflow run airflow ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;At this point you will be able to access the empty airflow via &lt;a href="http://127.0.0.1:8080/"&gt;http://127.0.0.1:8080/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Prepare for the Containers
&lt;/h2&gt;

&lt;p&gt;The DockerOperator will need a registry to pull images from.&lt;br&gt;
In development, it is easy to push the build images locally and &lt;em&gt;ask&lt;/em&gt; airflow to pull them from the registry configured at the docker_default connection.&lt;br&gt;
I have no idea why it is called docker_default instead of image_registry_default  but this is another subject.&lt;/p&gt;

&lt;p&gt;Let's Run a local registry.&lt;/p&gt;

&lt;h3&gt;
  
  
  Working with the Registry
&lt;/h3&gt;

&lt;h4&gt;
  
  
  First time Run
&lt;/h4&gt;

&lt;p&gt;Pull and run the registry locally.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run -d -p 5000:5000 --name registry registry:2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h4&gt;
  
  
  Next time Run
&lt;/h4&gt;

&lt;p&gt;Next time you will already have the registry and you have to run&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker start registry
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  Working with images
&lt;/h3&gt;
&lt;h4&gt;
  
  
  Build the image
&lt;/h4&gt;

&lt;p&gt;When you build an image, tag it, and push it.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker-compose build custom_image
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;or&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker build .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h4&gt;
  
  
  Push &amp;amp; Pull
&lt;/h4&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker image tag custom_image localhost:5000/custom_image
docker push localhost:5000/custom_image
docker pull localhost:5000/custom_image
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h4&gt;
  
  
  Hints &amp;amp; Tips to debug the local registry
&lt;/h4&gt;

&lt;p&gt;You need to specify a password in airflow - test the connection command line.&lt;br&gt;
The password could be fake&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker login 127.0.0.1:5000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;When you specify the image don't forget to set the host to something like this:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    127.0.0.1:5000/custom_image
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h4&gt;
  
  
  List the images
&lt;/h4&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X GET http://127.0.0.1:5000/v2/_catalog
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h4&gt;
  
  
  Stop registry
&lt;/h4&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker container stop registry \
  &amp;amp;&amp;amp; docker container rm -v registry
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h4&gt;
  
  
  Working with containers
&lt;/h4&gt;

&lt;p&gt;When working with containers you will probably have an entry point script. The entry point will provide you with an interface and will allow you to run only a specific set of commands. To override the entry point of the image, do it like this:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run -u root --entrypoint /bin/bash -ti custom_image:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Seed airflow settings
&lt;/h2&gt;

&lt;p&gt;The seed is great to put in &lt;a href="https://github.com/casey/just"&gt;justfile&lt;/a&gt; &lt;em&gt;airflow-seed&lt;/em&gt; task&lt;/p&gt;
&lt;h3&gt;
  
  
  Seeding users
&lt;/h3&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;poetry --directory ./airflow run airflow users delete --username admin
poetry --directory ./airflow run airflow users create --role Admin --username admin --email admin@example.com --firstname admin --lastname admin --password admin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  Seeding connections
&lt;/h3&gt;

&lt;p&gt;You are using &lt;a href="https://direnv.net/"&gt;direnv&lt;/a&gt;, right?&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;poetry --directory ./airflow run \
  airflow connections add 'docker_default' \
    --conn-type 'docker' \
    --conn-login 'root' \
    --conn-host '127.0.0.1' \
    --conn-port '5000'

poetry --directory ./airflow run \
  airflow connections add 'snowflake' \
    --conn-type 'generic' \
    --conn-login '$SNOWFLAKE_USER' \
    --conn-host '$SNOWFLAKE_ACCOUNT' \
    --conn-password '$SNOWFLAKE_PASSWORD'

poetry --directory ./airflow run \
  airflow connections add 'aws' \
    --conn-type 'aws'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  Seeding variables
&lt;/h3&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;poetry --directory ./airflow run \
  airflow variables set aws_region_name us-east-1

poetry --directory ./airflow run \
  airflow variables set current_aws_account NNNNNNNNNNNNNNNN

poetry --directory ./airflow run \
  airflow variables set environment production

poetry --directory ./airflow run \
  airflow variables set airflow_base_url http://localhost:8080/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Dag
&lt;/h2&gt;

&lt;p&gt;Now finally you will be able to do something like that&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from airflow import DAG
from airflow.operators.docker_operator import DockerOperator
from datetime import datetime, timedelta

# Default arguments for the DAG
default_args = {
    'owner': 'me',
    'start_date': datetime(2022, 1, 1),
    'depends_on_past': False,
    'retries': 1,
    'retry_delay': timedelta(minutes=5),
}

# Create the DAG
with DAG(
    'hello_world_dag',
    default_args=default_args,
    schedule_interval=timedelta(hours=1),
    catchup=False,
) as dag:
    # Create a task using the DockerOperator
    hello_world_task = DockerOperator(
        task_id='hello_world_task',
        image='localhost:5000/myimage:latest',
        api_version='auto',
        command='echo "hello world"',
        docker_conn_id='local_docker_registry',
    )
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>airflow</category>
      <category>docker</category>
      <category>dockeroperator</category>
      <category>dag</category>
    </item>
  </channel>
</rss>
