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

Enable optional tablib dependencies #1647

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Please refer to :doc:`release notes<release_notes>`.
- removed unused variable ``Result.new_record`` (#1640)
- Refactor ``resources.py`` to standardise method args (#1641)
- added specific check for missing ``import_id_fields`` (#1645)
- Enable optional tablib dependencies (#1647)

4.0.0-alpha.5 (2023-09-22)
--------------------------
Expand Down
24 changes: 13 additions & 11 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,26 @@
Installation and configuration
==============================

django-import-export is available on the Python Package Index (PyPI), so it
import_export is available on the Python Package Index (PyPI), so it
can be installed with standard Python tools like ``pip`` or ``easy_install``::

$ pip install django-import-export
pip install django-import-export

This will automatically install many formats supported by tablib. If you need
additional formats like ``cli`` or ``Pandas DataFrame``, you should install the
appropriate tablib dependencies (e.g. ``pip install tablib[pandas]``). Read
more on the `tablib format documentation page`_.
This will automatically install the default formats supported by tablib.
If you need additional formats you should install the extra dependencies as required
appropriate tablib dependencies (e.g. ``pip install django-import-export[xlsx]``).

.. _tablib format documentation page: https://tablib.readthedocs.io/en/stable/formats.html
To install all available formats, use ``pip install django-import-export[all]``.

For all formats, see the
`tablib documentation <https://tablib.readthedocs.io/en/stable/formats.html>`_.

Alternatively, you can install the git repository directly to obtain the
development version::

$ pip install -e git+https://github.com/django-import-export/django-import-export.git#egg=django-import-export
pip install -e git+https://github.com/django-import-export/django-import-export.git#egg=django-import-export

Now, you're good to go, unless you want to use django-import-export from the
Now, you're good to go, unless you want to use import_export from the
admin as well. In this case, you need to add it to your ``INSTALLED_APPS`` and
let Django collect its static files.

Expand All @@ -36,7 +38,7 @@ let Django collect its static files.
$ python manage.py collectstatic

All prerequisites are set up! See :doc:`getting_started` to learn how to use
django-import-export in your project.
import_export in your project.



Expand Down Expand Up @@ -199,7 +201,7 @@ The values must be those provided in ``import_export.formats.base_formats`` e.g
Example app
===========

There's an example application that showcases what django-import-export can do.
There's an example application that showcases what import_export can do.
It's assumed that you have set up a Python ``venv`` with all required dependencies
(from ``test.txt`` requirements file) and are able to run Django locally.

Expand Down
32 changes: 24 additions & 8 deletions docs/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,42 @@ Release Notes
v4
==

v4 of import-export (released Q4 2023) contains a number of minor changes to the API.
v4 introduces breaking changes in order to address some long-standing issues.
In all cases, please test thoroughly before deploying v4 to production.

This guide describes the major changes and how to upgrade.

Installation
============

We have modified installation methods to allow for optional dependencies.
This means that you have to explicitly declare dependencies when installing import_export.

If you are not sure, or want to preserve the pre-v4 behaviour, then ensure that
import_export is installed as follows (either in your requirements file (or during
installation)::

django-import-export[all]

API changes
===========

v4 of import_export (released Q4 2023) contains a number of minor changes to the API.

If you have customized import-export by overriding methods, then you will have to
modify your installation before working with v4. If you have not overridden any
methods then you should not be affected by these changes and no changes to your code
should be necessary.

The API changes include changes to method arguments, although some method names have
changed.

Test thoroughly before deploying v4 to production.

Refer to
`this PR <https://github.com/django-import-export/django-import-export/pull/1641/>`_
for more information.

This guide describes the major changes and how to upgrade.

API changes
===========

The API changes mostly change method arguments, although some method names have changed.

Methods which process row data have been updated so that method args are standardized.
This has been done to resolve inconsistency issues where the parameters differed between
method calls, and to allow easier extensibility.
Expand Down
13 changes: 12 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,20 @@ classifiers = [
dependencies = [
"diff-match-patch",
"Django>=3.2",
"tablib[html,ods,xls,xlsx,yaml]@git+https://github.com/jazzband/tablib.git@master#egg=tablib"
"tablib@git+https://github.com/jazzband/tablib.git@master#egg=tablib"
]

[project.optional-dependencies]
all = [
"tablib[all]@git+https://github.com/jazzband/tablib.git@master#egg=tablib"
]
cli = ["tablib[cli]"]
ods = ["tablib[ods]"]
pandas = ["tablib[pandas]"]
xls = ["tablib[xls]@git+https://github.com/jazzband/tablib.git@master#egg=tablib"]
xlsx = ["tablib[xlsx]@git+https://github.com/jazzband/tablib.git@master#egg=tablib"]
yaml = ["tablib[yaml]@git+https://github.com/jazzband/tablib.git@master#egg=tablib"]

[project.urls]
Documentation = "https://django-import-export.readthedocs.io/en/stable/"
Repository = "https://github.com/django-import-export/django-import-export"
Expand Down
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Django>=3.2
# # tablib temporarily using master before v4
tablib[html,ods,xls,xlsx,yaml]@git+https://github.com/jazzband/tablib.git@master#egg=tablib
tablib@git+https://github.com/jazzband/tablib.git@master#egg=tablib
diff-match-patch
4 changes: 2 additions & 2 deletions requirements/docs.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-r base.txt
sphinx
sphinx-rtd-theme
sphinx==7.2.6
sphinx-rtd-theme==1.3.0
16 changes: 9 additions & 7 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
psycopg2-binary
mysqlclient
chardet
pytz
memory-profiler
django-extensions
coverage
psycopg2-binary==2.9.8
mysqlclient==2.2.0
chardet==5.2.0
pytz==2023.3
memory-profiler==0.61.0
django-extensions==3.2.3
coverage==7.3.1
# tablib temporarily using master before v4
tablib[all]@git+https://github.com/jazzband/tablib.git@master#egg=tablib