diff --git a/Pipfile b/Pipfile new file mode 100644 index 0000000..1582b61 --- /dev/null +++ b/Pipfile @@ -0,0 +1,23 @@ +[[source]] + +url = "https://pypi.python.org/simple" +name = "pypi" +verify_ssl = true + + +[dev-packages] + + + +[packages] + +Django = "<1.9,>=1.8" +Pillow = "*" +requests = "*" +django-taggit = "*" +django-images = "*" +django-braces = "*" +django_compressor = "*" +django-tastypie = "==0.12.2" +mock = "*" +factory_boy = "<2.0,>=1.3" diff --git a/Pipfile.lock b/Pipfile.lock new file mode 100644 index 0000000..dab57bf --- /dev/null +++ b/Pipfile.lock @@ -0,0 +1,214 @@ +{ + "_meta": { + "hash": { + "sha256": "90c7b7911bfd056b8bbcba05bf4a8a771d9399d75dfab94a5679d079210df968" + }, + "host-environment-markers": { + "implementation_name": "cpython", + "implementation_version": "3.5.2", + "os_name": "posix", + "platform_machine": "x86_64", + "platform_python_implementation": "CPython", + "platform_release": "4.4.0-112-generic", + "platform_system": "Linux", + "platform_version": "#135-Ubuntu SMP Fri Jan 19 11:48:36 UTC 2018", + "python_full_version": "3.5.2", + "python_version": "3.5", + "sys_platform": "linux" + }, + "pipfile-spec": 6, + "requires": {}, + "sources": [ + { + "name": "pypi", + "url": "https://pypi.python.org/simple", + "verify_ssl": true + } + ] + }, + "default": { + "certifi": { + "hashes": [ + "sha256:14131608ad2fd56836d33a71ee60fa1c82bc9d2c8d98b7bdbc631fe1b3cd1296", + "sha256:edbc3f203427eef571f79a7692bb160a2b0f7ccaa31953e99bd17e307cf63f7d" + ], + "version": "==2018.1.18" + }, + "chardet": { + "hashes": [ + "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691", + "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae" + ], + "version": "==3.0.4" + }, + "django": { + "hashes": [ + "sha256:d8e2fd119756ab10b43a31052c3c8efbc262064b81eecb7871372de4d37b1a94", + "sha256:c7611cdd5e2539a443b7960c7cafd867d986c2720a1b44808deaa60ce3da50c7" + ], + "version": "==1.8.18" + }, + "django-appconf": { + "hashes": [ + "sha256:ddab987d14b26731352c01ee69c090a4ebfc9141ed223bef039d79587f22acd9", + "sha256:6a4d9aea683b4c224d97ab8ee11ad2d29a37072c0c6c509896dd9857466fb261" + ], + "version": "==1.0.2" + }, + "django-braces": { + "hashes": [ + "sha256:7e0cb698f3cd17cc58d50aea4a663233f44228144b81d85e1b9bad05aa7f3f80", + "sha256:7c5b91c75240ccf2eb124fe3b09dd4978e8f4d412b553bb791920bd55839159c" + ], + "version": "==1.12.0" + }, + "django-compressor": { + "hashes": [ + "sha256:7732676cfb9d58498dfb522b036f75f3f253f72ea1345ac036434fdc418c2e57", + "sha256:9616570e5b08e92fa9eadc7a1b1b49639cce07ef392fc27c74230ab08075b30f" + ], + "version": "==2.2" + }, + "django-images": { + "hashes": [ + "sha256:0f6e079fa33683d765b6dec23e370750d8861d6de290b0346512d917da2d1461" + ], + "version": "==0.4.3" + }, + "django-taggit": { + "hashes": [ + "sha256:58aa3e59e0643446e102523f22d137300298e2a537b1c5b0c310d99143f2c2b8", + "sha256:fd13e304ba37ff09e601c4797d893fb7d3e699a789b5afb0b09d686f94470441" + ], + "version": "==0.22.2" + }, + "django-tastypie": { + "hashes": [ + "sha256:7feccf811a8c2c60bc227e0d956015f0ea6097c804660e8f4a4ada0e74817c24", + "sha256:21625ce191ccb734f47b90ef92b603d04366bb67d0eb52bd060a8d76e6706018" + ], + "version": "==0.12.2" + }, + "factory-boy": { + "hashes": [ + "sha256:bd5d87634946c8831c0d1389b5995da5dd64ccd97088eebc311eb0c9ef75ae3b" + ], + "version": "==1.3.0" + }, + "idna": { + "hashes": [ + "sha256:8c7309c718f94b3a625cb648ace320157ad16ff131ae0af362c9f21b80ef6ec4", + "sha256:2c6a5de3089009e3da7c5dde64a141dbc8551d5b7f6cf4ed7c2568d0cc520a8f" + ], + "version": "==2.6" + }, + "mock": { + "hashes": [ + "sha256:5ce3c71c5545b472da17b72268978914d0252980348636840bd34a00b5cc96c1", + "sha256:b158b6df76edd239b8208d481dc46b6afd45a846b7812ff0ce58971cf5bc8bba" + ], + "version": "==2.0.0" + }, + "pbr": { + "hashes": [ + "sha256:60c25b7dfd054ef9bb0ae327af949dd4676aa09ac3a9471cdc871d8a9213f9ac", + "sha256:05f61c71aaefc02d8e37c0a3eeb9815ff526ea28b3b76324769e6158d7f95be1" + ], + "version": "==3.1.1" + }, + "pillow": { + "hashes": [ + "sha256:718ec7a122b28d64afc5fbc3a9b99bb0545ef511373cac06fe7624520e82cb20", + "sha256:801cca8923508311bf5d6d0f7da5362552e8208ebd8ec0d7b9f2cd2ff5705734", + "sha256:43334f9581cd067945b8898cef9eb5714ee4883f8de0304c011f1dbdb1d4e2aa", + "sha256:153ec6f18f7b61641e0e6e502acfaf4a06c9aba2ea11c0b4b3578ea9f13a4a4a", + "sha256:25193f934d37d836a6b1f4c062ce574a96cbca7c6d9dc8ddfbbac7f9c54deaa4", + "sha256:b85f703c2ffe539313e39ce0676bed0f355cec45a16e58c9ab7417445843047c", + "sha256:8580fc58074a16b749905b26cf8363f7b628dd167ba0130f5382cdc91c86b509", + "sha256:2fcde9954c8882d1c7f93bb828caa34a4c5e3ee69dbc7895dc8652ad972b455a", + "sha256:1a5b93084e01328a1cb1ecdad99d11d75e881e89a95f88d85b523646553b36c2", + "sha256:b2240f298482f823576f397bb9f32ea913ad9456c526e141bc6f0a022b37a3e8", + "sha256:b1d33c63a55d0d85df0ad02b2c16158fb4d8153afa7b908f1a67330fac694cd6", + "sha256:6977cf073d83358b34f93abf5c1f1193b88675fe0e4441e0e28318bc3dcba7a0", + "sha256:1912b7230459fd53682dae32b83cbd8e5d642ba36d4be18566f00a9c063aa13d", + "sha256:4bd4a71501b6d51db4abc07e1f43f5a6fed0a1a9583cca0b401d6af50284b0db", + "sha256:0013f590a8f260df60bcfd65db19d18efc04e7f046c3c82a40e2e2b3292a937c", + "sha256:a224651a81e45ef4f1d0164e256c5f6b4abb49f2ae8f22ba2f3a9d0ff338e608", + "sha256:c793dfaa130847ccff958492b76ae8b9304e60b8a79a92962cb19e368276a22b", + "sha256:0b899ee80920bb533f26581af9b4660bc12aff4562555afe74e429101ebf3c94", + "sha256:9525cd680a6f9e80c6c0af03cf973e6505c59f60b4745f682cd1a449e54b31bb", + "sha256:35f7d998b8e82fb3fb51ff88b30485eb81cd7dd56ec7e1a8deba23eb88532d44", + "sha256:5b0d657460d9f3615876fec6306e97ca15a471f6169b622d76a47e270998acf1", + "sha256:ddd16ab250b4fc97db1c47407e78c25216a75c29d29d10ad37e51b7a2ec7b2c3", + "sha256:b9f63451084a718eccdeb1e382768c94647915653af4d6019f64560d9e98642b", + "sha256:a370d1c570f1d72e877099651e752332444b1c5009381f043c9da5fd47f3ebae", + "sha256:dc4b018d5c9b636f7546583c5591b9ea00c328c3e5871992ef5b95bac353f097", + "sha256:e126ff4fed71e78333840c07279e1617f63cfca76d63ad5b27d65a7277206a3d", + "sha256:fcf64c91fd44485100a2965d23bb0e227d093e91f7e776c5ca3b32574766eb56", + "sha256:2c042352b430d678db50c78c5214e19638eff8b688941271da2de21fd298dfe5", + "sha256:17fe25efc785194d48c38fad85dce470013ba19d2fb66639e149f14bccf1327f", + "sha256:2e818dbe445e86fc6c266973fe540c35125c42eb2cf13a6095e9adaa89c0deb5", + "sha256:135e9aa65150c53f7db85bf2bebb8a0e1a48ea850e80cf66e16dd04fa09d309c", + "sha256:7dfbefdb3fb911ca9faed307bf309861e9995e36cca6b761c7ba6d9b77a9744a", + "sha256:12f29d6c23424f704c66b5b68c02fe0b571504459605cfe36ab8158359b0e1bb", + "sha256:f8d49be8c282df8d2e1ab6ab53ab8abd859b1fa6fed384457ee85c9eff64ef97", + "sha256:82b172e3264e62372c01b5b009b5b1a02fbb9276cbe5cc57ab00a6d6e5ed9a18", + "sha256:57aa6198ba8acba1313c3b743e267d821a60cac77e6026caf0b55ca58d3d23be", + "sha256:d60c1625b108432ace8b1fa1a584017e5efa73f107d0f493c7f39c79bebf1d41", + "sha256:82d1ff571489765df2816785d532e243bde213752156c227fca595723ec5ff42", + "sha256:37cc0339abfa9e295c75d9a7f227d35cb44716feb95057f9449c4a9e9a17daf7", + "sha256:931030d1d6282b7900e6b0a7ff9ecdb503b5e1e6781800dab2b71a9f39405bff", + "sha256:5cd36804f9f06a914a883fe682df5711d16d7b4f44d43189c5f013e7cd91e149" + ], + "version": "==5.0.0" + }, + "python-dateutil": { + "hashes": [ + "sha256:95511bae634d69bc7329ba55e646499a842bc4ec342ad54a8cdb65645a0aad3c", + "sha256:891c38b2a02f5bb1be3e4793866c8df49c7d19baabf9c1bad62547e0b4866aca" + ], + "version": "==2.6.1" + }, + "python-mimeparse": { + "hashes": [ + "sha256:a295f03ff20341491bfe4717a39cd0a8cc9afad619ba44b77e86b0ab8a2b8282", + "sha256:76e4b03d700a641fd7761d3cd4fdbbdcd787eade1ebfac43f877016328334f78" + ], + "version": "==1.6.0" + }, + "rcssmin": { + "hashes": [ + "sha256:ca87b695d3d7864157773a61263e5abb96006e9ff0e021eff90cbe0e1ba18270" + ], + "version": "==1.0.6" + }, + "requests": { + "hashes": [ + "sha256:6a1b267aa90cac58ac3a765d067950e7dbbf75b1da07e895d1f594193a40a38b", + "sha256:9c443e7324ba5b85070c4a818ade28bfabedf16ea10206da1132edaa6dda237e" + ], + "version": "==2.18.4" + }, + "rjsmin": { + "hashes": [ + "sha256:dd9591aa73500b08b7db24367f8d32c6470021f39d5ab4e50c7c02e4401386f1" + ], + "version": "==1.0.12" + }, + "six": { + "hashes": [ + "sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb", + "sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9" + ], + "version": "==1.11.0" + }, + "urllib3": { + "hashes": [ + "sha256:06330f386d6e4b195fbfc736b297f58c5a892e4440e54d294d7004e3a9bbea1b", + "sha256:cc44da8e1145637334317feebd728bd869a35285b93cbb4cca2577da7e62db4f" + ], + "version": "==1.22" + } + }, + "develop": {} +} diff --git a/README.rst b/README.rst index be59489..6a02f81 100644 --- a/README.rst +++ b/README.rst @@ -16,16 +16,9 @@ Requirements Pinry is built on top of Django and optimized to run on a Linux environment. However we have gotten Pinry to work on Windows and Mac as well but it may require some extra digging around configuration. Pinry's -Python requirements are all in the ``requirements.txt`` file and easily -installable once you have up a virtual environment. What you need -initially: - -* Python -* pip -* virtualenv -* Your OS's build tools (Ubuntu: ``build-essential``, Mac: ``Xcode``) -* Build dependencies for PIL/Pillow (Ubuntu: - ``apt-get build-dep python-imaging``) +Python requirements are all in the ``Pipfile`` file. You can easily install +these using pipenv, to get pipenv, if you already have Python and pip, run +python ``pip install pipenv``. Testing @@ -38,9 +31,7 @@ recommend using our tags/versions though. To run Pinry's tests inside the Pinry repo run:: - virtualenv .venv - source .venv/bin/activate - pip install -r requirements.txt + pipenv install python manage.py test diff --git a/pinry/core/models.py b/pinry/core/models.py index f673af5..e80f61e 100644 --- a/pinry/core/models.py +++ b/pinry/core/models.py @@ -1,9 +1,6 @@ import requests -try: - from cStringIO import StringIO -except ImportError: # Python 3 support - from io import StringIO +from io import BytesIO from django.conf import settings from django.core.files.uploadedfile import InMemoryUploadedFile @@ -19,7 +16,7 @@ class ImageManager(models.Manager): # FIXME: Move this into an asynchronous task def create_for_url(self, url): file_name = url.split("/")[-1].split('#')[0].split('?')[0] - buf = StringIO() + buf = BytesIO() response = requests.get(url) buf.write(response.content) obj = InMemoryUploadedFile(buf, 'image', file_name, diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index f09fd18..0000000 --- a/requirements.txt +++ /dev/null @@ -1,13 +0,0 @@ -# core -Django>=1.8,<1.9 -Pillow -requests -django-taggit -django-images -django-braces -django_compressor -django-tastypie==0.12.2 - -# testing -mock -factory-boy>=1.3,<2.0