cuducos / django-public-admin

🔓 A public and read-only version of the Django Admin
MIT License
37 stars 5 forks source link

fix django dependency #17

Closed Urahara closed 3 years ago

Urahara commented 3 years ago

Close #16

I run poetry update and then poetry lock, but i'm not sure if ok to update the poetry.lock. Heres the diff: https://gist.github.com/Urahara/1e20b9f00eb740b3faaa75952a7471b1/revisions?diff=split

If that's ok i can commit this.

cuducos commented 3 years ago

3 - After this change i try install both Django 2 and 3 and works!

I'm sorry if I wasn't clear, my bad.

What I meant wasn't whether you have tested it or not but how have you tested. For example: from source, what command, from GitHub or from a “fake” PyPI release, etc.

Urahara commented 3 years ago

3 - After this change i try install both Django 2 and 3 and works!

I'm sorry if I wasn't clear, my bad.

What I meant wasn't whether you have tested it or not but how have you tested. For example: from source, what command, from GitHub or from a “fake” PyPI release, etc.

Hmm...

(gh) django-public-admin|master ⇒ poetry install
Installing dependencies from lock file

Package operations: 46 installs, 1 update, 0 removals

  - Updating importlib-metadata (1.1.3 -> 1.7.0)
  - Installing markupsafe (1.1.1)
  - Installing pytz (2020.1)
  - Installing alabaster (0.7.12)
  - Installing appdirs (1.4.4)
  - Installing babel (2.8.0)
  - Installing click (7.1.2)
  - Installing distlib (0.3.1)
  - Installing docutils (0.16)
  - Installing filelock (3.0.12)
  - Installing imagesize (1.2.0)
  - Installing importlib-resources (3.0.0)
  - Installing jinja2 (2.11.2)
  - Installing mccabe (0.6.1)
  - Installing more-itertools (8.4.0)
  - Installing packaging (20.4)
  - Installing pathspec (0.8.0)
  - Installing pluggy (0.13.1)
  - Installing py (1.9.0)
  - Installing pycodestyle (2.6.0)
  - Installing pyflakes (2.2.0)
  - Installing pygments (2.6.1)
  - Installing regex (2020.7.14)
  - Installing snowballstemmer (2.0.0)
  - Installing sphinxcontrib-applehelp (1.0.2)
  - Installing sphinxcontrib-devhelp (1.0.2)
  - Installing sphinxcontrib-htmlhelp (1.0.3)
  - Installing sphinxcontrib-jsmath (1.0.1)
  - Installing sphinxcontrib-qthelp (1.0.3)
  - Installing sphinxcontrib-serializinghtml (1.1.4)
  - Installing toml (0.10.1)
  - Installing typed-ast (1.4.1)
  - Installing wcwidth (0.2.5)
  - Installing asgiref (3.2.10)
  - Installing black (19.10b0)
  - Installing flake8 (3.8.3)
  - Installing pytest (5.4.3)
  - Installing sphinx (2.4.4)
  - Installing sqlparse (0.3.1)
  - Installing virtualenv (20.0.27)
  - Installing django (3.0.8)
  - Installing pytest-black (0.3.10)
  - Installing pytest-flake8 (1.0.6)
  - Installing pytest-mock (2.0.0)
  - Installing readthedocs-sphinx-ext (1.0.4)
  - Installing sphinx-rtd-theme (0.4.3)
  - Installing tox (3.18.0)
  - Installing django-public-admin (0.0.2)

Then tried to install version 2.x:

(gh) django-public-admin|master ⇒ poetry add django==2.2.14

Updating dependencies
Resolving dependencies... (0.3s)

Writing lock file

Package operations: 0 installs, 1 update, 1 removal

  - Updating django (3.0.8 -> 2.2.14)
  - Removing asgiref (3.2.10)
Urahara commented 3 years ago

Sorry if i'm testing wrong, i never used poetry only pipenv.

cuducos commented 3 years ago

Sorry if i'm testing wrong, i never used poetry

Worry not — I am also new to Poetry. BTW that is why I asked how you tested.

I think it makes sense what you did TBH. Yet, I would like to corroborate that with another testing strategy, to make sure it also works with an external dependency. Having the edited version of Django Public Admin at, let’s say, /home/cuducos/django-public-admin I would

  1. start two new projects with Poetry, one depending on Django 2 and the other, on Django 3
  2. add to both the local version of Django Public Admin with something like poetry add /home/cuducos/django-public-admin (not sure if this works, but there’s a discussion about that for us to find some references)

As soon as I can test this I can squash and merge your commits to the main branch : )

Once more, many many thanks, buddy!

Urahara commented 3 years ago

Sorry if i'm testing wrong, i never used poetry

Worry not — I am also new to Poetry. BTW that is why I asked how you tested.

I think it makes sense what you did TBH. Yet, I would like to corroborate that with another testing strategy, to make sure it also works with an external dependency. Having the edited version of Django Public Admin at, let’s say, /home/cuducos/django-public-admin I would

  1. start two new projects with Poetry, one depending on Django 2 and the other, on Django 3
  2. add to both the local version of Django Public Admin with something like poetry add /home/cuducos/django-public-admin (not sure if this works, but there’s a discussion about that for us to find some references)

As soon as I can test this I can squash and merge your commits to the main branch : )

Once more, many many thanks, buddy!

I tried your approach and didn't work, only way i can think of is creating a package in pypi.

cuducos commented 3 years ago

I tried your approach and didn't work, only way

There are different approaches in the issue I linked. None of them actually works?

There should be a way to test it without PyPI, I'll explore this issue over the weekend, ok?

Urahara commented 3 years ago

I tested with wheel, I created those folders:

Run poetry build on django-public-admin copy whl file to django(2|3) folders, then installed:

# pipenv run pip install django_public_admin-0.0.2-py3-none-any.whl
Processing ./django_public_admin-0.0.2-py3-none-any.whl
Requirement already satisfied: django>=2 in /root/.local/share/virtualenvs/django2--pPR18ve/lib/python3.6/site-packages (from django-public-admin==0.0.2) (2.2.14)
Requirement already satisfied: sqlparse>=0.2.2 in /root/.local/share/virtualenvs/django2--pPR18ve/lib/python3.6/site-packages (from django>=2->django-public-admin==0.0.2) (0.3.1)
Requirement already satisfied: pytz in /root/.local/share/virtualenvs/django2--pPR18ve/lib/python3.6/site-packages (from django>=2->django-public-admin==0.0.2) (2020.1)
Installing collected packages: django-public-admin
Successfully installed django-public-admin-0.0.2
# cd ..
# ls
django-public-admin  django2  django3
# cd django3
# pipenv run pip install django_public_admin-0.0.2-py3-none-any.whl
Processing ./django_public_admin-0.0.2-py3-none-any.whl
Requirement already satisfied: django>=2 in /root/.local/share/virtualenvs/django3-bLZdFYze/lib/python3.6/site-packages (from django-public-admin==0.0.2) (3.0.8)
Requirement already satisfied: sqlparse>=0.2.2 in /root/.local/share/virtualenvs/django3-bLZdFYze/lib/python3.6/site-packages (from django>=2->django-public-admin==0.0.2) (0.3.1)
Requirement already satisfied: asgiref~=3.2 in /root/.local/share/virtualenvs/django3-bLZdFYze/lib/python3.6/site-packages (from django>=2->django-public-admin==0.0.2) (3.2.10)
Requirement already satisfied: pytz in /root/.local/share/virtualenvs/django3-bLZdFYze/lib/python3.6/site-packages (from django>=2->django-public-admin==0.0.2) (2020.1)
Installing collected packages: django-public-admin
Successfully installed django-public-admin-0.0.2

I did the same using the master branch from our repo:

root@108a19493226:/tests/teste/django3# pipenv run pip install django_public_admin-0.0.2-py3-none-any.whl 
Processing ./django_public_admin-0.0.2-py3-none-any.whl
Collecting django<3.0.0,>=2.0.0
  Using cached Django-2.2.14-py3-none-any.whl (7.5 MB)
Requirement already satisfied: pytz in /root/.local/share/virtualenvs/django3-aAlVc99F/lib/python3.6/site-packages (from django<3.0.0,>=2.0.0->django-public-admin==0.0.2) (2020.1)
Requirement already satisfied: sqlparse>=0.2.2 in /root/.local/share/virtualenvs/django3-aAlVc99F/lib/python3.6/site-packages (from django<3.0.0,>=2.0.0->django-public-admin==0.0.2) (0.3.1)
Installing collected packages: django, django-public-admin
  Attempting uninstall: django
    Found existing installation: Django 3.0.8
    Uninstalling Django-3.0.8:
      Successfully uninstalled Django-3.0.8
Successfully installed django-2.2.14 django-public-admin-0.0.2
cuducos commented 3 years ago

I tested not with the wheel, but with the directory — as described in my previous comment. It works : )