From 3eb5e8e5e62579c25fcca99e14fdb1ad5df0b8ac Mon Sep 17 00:00:00 2001 From: Pit Kleyersburg Date: Tue, 19 May 2020 19:41:19 +0200 Subject: [PATCH 1/2] Migrate to Pipenv, remove `requirements.txt` In b1e616055e8ebfab287495381e4fd75d9f6c3de8 Pipenv was added to Paperless, adding a note to the changelog in eec8f09d6f9b7a9caa8f4a9fbcbbf86733a56c8b 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 #661. --- .gitignore | 1 + docs/examples/lxc/lxc-install.sh | 2 + docs/migrating.rst | 1 + docs/requirements.rst | 38 ++++++++++----- requirements.txt | 80 -------------------------------- 5 files changed, 30 insertions(+), 92 deletions(-) delete mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore index 957d47743..2fa500e96 100644 --- a/.gitignore +++ b/.gitignore @@ -76,6 +76,7 @@ db.sqlite3-journal virtualenv docker-compose.yml docker-compose.env +requirements.txt # Used for development scripts/import-for-development diff --git a/docs/examples/lxc/lxc-install.sh b/docs/examples/lxc/lxc-install.sh index b53858e3a..843d7e33c 100644 --- a/docs/examples/lxc/lxc-install.sh +++ b/docs/examples/lxc/lxc-install.sh @@ -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) diff --git a/docs/migrating.rst b/docs/migrating.rst index c3e702bd5..b992d8717 100644 --- a/docs/migrating.rst +++ b/docs/migrating.rst @@ -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 diff --git a/docs/requirements.rst b/docs/requirements.rst index 54f0d9216..af5e778fc 100644 --- a/docs/requirements.rst +++ b/docs/requirements.rst @@ -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 @@ -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: @@ -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 diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index c85559fa2..000000000 --- a/requirements.txt +++ /dev/null @@ -1,80 +0,0 @@ --i https://pypi.python.org/simple -alabaster==0.7.12 -apipkg==1.5 -atomicwrites==1.3.0 -attrs==19.1.0 -babel==2.7.0 -brotli==1.0.7 -certifi==2019.6.16 -chardet==3.0.4 -coverage==4.5.4 -coveralls==1.5.1 -dateparser==0.7.0 -django-cors-headers==2.4.0 -django-crispy-forms==1.7.2 -django-extensions==2.1.4 -django-filter==2.1.0 -django==2.0.10 -djangoql==0.12.3 -djangorestframework==3.9.1 -docopt==0.6.2 -docutils==0.15.2 -execnet==1.6.1 -factory-boy==2.11.1 -faker==2.0.0 -filelock==3.0.12 -filemagic==1.6 -fuzzywuzzy[speedup]==0.15.0 -gunicorn==19.9.0 -idna==2.8 -imagesize==1.1.0 -importlib-metadata==0.19 -inotify-simple==1.1.8; sys_platform == 'linux' -jinja2==2.10.1 -langdetect==1.0.7 -markupsafe==1.1.1 -more-itertools==7.2.0 -packaging==19.1 -pdftotext==2.1.1 -pillow==5.4.1 -pluggy==0.12.0 -ply==3.11 -psycopg2==2.8.4 -py==1.8.0 -pycodestyle==2.4.0 -pygments==2.4.2 -pyocr==0.5.3 -pyparsing==2.4.2 -pytest-cov==2.6.1 -pytest-django==3.4.5 -pytest-env==0.6.2 -pytest-forked==1.0.2 -pytest-sugar==0.9.2 -pytest-xdist==1.26.0 -pytest==4.1.1 -python-dateutil==2.7.5 -python-dotenv==0.10.1 -python-gnupg==0.4.4 -python-levenshtein==0.12.0 -pytz==2018.9 -regex==2019.6.8 -requests==2.22.0 -six==1.12.0 -snowballstemmer==1.9.0 -sphinx==1.8.3 -sphinxcontrib-applehelp==1.0.1 -sphinxcontrib-devhelp==1.0.1 -sphinxcontrib-htmlhelp==1.0.2 -sphinxcontrib-jsmath==1.0.1 -sphinxcontrib-qthelp==1.0.2 -sphinxcontrib-serializinghtml==1.1.3 -termcolor==1.1.0 -text-unidecode==1.2 -toml==0.10.0 -tox==3.7.0 -tzlocal==2.0.0 -urllib3==1.25.3 -virtualenv==16.7.2 -wcwidth==0.1.7 -whitenoise==4.1.3 -zipp==0.5.2 From 329dc1a644e7913ffc4dbf5b21d3cd8c6df30338 Mon Sep 17 00:00:00 2001 From: Pit Kleyersburg Date: Tue, 19 May 2020 19:49:31 +0200 Subject: [PATCH 2/2] Update gitignores for IDE files --- .gitignore | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 2fa500e96..342bd62a8 100644 --- a/.gitignore +++ b/.gitignore @@ -54,9 +54,6 @@ coverage.xml # Sphinx documentation docs/_build/ -# PyBuilder -target/ - # Stored PDFs media/documents/*.gpg media/documents/thumbnails/* @@ -68,8 +65,11 @@ media/overrides.js db.sqlite3 db.sqlite3-journal -# PyCharm +# IDE files +target/ .idea +.ropeproject +.vscode # Other stuff that doesn't belong .virtualenv