Skip to content

yuriysemen/s3pypi

 
 

Repository files navigation

PyPI

It is a copy of https://github.com/novemberfiveco/s3pypi It is just to be sure it will be accessible at any time.

This is also deployed to the same s3 repo, so we will always have this available.

There are newer version where it is possible todefined Whitelisted IP addresses and fixed some issues (like not all valid characters could be in name of the package). I want to keep trusted version here!

S3PyPI

S3PyPI is a CLI tool for creating a Python Package Repository in an S3 bucket.

An extended tutorial on using this tool can be found here.

Installation

Install the latest version:

pip install --upgrade s3pypi --extra-index-url https://pypi.domain.com/

Install the development version:

git clone -b develop git@github.com:novemberfiveco/s3pypi.git
cd s3pypi/ && sudo pip install -e .

Setting up S3 and CloudFront

Before you can start using s3pypi, you must set up an S3 bucket for your Python Package Repository, with static website hosting enabled. Additionally, you need a CloudFront distribution for serving the packages in your S3 bucket to pip over HTTPS. Both of these resources can be created using the CloudFormation templates provided in the cloudformation/ directory:

aws cloudformation create-stack --stack-name STACK_NAME \
    --template-body file://cloudformation/s3-pypi.json \
    --parameters ParameterKey=AcmCertificateArn,ParameterValue=ACM_CERT_ARN \
                 ParameterKey=DomainName,ParameterValue=DOMAIN_NAME

Managing Your Server Certificates

Route53

It is necessary to add RecordSet manually. It is Type A, alias to created cloudFront distribution.

Distributing packages

You can now use s3pypi to create Python packages and upload them to your S3 bucket. To hide packages from the public, you can use the --private option to prevent the packages from being accessible directly via the S3 bucket (they will only be accessible via Cloudfront and you can use WAF rules to protect them), or alternatively you can specify a secret subdirectory using the --secret option:

cd /path/to/your/awesome-project/
s3pypi --bucket mybucket [--private] [--secret SECRET]

Installing packages

Install your packages using pip by pointing the --extra-index-url to your CloudFront distribution (optionally followed by a secret subdirectory):

pip install --upgrade s3pypi --extra-index-url https://pypi.domain.com/

Alternatively, you can configure the index URL in ~/.pip/pip.conf:

[global]
extra-index-url = https://pypi.domain.com/

About

CLI tool for creating a Python Package Repository in an S3 bucket.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 94.1%
  • Shell 5.9%