Skip to content

Commit

Permalink
Migrate to Pipenv, remove requirements.txt
Browse files Browse the repository at this point in the history
In b1e6160 Pipenv was added to
Paperless, adding a note to the changelog in
eec8f09 that a switch to just using
Pipenv was planned.

This commit performs this switch. Having two sources for which
dependencies should be installed (requirements.txt, Pipfile.lock) is
very suboptimal, and the files have diverged since they have been added.

This closes the-paperless-project#661.
  • Loading branch information
pitkley committed May 19, 2020
1 parent cc31fc1 commit 3eb5e8e
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 92 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ db.sqlite3-journal
virtualenv
docker-compose.yml
docker-compose.env
requirements.txt

# Used for development
scripts/import-for-development
Expand Down
2 changes: 2 additions & 0 deletions docs/examples/lxc/lxc-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ su -c "cd /home/paperless ; git clone https://github.com/the-paperless-project/p

# Install Pip Requirements
apt-get -y install python3-pip python3-venv
pip3 install pipenv
cd /home/paperless/paperless
pipenv lock -r > requirements.txt
pip3 install -r requirements.txt

# Take paperless.conf.example and set consumuption dir (ftp dir)
Expand Down
1 change: 1 addition & 0 deletions docs/migrating.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ rolled in as part of the update:
$ cd /path/to/project
$ git pull
$ pipenv lock -r > requirements.txt
$ pip install -r requirements.txt
$ cd src
$ ./manage.py migrate
Expand Down
38 changes: 26 additions & 12 deletions docs/requirements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ For the purposes of simplicity, ``python`` and ``pip`` is used everywhere to
refer to their Python3 versions.

In addition to the above, there are a number of Python requirements, all of
which are listed in a file called ``requirements.txt`` in the project root
directory.
which are listed in a file called ``Pipfile`` in the project root directory.

If you're not working on a virtual environment (like Docker), you
should probably be using a virtualenv, but that's your call. The reasons why
Expand Down Expand Up @@ -71,29 +70,44 @@ dependencies is easy:

.. code:: bash
$ pip install --user --requirement /path/to/paperless/requirements.txt
$ cd /path/to/paperless
$ pipenv lock -r > requirements.txt
$ pip install --user --requirement requirements.txt
This will download and install all of the requirements into
``${HOME}/.local``. Remember that your distribution may be using ``pip3`` as
mentioned above.

If you don't have Pipenv installed, then you can install it using ``pip``:

.. code:: Bash
$ pip install --user pipenv
.. _requirements-virtualenv:

Python-specific Requirements: Virtualenv
----------------------------------------

Using a virtualenv for this is pretty straightforward: create a virtualenv,
enter it, and install the requirements using the ``requirements.txt`` file:
Using a virtualenv for Paperless is very easy, thanks to Pipenv. If you don't
have Pipenv installed, then you can install it using ``pip``:

.. code:: Bash
$ pip install --user pipenv
With Pipenv available, it is trivial to create the virtual environment and
install the requirements:

.. code:: bash
$ virtualenv --python=/path/to/python3 /path/to/arbitrary/directory
$ . /path/to/arbitrary/directory/bin/activate
$ pip install --requirement /path/to/paperless/requirements.txt
$ cd /path/to/paperless
$ pipenv --python 3
$ pipenv install
Now you're ready to go. Just remember to enter (activate) your virtualenv
whenever you want to use Paperless.
Now you're ready to go. Just remember to enter the virtual environment
created by Pipenv using ``pipenv shell`` whenever you want to use Paperless.


.. _requirements-documentation:
Expand All @@ -102,8 +116,8 @@ Documentation
-------------

As generation of the documentation is not required for the use of Paperless,
dependencies for this process are not included in ``requirements.txt``. If
you'd like to generate your own docs locally, you'll need to:
dependencies for this process are not included in ``Pipfile``. If you'd like
to generate your own docs locally, you'll need to:

.. code:: bash
Expand Down
80 changes: 0 additions & 80 deletions requirements.txt

This file was deleted.

0 comments on commit 3eb5e8e

Please sign in to comment.