Masonite Documentation
v1.3
v1.3
  • Introduction
  • Prologue
    • Introduction
    • Contributing Guide
    • How To Contribute
    • Release Cycle
  • What's New
    • Masonite 1.3
  • The Basics
    • Routing
    • Controllers
    • Views
    • Requests
    • The Craft Command
    • Static Files
    • Helper Functions
  • Architectural Concepts
    • Request Lifecycle
    • Service Providers
    • Service Container
  • Advanced
    • Middleware
    • Creating Commands
    • Creating Packages
    • Publishing Packages
    • Compiling Assets
    • Validation
    • View Composers and Sharing
    • Uploading
    • Queues and Jobs
    • Mail
      • Creating a Mail Driver
  • Security
    • Authentication
    • Encryption
  • Orator ORM
    • Basic Usage
    • Query Builder
    • ORM
    • Pagination
    • Schema Builder
    • Database Migrations
    • Collections
  • Managers and Drivers
    • About Managers
    • About Drivers
  • Official Packages
    • Masonite AuthHub
    • Masonite Clerk
    • Masonite Triggers
Powered by GitBook
On this page
  • Publishing Packages
  • Introduction
  • NOTE: Virtual Environment
Edit on Git
Export as PDF
  1. Advanced

Publishing Packages

PreviousCreating PackagesNextCompiling Assets

Last updated 7 years ago

Publishing Packages

Introduction

Publishing packages are a great way for third party packages to integrate into Masonite. They are extremely easy to setup even on existing pip packages. Publishing packages allows any package to create configuration files, routes, controllers, and other integrations that make developing with your packages amazing. You can read about this in the documentation to learn more about how you can integrate your existing packages or future packages with Masonite.

NOTE: Virtual Environment

If you are in a virtual environment,craft publishwill not have access to your virtual environment dependencies. In order to fix this, we can add our site packages to ourconfig/packages.pyconfig file

If you attempt to publish your package without your virtual environment's site_packages file being inside config/packages.py, you will encounter a ModuleNotFound error that says it cannot find the integrations file located with the package you are trying to install. This is because Masonite does not have knowledge of your virtual environments dependencies, only your system dependencies.

If you are in a virtual environment then go to yourconfig/packages.pyfile and add your virtual environments site_packages folder to theSITE_PACKAGESlist. YourSITE_PACKAGESlist may look something like:

SITE_PACKAGES = [
    'venv/lib/python3.6/site-packages'
]

This will allowcraft publishto find our dependencies installed on our virtual environment. Read the documentation for more information.

Once done, all future packages that you pip install will be available through the publish command. This configuration should be done as soon as your virtual environment is created so you don't encounter any errors while trying to publish packages.

Creating Packages
Publishing Packages