Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix displaying the installed version of Django-Jazzmin in the UI. #555

Merged

Conversation

PacificGilly
Copy link
Collaborator

@PacificGilly PacificGilly commented Mar 29, 2024

Since we changed our CD process, and it now will automatically generate test
builds (#550), the version in the __init__ file now needs to be
updated to stop it from being hard coded. As in development, the version
is now set to 0.0.0 in the pyproject.toml file; we need to get the
version dynamically. We can call the package manager to check which
version of django-jazzmin was installed. This, sadly, does vary
depending on which version of Python is installed - support for these
older versions is soon to be dropped.

In Developent

Screenshot 2024-03-29 at 19 01 33

When Installed

In [1]: from importlib.metadata import version
   ...:
   ...: version = version("django-jazzmin")

In [2]: version
Out[2]: '2.6.2a0'

Also a few minor fixes to black and poetry in pyproject.toml I came across.

@farridav
Copy link
Owner

3.7 is not enjoying these approaches to getting installed package versions..

@PacificGilly
Copy link
Collaborator Author

3.7 is not enjoying these approaches to getting installed package versions..

Yeah sadly, I'll do some more digging to see what I can do, or might have to wait for #545 or #551 to drop support for 3.6/3.7

@PacificGilly
Copy link
Collaborator Author

I've added django-jazzmin to the tox deps list as all versions of Python where failing tox when testing locally.

Since we changed our CD process and now will automatically generate test
builds (farridav#550), the version in the `__init__` file now needs to be
updated to stop it from being hardcoded. As in development the version
is now set to 0.0.0 in the `pyproject.toml` file, we need to get the
version dyanmically. We can call the package manager to check which
version of `django-jazzmin` was installed. This sadly does vary
depending on which version of Python is installed - support for these
older versions are soon to be dropped.
```
ImportError: cannot import name '_unicodefun' from 'click'
```

https://stackoverflow.com/a/71674345
In 1.3 of poetry they implemented dependency groups and so the original
"dev" dependency changed from `tool.poetry.dev-dependencies` to
`tool.poetry.group.dev.dependencies`.
Add a test to ensure that for every version of Python we support we're
able to get the version. Not checking what that version is as that
almost defeats the point of the test.
To be able to automatically get the version of the installed package of
`django-jazzmin` we need to explicitly install the package as well.
@PacificGilly PacificGilly force-pushed the jamesgilmore/fix-version-identifier branch from 7690594 to ed8d3ba Compare March 30, 2024 13:26
@PacificGilly
Copy link
Collaborator Author

Merging as all tests pass, with only coveralls-django4-python3.10 failing due to the known issue with the COVERALLS_REPO_TOKEN env-var.

@PacificGilly PacificGilly merged commit 7e353f5 into farridav:master Mar 30, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants