Code Monkey home page Code Monkey logo

extrapypi's Introduction

extrapypi

Build Status Coverage Status Documentation Status

External pypi server with web ui and basics permissions management

extrapypi don't mirror official pypi packages, and will not. It's just not build with this goal in mind. extrapypi is just here to provide you an extra index to upload and install private packages simply.

Features

  • Upload packages from twine / setuptools
  • Install packages with pip using only extra-index option
  • Basics permissions management using roles (currently admin, developer, maitainer, installer)
  • Easy deployment / installation using the WSGI server you want
  • MySQL, PostgresSQL and SQLite support and tested
  • Extensible storage system
  • CLI tools to help you deploy / init / test extrapypi
  • Basic dashboard to visualize packages and users
  • Codebase aim to be simple and hackable

Roadmap

Features that we want to implement for future releases :

  • interface for pip search
  • prefix management

Installation

You can install extrapypi with pip

pip install extrapypi

Or from source

python setup.py install

NOTE if you want to use anything else than sqlite, you must download appropriate drivers (like psycopg2 for postgres)

Deployment

First thing, you will need to create a configuration file for your extrapypi. We provide a cli command to generate a sample :

extrapypi start --filename myconfig.cfg

This command will create a file named myconfig.cfg in your current directory with the following content

"""Sample configuration
"""

# Database connexion string
SQLALCHEMY_DATABASE_URI = "sqlite:///extrapypi.db"

# Update this secret key for production !
SECRET_KEY = "changeit"

# Storage settings
# You need to update at least packages_root setting
STORAGE_PARAMS = {
    'packages_root': "/path/to/my/packages"
}

Once you've updated your configuration, you will need to init database

EXTRAPYPI_CONFIG=/path/to/myconfig.cfg extrapypi init

Note that you can also export EXTRAPYPI_CONFIG variable

This will create tables and two users :

  • an admin with login and password set to admin
  • an install with login and password set to pip

You can check full init usage in documentation.

Here we are, you can now run extrapypi

For testing purpose

EXTRAPYPI_CONFIG=/path/to/myconfig.cfg extrapypi run

With gunicorn

EXTRAPYPI_CONFIG=/path/to/myconfig.cfg gunicorn extrapypi.wsgi:app

with uwsgi

EXTRAPYPI_CONFIG=/path/to/myconfig.cfg uwsgi --http 0.0.0.0:8000 --module extrapypi.wsgi:app

Once done, you can access the dashboard at the following address :

http://mydomainorip:8000/dashboard

You can see full examples for deploying extrapypi in production in the documentation

WARNING since extrapypi use basic auth, we strongly advise to run it behind a reverse proxy (like nginx) and use https

Usage

Uploading packages

extrapypi is compliant with setuptools / twine, you just need to update your .pypirc like this

[distutils]
index-servers =
    local

[local]
username=admin
password=admin
repository=http://127.0.0.1:5000/simple/

And then you can run

python setup.py bdist_wheel upload -r local

Or using twine

twine upload -r local dist/extra_pypi-0.1-py3.5.egg

Installing packages with pip

extrapypi is built to be used as an extra index, so you can simply run :

pip install extrapypi --extra-index-url http://user:[email protected]/simple/ 

or directly updating your pip.conf file

[global]
extra-index-url = http://user:[email protected]/simple/

Development

Install main package

python setup.py install

Then you can use included cli to setup your env

extrapypi init
extrapypi run

Running server

extrapypi use flask cli, extrapypi command is only a hook to extrapypi.manage that include several commands but anything present in flask script can be used for extrapypi too.

For exemple you can start application using flask run with debug on like this :

FLASK_DEBUG=1 flask run

Running test

First install tox

pip install tox

Then you can just run

tox -e sqlite

You can also run tox in all envs if needed

extrapypi's People

Contributors

karec avatar

Watchers

James Cloos avatar florent marmol avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.