forked from strayer/django-gcloud-storage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- finalized Tox & py.test setup - README, LICENSE, ...
- Loading branch information
Showing
19 changed files
with
296 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# http://editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.{py,rst,ini,html}] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[*.{css,scss,json,yml}] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
======= | ||
Credits | ||
======= | ||
|
||
Development Lead | ||
---------------- | ||
|
||
* Sven Grunewaldt <[email protected]> | ||
|
||
Contributors | ||
------------ | ||
|
||
* Titusz Pan <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.. :changelog: | ||
History | ||
------- | ||
|
||
0.1.0 (2016-02-01) | ||
~~~~~~~~~~~~~~~~~~ | ||
|
||
* First release on PyPI. | ||
* Development of this release was kindly sponsored by `Craft AG <http://craft.de>`_. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Copyright (c) 2016, Sven Grunewaldt | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
* Neither the name of django-gcloud-storage nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
include AUTHORS.rst | ||
include HISTORY.rst | ||
include LICENSE.txt | ||
include README.rst | ||
include requirements-test.txt | ||
include tox.ini | ||
recursive-include test_app *.html *.py | ||
recursive-include tests *.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
============================= | ||
django-gcloud-storage | ||
============================= | ||
|
||
.. image:: https://badge.fury.io/py/django-gcloud-storage.png | ||
:target: https://badge.fury.io/py/django-gcloud-storage | ||
.. image:: https://img.shields.io/pypi/l/django-gcloud-storage.svg | ||
:target: https://pypi.python.org/pypi/django-gcloud-storage | ||
.. image:: https://img.shields.io/pypi/pyversions/django-gcloud-storage.svg | ||
:target: https://pypi.python.org/pypi/django-gcloud-storage | ||
|
||
Django storage module implementation for Google Cloud Storage using the gcloud_ | ||
python module by Google. | ||
|
||
.. _gcloud: https://pypi.python.org/pypi/gcloud | ||
|
||
Notice: alpha release | ||
--------------------- | ||
|
||
Please keep in mind that this version is not yet used in any production application | ||
(as far as I know of) and thus is an alpha release, even though fully tested! | ||
Any kind of feedback is greatly appreciated. | ||
|
||
Installation | ||
------------ | ||
|
||
Install django-gcloud-storage:: | ||
|
||
pip install django-gcloud-storage | ||
|
||
Create a GCS service account JSON keyfile and a bucket for your application. | ||
Check the documentation of gcloud-python and Google Cloud Platform for more | ||
details: | ||
|
||
https://gcloud-python.readthedocs.org/en/latest/gcloud-auth.html | ||
https://cloud.google.com/storage/docs/authentication#generating-a-private-key | ||
|
||
Update your Django settings and use it like any other Django storage module:: | ||
|
||
DEFAULT_FILE_STORAGE = 'django_gcloud_storage.DjangoGCloudStorage' | ||
|
||
GCS_PROJECT = "django-gcloud-storage" | ||
GCS_BUCKET = "django-gcloud-storage-bucket" | ||
GCS_CREDENTIALS_FILE_PATH = "/path/to/gcs-credentials.json" | ||
|
||
Features | ||
-------- | ||
|
||
* Fully tested on Python 2.7, 3.3 - 3.5 and PyPy with Django 1.7, 1.8 and 1.9 | ||
* Files are locally downloaded as SpooledTemporaryFile objects to avoid memory | ||
abuse | ||
* Changed files will automatically be reuploaded to GCS when closed | ||
|
||
Caveats | ||
------- | ||
|
||
* Files must be fully downloaded to be accessed and fully uploaded when changed | ||
* Everytime a file is opened via the storage module, it will be downloaded again | ||
* (development) Most tests need access to Google Cloud Storage | ||
|
||
Contributing | ||
------------ | ||
|
||
Contributions are welcome, and they are greatly appreciated! Every | ||
little bit helps, and credit will always be given. | ||
|
||
Report Bugs | ||
~~~~~~~~~~~ | ||
|
||
Report bugs at https://github.com/strayer/django-gcloud-storage/issues. | ||
|
||
If you are reporting a bug, please include: | ||
|
||
* Your operating system name and version. | ||
* Any details about your local setup that might be helpful in troubleshooting. | ||
* Detailed steps to reproduce the bug. | ||
|
||
Fix Bugs | ||
~~~~~~~~ | ||
|
||
Look through the GitHub issues for bugs. Anything tagged with "bug" | ||
is open to whoever wants to implement it. | ||
|
||
Implement Features | ||
~~~~~~~~~~~~~~~~~~ | ||
|
||
Look through the GitHub issues for features. Anything tagged with "feature" | ||
is open to whoever wants to implement it. | ||
|
||
Write Documentation | ||
~~~~~~~~~~~~~~~~~~~ | ||
|
||
django-gcloud-storage could always use more documentation, whether as part of the | ||
official django-gcloud-storage docs, in docstrings, or even on the web in blog posts, | ||
articles, and such. | ||
|
||
Pull Request Guidelines | ||
~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
Before you submit a pull request, check that it meets these guidelines: | ||
|
||
1. The pull request should include tests. | ||
2. The pull request should work for all supported Python and Django versions | ||
(see above). Make sure that the tests pass. | ||
|
||
Running Tests | ||
------------- | ||
|
||
Warning: Most of the tests require a GCS project and will do API requests that | ||
may end up costing you money! | ||
|
||
You can run the test suite either in a virtualenv with py.test or with tox - both | ||
require a valid service account JSON keyfile called `test-credentials.json` in | ||
the project root. The GCS project name will be provided via a command argument. | ||
|
||
The tests will create and (hopefully) remove buckets on their own. To be safe, | ||
check if there are any leftover buckets in your GCS project after running the | ||
tests! | ||
|
||
:: | ||
|
||
source <YOURVIRTUALENV>/bin/activate | ||
(myenv) $ pip install -r requirements-test.txt | ||
(myenv) $ pip install -e . | ||
(myenv) $ py.test --gcs-project-name="project-name" | ||
|
||
or | ||
|
||
$ tox -- --gcs-project-name="project-name" | ||
|
||
Credits | ||
------- | ||
|
||
Inspired by: | ||
|
||
* `django-storages`_ | ||
|
||
.. _`django-storages`: https://pypi.python.org/pypi/django-storages | ||
|
||
Tools (partly) used in rendering this package: | ||
|
||
* Cookiecutter_ | ||
* `cookiecutter-djangopackage`_ | ||
|
||
.. _Cookiecutter: https://github.com/audreyr/cookiecutter | ||
.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
-r requirements.txt | ||
pytest | ||
pytest-django | ||
pytest-pythonpath |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[bumpversion] | ||
current_version = 0.1.0 | ||
commit = True | ||
tag = True | ||
|
||
[bumpversion:file:django_gcloud_storage/__init__.py] | ||
|
||
[wheel] | ||
universal = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,65 @@ | ||
import setuptools | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
import os | ||
import re | ||
import sys | ||
|
||
setuptools.setup(name='django-gcloud-storage', version='1.0') | ||
try: | ||
from setuptools import setup | ||
except ImportError: | ||
from distutils.core import setup | ||
|
||
|
||
def get_version(*file_paths): | ||
filename = os.path.join(os.path.dirname(__file__), *file_paths) | ||
with open(filename) as f: | ||
version_file = f.read() | ||
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", | ||
version_file, re.M) | ||
if version_match: | ||
return version_match.group(1) | ||
raise RuntimeError('Unable to find version string.') | ||
|
||
version = get_version('django_gcloud_storage', '__init__.py') | ||
|
||
with open('README.rst') as f: | ||
readme = f.read() | ||
with open('HISTORY.rst') as f: | ||
history = f.read().replace('.. :changelog:', '') | ||
|
||
setup( | ||
name='django-gcloud-storage', | ||
version=version, | ||
description="""Django storage module implementation for Google Cloud Storage""", | ||
long_description=readme + '\n\n' + history, | ||
author='Sven Grunewaldt', | ||
author_email='[email protected]', | ||
url='https://github.com/strayer/django-gcloud-storage', | ||
packages=[ | ||
'django_gcloud_storage', | ||
], | ||
include_package_data=True, | ||
install_requires=[ | ||
"gcloud>=0.8.0", | ||
"django>=1.7" | ||
], | ||
license="BSD", | ||
zip_safe=False, | ||
keywords='django-gcloud-storage gcloud gcs', | ||
classifiers=[ | ||
'Development Status :: 3 - Alpha', | ||
'Framework :: Django', | ||
'Framework :: Django :: 1.7', | ||
'Framework :: Django :: 1.8', | ||
'Framework :: Django :: 1.9', | ||
'Intended Audience :: Developers', | ||
'License :: OSI Approved :: BSD License', | ||
'Natural Language :: English', | ||
'Programming Language :: Python :: 2', | ||
'Programming Language :: Python :: 2.7', | ||
'Programming Language :: Python :: 3', | ||
'Programming Language :: Python :: 3.3', | ||
'Programming Language :: Python :: 3.4', | ||
'Programming Language :: Python :: 3.5', | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.