series: Guide Python

Introduction

This guide will walk you through the process of creating a Python package, building it, pushing it to Gemfury, and then installing it. Before you get started, be sure you have the following: Gemfury account Local Python installation Pipenv or pip installed locally

Install packages with Pipenv

You can configure your Pipenv project to use Gemfury as the primary source of Python packages. To start, add Gemfury as a source to your project’s Pipfile: [[source]] url = "https://pypi.fury.io/USERNAME/" verify_ssl = true name = "fury" Then, request packages from your Gemfury account with: [packages] <package_name> = { version = "*", index = "fury" } And now you’re ready to pipenv install from your Gemfury account. Accessing private packages To authenticate into your private repository, you can use environment variable expansion in the source URL of the configuration above: 

Install packages with pip

You can configure your Python project to use Gemfury as the primary source of packages. To start, add Gemfury as the main index to the top of your project’s requirements.txt: --index-url https://pypi.fury.io/USERNAME/ --extra-index-url https://pypi.org/simple/ private-package=0.0.1 ... This configuration will look for named packages in your Gemfury account with fallback to the public index. Accessing private packages To authenticate into your private repository, you can use environment variable expansion in the source URL of the configuration above: 1 

Upload packages with Twine

Many developers choose Twine to publish Python packages. Gemfury supports Twine through our upload endpoint. To start, you will need an authentication token for your account from the Tokens section of your dashboard. Upload a single package with the following command: $ twine upload PACKAGE --repository-url https://push.fury.io/USERNAME -u TOKEN -p "" You can also upload multiple packages by specifying a directory: $ twine upload dist/* --repository-url https://push.fury.io/USERNAME -u TOKEN -p "" If using Twine as part of a script, securely pass your token using an environment variable TWINE_USERNAME: