For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
      • AstroFully-managed data operations, powered by Apache Airflow.
      • Astro Private CloudRun Airflow-as-a-service in your environment.
      • Professional ServicesExpert Airflow services for your enterprise's success.
    • Tools
      • Cosmos
      • Orbiter
      • CLI
      • AI SDK
      • Agents
      • Blueprint
      • UpdatesThe State of Airflow 2026See the insights from over 5,800 data practitioners in the full report. Download Now ➔
  • Customers
  • Docs
    • Insights
      • Blog
      • Webinars
      • Resource Library
      • Events
    • Education
      • Academy
      • What is Airflow?
  • Pricing
Get Started Free
    • Astro CLI
    • Quickstart
      • Develop your project
        • Add Airflow providers, Python packages, and OS packages
        • Add Private Python packages
      • Test your DAGs
    • CLI reference

Product

  • Platform Overview
  • Astro
  • Astro Observe
  • Astro Private Cloud
  • Security & Trust
  • Pricing

Tools & Services

  • Cosmos
  • Docs
  • Professional Services
  • Product Updates

Use Cases

  • AI Ops
  • Data Observability
  • ETL/ELT
  • ML Ops
  • Operational Analytics
  • All Use Cases

Industries

  • Financial Services
  • Gaming
  • Retail
  • Manufacturing
  • Healthcare
  • All Industries

Resources

  • Academy
  • eBooks & Guides
  • Blog
  • Webinars
  • Events
  • The Data Flowcast Podcast
  • All Resources

Airflow

  • What is Airflow
  • Airflow on Astro
  • Airflow 3.0
  • Airflow Upgrades
  • Airflow Use Cases
  • Airflow 2.x End of Life

Company

  • Our Story
  • Customers
  • Newsroom
  • Careers
  • Contact

Support

  • Knowledge Base
  • Status
  • Contact Support
GitHubYouTubeLinkedInx
  • Legal
  • Privacy
  • Terms of Service
  • Consent Preferences

  • Do Not Sell or Share My Personal information
  • Limit the Use Of My Sensitive Personal Information

Apache Airflow®, Airflow, and the Airflow logo are trademarks of the Apache Software Foundation. Copyright © Astronomer 2026. All rights reserved.

LogoLogo
On this page
  • Setup
  • Install Python packages from private GitHub repositories
  • Prerequisites
  • Step 1: Specify the private repository in your project
  • Step 2: Configure credentials
  • Step 3: Run with build secrets
  • Deploy with GitHub Actions
  • Deploy with the Astronomer deploy action
  • Prerequisites
  • Step 1: Specify the private repository in your project
  • Step 2: Update Dockerfile
  • Step 3: Build a custom Docker image
  • Install Python packages from a private PyPI index
  • Prerequisites
  • Add Python packages to your Astro project
  • Example requirements.txt
Develop with the CLIAdd Airflow providers and packages

Install Python packages from private sources

Edit this page
Built with

Python packages can be installed into your image from both public and private sources. To install packages listed on private PyPI indices or a private git-based repository, you need to complete additional configuration in your project.

Depending on where your private packages are stored, use one of the following setups to install these packages to an Astro project by customizing your Runtime image.

Deploying a custom Runtime image with a CI/CD pipeline requires additional configurations. For an example implementation, see the GitHub Actions CI/CD templates for Astro and Astro Private Cloud.

Setup

Private GitHub Repo
Private PyPi Index

Install Python packages from private GitHub repositories

This topic provides instructions for building your Astro project with Python packages from a private GitHub repository. Although GitHub is used in these examples, the same approach works with any hosted Git repository.

Using .netrc build secrets
Using SSH keys

Use the --build-secrets flag to pass .netrc credentials at build time. This approach lets you add private packages to your requirements.txt file without custom Dockerfile configuration.

This method requires Astro Runtime 3.1-14+, 3.0-15+, or later than 13.5.1.

Prerequisites

  • The Astro CLI
  • An Astro project
  • Custom Python packages that are installable with pip
  • A private GitHub repository for each of your custom Python packages
  • The GitHub CLI or a GitHub personal access token

Step 1: Specify the private repository in your project

Add your private packages to your requirements.txt file using HTTPS URLs in the following format:

git+https://github.com/<your-github-organization-name>/<your-private-repository>.git

For example, to install mypackage1 and mypackage2 from myorganization:

git+https://github.com/myorganization/mypackage1.git
git+https://github.com/myorganization/mypackage2.git

Step 2: Configure credentials

Define the NETRC_CONTENT environment variable in your shell profile (.bashrc or .zshrc):

$export NETRC_CONTENT="machine github.com login oauth2 password $(gh auth token)"

If you don’t use the GitHub CLI, replace $(gh auth token) with a GitHub personal access token that has access to your private repositories.

Step 3: Run with build secrets

Pass the --build-secrets flag when running Astro CLI commands:

$astro dev start --build-secrets id=netrc,env=NETRC_CONTENT

To run tests:

$astro dev pytest --build-secrets id=netrc,env=NETRC_CONTENT

The --build-secrets flag securely provides the .netrc content during the Docker build without storing credentials in the image.

Deploy with GitHub Actions

To build your image in a GitHub Actions workflow, pass the .netrc content as a build secret:

1- name: Build image
2 uses: docker/build-push-action@v4
3 with:
4 context: .
5 secrets: |
6 netrc=machine github.com login oauth2 password ${{ secrets.GITHUB_TOKEN }}

Deploy with the Astronomer deploy action

To deploy using the Astronomer deploy action, pass the .netrc content through build-secrets and set the NETRC_CONTENT environment variable:

1- name: Deploy to Astro
2 uses: astronomer/deploy-action@v0.x
3 with:
4 build-secrets: id=netrc,env=NETRC_CONTENT
5 # ... deployment-id, etc.
6 env:
7 NETRC_CONTENT: "machine github.com login oauth2 password ${{ secrets.GITHUB_TOKEN }}"