From 474bfdf000431328ac2775c584077849c0a2b36f Mon Sep 17 00:00:00 2001 From: DeVonJ Date: Mon, 23 May 2022 17:05:25 +0100 Subject: [PATCH 01/11] if the manifest path is a url open with request.urlopen --- manifest_loader/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/manifest_loader/utils.py b/manifest_loader/utils.py index 1376697..a323a06 100644 --- a/manifest_loader/utils.py +++ b/manifest_loader/utils.py @@ -1,5 +1,6 @@ import json import os +from urllib import request from django.templatetags.static import StaticNode from django.conf import settings @@ -70,7 +71,11 @@ def _get_manifest(): manifest_path = _find_manifest_path() try: - with open(manifest_path) as manifest_file: + if _is_url(manifest_path): + open_manifest = request.urlopen + else: + open_manifest = open + with open_manifest(manifest_path) as manifest_file: data = json.load(manifest_file) except FileNotFoundError: raise WebpackManifestNotFound(manifest_path) From 592a2fa51307e184f3cf25f14c6c46e8edc0e555 Mon Sep 17 00:00:00 2001 From: Roberto Himmelbauer Date: Thu, 9 Jun 2022 10:37:29 -0700 Subject: [PATCH 02/11] added action to push to GCR --- .github/workflows/manifest_loader_ci.yml | 52 ++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/manifest_loader_ci.yml diff --git a/.github/workflows/manifest_loader_ci.yml b/.github/workflows/manifest_loader_ci.yml new file mode 100644 index 0000000..874f9c9 --- /dev/null +++ b/.github/workflows/manifest_loader_ci.yml @@ -0,0 +1,52 @@ +name: Django Manifest Loader CI +on: + pull_request: + branches: + - 'develop' +jobs: + test-and-build: + runs-on: ubuntu-latest + strategy: + max-parallel: 4 + matrix: + python-version: [3.9] + + env: + CI: true + GITHUB_TOKEN: ${{ secrets.GITHUB_REPO_TOKEN }} + GIT_COMMITTER_NAME: ${{ secrets.GITHUB_USER_NAME }} + GIT_COMMITTER_EMAIL: ${{ secrets.GITHUB_USER_EMAIL }} + GOOGLE_APPLICATION_CREDENTIALS: '${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}' + GCR_REPO_NAME: '${{ secrets.GCR_REPO_NAME }}' + GCR_REPO_LOCATION: '${{ secrets.GCR_REPO_LOCATION }}' + GCR_SERVICE_ACCOUNT_EMAIL: '${{ secrets.GCR_SERVICE_ACCOUNT_EMAIL }}' + GC_PROJECT_ID: '${{ secrets.GC_PROJECT_ID }}' + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - id: 'auth' + name: 'Authenticate to Google Cloud' + uses: 'google-github-actions/auth@v0' + with: + credentials_json: '${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}' + - name: Google Cloud Artifact Registry Setup + run: | + gcloud config set artifacts/repository $GCR_REPO_NAME + gcloud config set artifacts/location $GCR_REPO_LOCATION + gcloud config set account $GCR_SERVICE_ACCOUNT_EMAIL + gcloud auth activate-service-account $GCR_SERVICE_ACCOUNT_EMAIL --key-file=$GOOGLE_APPLICATION_CREDENTIALS --project=$GC_PROJECT_ID + gcloud artifacts print-settings python > ~/.pypirc + mkdir -p ~/.config/pip + cp ~/.pypirc ~/.config/pip/pip.conf + - name: Install Python Dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -e .'[test, build]' + python -m pip install -r requirements.txt + - name: Build Package and Upload + run: | + python setup.py sdist bdist_wheel + python -m twine upload --repository $GCR_REPO_NAME dist/* From 8667989793cfdd73da066578d450c9ec33aa3ecb Mon Sep 17 00:00:00 2001 From: Roberto Himmelbauer Date: Thu, 9 Jun 2022 10:39:34 -0700 Subject: [PATCH 03/11] changed to on pull request to main for testing --- .github/workflows/manifest_loader_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/manifest_loader_ci.yml b/.github/workflows/manifest_loader_ci.yml index 874f9c9..6b2f2b7 100644 --- a/.github/workflows/manifest_loader_ci.yml +++ b/.github/workflows/manifest_loader_ci.yml @@ -2,7 +2,7 @@ name: Django Manifest Loader CI on: pull_request: branches: - - 'develop' + - 'main' jobs: test-and-build: runs-on: ubuntu-latest From 04118ffc76f44bf98e3a65c389b8577e759aa2de Mon Sep 17 00:00:00 2001 From: Roberto Himmelbauer Date: Fri, 10 Jun 2022 12:25:52 -0500 Subject: [PATCH 04/11] loaded new enviromnets var to github --- .github/workflows/manifest_loader_ci.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/manifest_loader_ci.yml b/.github/workflows/manifest_loader_ci.yml index 6b2f2b7..4f09fa5 100644 --- a/.github/workflows/manifest_loader_ci.yml +++ b/.github/workflows/manifest_loader_ci.yml @@ -12,10 +12,6 @@ jobs: python-version: [3.9] env: - CI: true - GITHUB_TOKEN: ${{ secrets.GITHUB_REPO_TOKEN }} - GIT_COMMITTER_NAME: ${{ secrets.GITHUB_USER_NAME }} - GIT_COMMITTER_EMAIL: ${{ secrets.GITHUB_USER_EMAIL }} GOOGLE_APPLICATION_CREDENTIALS: '${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}' GCR_REPO_NAME: '${{ secrets.GCR_REPO_NAME }}' GCR_REPO_LOCATION: '${{ secrets.GCR_REPO_LOCATION }}' From bc16041200211bdf969b6b4b6bb70b6c7e37c95a Mon Sep 17 00:00:00 2001 From: Roberto Himmelbauer Date: Fri, 10 Jun 2022 12:28:52 -0500 Subject: [PATCH 05/11] removed requirements.txt from the build setup --- .github/workflows/manifest_loader_ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/manifest_loader_ci.yml b/.github/workflows/manifest_loader_ci.yml index 4f09fa5..15e9ada 100644 --- a/.github/workflows/manifest_loader_ci.yml +++ b/.github/workflows/manifest_loader_ci.yml @@ -40,8 +40,7 @@ jobs: - name: Install Python Dependencies run: | python -m pip install --upgrade pip - python -m pip install -e .'[test, build]' - python -m pip install -r requirements.txt + python -m pip install -e . - name: Build Package and Upload run: | python setup.py sdist bdist_wheel From 0925963031b0ce232d612fdec925c72418fef858 Mon Sep 17 00:00:00 2001 From: Roberto Himmelbauer Date: Fri, 10 Jun 2022 12:51:34 -0500 Subject: [PATCH 06/11] added a proper setup.py file --- .github/workflows/manifest_loader_ci.yml | 2 +- setup.cfg | 32 ----------- setup.py | 73 +++++++++++++++++++++++- 3 files changed, 72 insertions(+), 35 deletions(-) delete mode 100644 setup.cfg diff --git a/.github/workflows/manifest_loader_ci.yml b/.github/workflows/manifest_loader_ci.yml index 15e9ada..e87464a 100644 --- a/.github/workflows/manifest_loader_ci.yml +++ b/.github/workflows/manifest_loader_ci.yml @@ -40,7 +40,7 @@ jobs: - name: Install Python Dependencies run: | python -m pip install --upgrade pip - python -m pip install -e . + python -m pip install -e .'[build]' - name: Build Package and Upload run: | python setup.py sdist bdist_wheel diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 4b38348..0000000 --- a/setup.cfg +++ /dev/null @@ -1,32 +0,0 @@ -[metadata] -name = django-manifest-loader -version = 1.0.0 -description = A Django app to load webpack assets. -long_description = file: README.md -url = https://www.github.com/shonin/django-manifest-loader -author = Shonin -author_email = emc@hey.com -license = BSD-3-Clause -keywords = django, webpack, manifest, loader -long_description_content_type = text/markdown -classifiers = - Environment :: Web Environment - Framework :: Django - Framework :: Django :: 3.1 - Intended Audience :: Developers - License :: OSI Approved :: BSD License - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Topic :: Internet :: WWW/HTTP - Topic :: Internet :: WWW/HTTP :: Dynamic Content - -[options] -include_package_data = true -packages = find: -install_requires = - django \ No newline at end of file diff --git a/setup.py b/setup.py index 6068493..ceae5b0 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,72 @@ -from setuptools import setup +from os import path +from setuptools import setup, find_packages -setup() + +readme_file = path.join(path.dirname(path.abspath(__file__)), 'README.md') + +try: + from m2r import parse_from_file + long_description = parse_from_file(readme_file) # Convert the file to RST for PyPI +except ImportError: + # m2r may not be installed in user environment + with open(readme_file) as f: + long_description = f.read() + + +package_metadata = { + 'name': 'django-manifest-loader', + 'version': "1.0.1", + 'description': 'A Django app to load webpack assets.', + 'long_description': 'A Django app to load webpack assets.', + 'url': 'https://github.com/WhiteMoonDreamsInc/django-manifest-loader/', + 'author': 'Shonin', + 'author_email': 'emc@hey.com', + 'license': 'BSD-3-Clause', + 'classifiers': [ + 'Environment :: Web Environment' + 'Framework :: Django' + 'Framework :: Django :: 3.1' + 'Intended Audience :: Developers' + 'License :: OSI Approved :: BSD License' + 'Operating System :: OS Independent' + 'Programming Language :: Python' + 'Programming Language :: Python :: 3' + 'Programming Language :: Python :: 3 :: Only' + 'Programming Language :: Python :: 3.6' + 'Programming Language :: Python :: 3.7' + 'Programming Language :: Python :: 3.8' + 'Topic :: Internet :: WWW/HTTP' + 'Topic :: Internet :: WWW/HTTP :: Dynamic Content' + ], + 'keywords': ['django', 'webpack', 'manifest', 'loader'], +} + +setup( + packages=find_packages(), + package_data={'manifest_loader': ['templatetags/*']}, + include_package_data=True, + python_requires=">=3.6", + install_requires=[ + 'Django>=3.0,<4.0', + ], + extras_require={ + 'test': [], + 'prod': [], + 'build': [ + 'setuptools', + 'wheel', + 'twine', + 'm2r', + ], + 'docs': [ + 'recommonmark', + 'm2r', + 'django_extensions', + 'coverage', + 'Sphinx', + 'rstcheck', + 'sphinx-rtd-theme' + ], + }, + **package_metadata +) \ No newline at end of file From 3c271bc35af42592a33beb812ea020a949ba6b0f Mon Sep 17 00:00:00 2001 From: Roberto Himmelbauer Date: Fri, 10 Jun 2022 12:55:07 -0500 Subject: [PATCH 07/11] added mistune install --- .github/workflows/manifest_loader_ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/manifest_loader_ci.yml b/.github/workflows/manifest_loader_ci.yml index e87464a..a918115 100644 --- a/.github/workflows/manifest_loader_ci.yml +++ b/.github/workflows/manifest_loader_ci.yml @@ -40,6 +40,8 @@ jobs: - name: Install Python Dependencies run: | python -m pip install --upgrade pip + python -m pip install mistune==0.8.4 + python -m pip install m2r python -m pip install -e .'[build]' - name: Build Package and Upload run: | From 054c5fac7846158e6924252118f1d2924de17276 Mon Sep 17 00:00:00 2001 From: Roberto Himmelbauer Date: Fri, 10 Jun 2022 12:57:51 -0500 Subject: [PATCH 08/11] changed ci to be on push with main --- .github/workflows/manifest_loader_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/manifest_loader_ci.yml b/.github/workflows/manifest_loader_ci.yml index a918115..446616d 100644 --- a/.github/workflows/manifest_loader_ci.yml +++ b/.github/workflows/manifest_loader_ci.yml @@ -1,6 +1,6 @@ name: Django Manifest Loader CI on: - pull_request: + push: branches: - 'main' jobs: From 97428220ae0f560a5b74219ea3dcb24a21695b50 Mon Sep 17 00:00:00 2001 From: Roberto Himmelbauer Date: Fri, 10 Jun 2022 16:20:42 -0500 Subject: [PATCH 09/11] appended tc- to the package name to not get anotherone be accident --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index ceae5b0..0f2365f 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ package_metadata = { - 'name': 'django-manifest-loader', + 'name': 'tc-django-manifest-loader', 'version': "1.0.1", 'description': 'A Django app to load webpack assets.', 'long_description': 'A Django app to load webpack assets.', From d393c08b730308578bf4d1cc22509f1705183ba7 Mon Sep 17 00:00:00 2001 From: Roberto Himmelbauer Date: Fri, 10 Jun 2022 16:20:59 -0500 Subject: [PATCH 10/11] version bump --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 0f2365f..90fd66c 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ package_metadata = { 'name': 'tc-django-manifest-loader', - 'version': "1.0.1", + 'version': "1.0.2", 'description': 'A Django app to load webpack assets.', 'long_description': 'A Django app to load webpack assets.', 'url': 'https://github.com/WhiteMoonDreamsInc/django-manifest-loader/', From 3091fcd1c81c0e6d8ca7099639e35d66ae6df895 Mon Sep 17 00:00:00 2001 From: Roberto Himmelbauer Date: Tue, 14 Jun 2022 12:22:49 -0700 Subject: [PATCH 11/11] version update --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 90fd66c..78a78bf 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ package_metadata = { 'name': 'tc-django-manifest-loader', - 'version': "1.0.2", + 'version': "1.0.3", 'description': 'A Django app to load webpack assets.', 'long_description': 'A Django app to load webpack assets.', 'url': 'https://github.com/WhiteMoonDreamsInc/django-manifest-loader/',