Skip to content

Commit

Permalink
Fully functional pipenv management
Browse files Browse the repository at this point in the history
  • Loading branch information
Blue-Dog-Archolite committed Jul 7, 2017
1 parent d509486 commit bdf5c5a
Show file tree
Hide file tree
Showing 8 changed files with 342 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true

[packages]
wheel = "*"
pipenv = "*"

[dev-packages]
flake8 = "*"
jedi = "*"
neovim = "*"
psutil = "*"
pdb = "*"
coverage = "*"
jupyter = "*"
twine = "*"
243 changes: 243 additions & 0 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Intent

[Pipenv](http://docs.pipenv.org/en/latest/) is a great python virtual environment management system. However it does not have the same popularity as others such as `virtualenv`. This causes some issuesj
when working with a team. Pipenv does not have a native set of tools for making cross virtual environment management tools work nor should it.

This is a package that allows for a few convince commands in order to provide easier usage for mixed environment teams.


## Tools included

### Rebuilding Requirements

Rebuilding your requirements file is a pain if it is not your primary source of `pip` truth. This command runs `pipenv lock` and then packages only the non-development
modules. It also sorts your `requirements.txt` file in alphabetical order for easier reading.

$ rebuild_requirements

### Installing packages from Requirements

Installing from `requirements.txt` file is sometimes required. Pipenv does not provide a quick way to do this.

$ install_requirements

This will process your `requirements.txt` file and install all missing packages to the non-development package set on Pipenv. There is a suggested work around that also
provides this functionality if you wish to execute it yourself without the necessity of installing this package.

$ pipenv install $(< requirements.txt)
Empty file added pipenv_tools/__init__.py
Empty file.
28 changes: 28 additions & 0 deletions pipenv_tools/command_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env python

import os

from pipenv.project import Project
from pipenv.utils import convert_deps_to_pip

"""
This is a generation file that uses pipenv to regenerate the requirements file.
This tool allows for development only requirements that each developer can use separate of the
production tool set.
http://docs.pipenv.org/en/latest/
"""


def rebuild():
os.system('pipenv lock')
packages = Project().parsed_pipfile.get('packages', {})
deps = convert_deps_to_pip(packages, r=False)

with open('requirements.txt', 'w') as f:
print(deps)
f.write('\n'.join(sorted(deps)))


def install():
os.system('pipenv install $(< requirements.txt)')
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pipenv
wheel
5 changes: 5 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[metadata]
description-file = README.md

[bdist_wheel]
universal=1
20 changes: 20 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from setuptools import setup

setup(name='pipenv-package-requirements',
version='0.1',
description='Pipenv tools for requirements.txt',
url='https://github.com/Blue-Dog-Archolite/pipenv-package-requirements',
author='Robert R. Meyer',
author_email='Blue.Dog.Archolite@gmail.com',
license='GNU',
packages=['pipenv_tools'],
zip_safe=True,
console_scripts=[
'rebuild_requirements=pipenv_tools.command_line:rebuild',
'install_requirements=pipenv_tools.command_line:install',
],
keywords='pipenv virtualenv',
install_requires=[
'pipenv',
],
)

0 comments on commit bdf5c5a

Please sign in to comment.