Skip to content

Commit

Permalink
Remove makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
yalef committed Dec 7, 2023
1 parent 7205465 commit b0ef3f6
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 141 deletions.
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ UNRELEASED
* Extend import results template: show validation errors in table
* Add force-import feature: skip rows with errors while importing
* Add ``skip_parse_step`` parameter for importing API
* Remove Makefile in favor of ``invoke`` commands

0.4.1 (2023-09-25)
------------------
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ include LICENSE
include README.rst

recursive-include import_export_extensions/ *
recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif
recursive-include docs *.rst conf.py *.jpg *.png *.gif

recursive-exclude * __pycache__
recursive-exclude * *.py[co]
70 changes: 0 additions & 70 deletions Makefile

This file was deleted.

22 changes: 0 additions & 22 deletions docs/Makefile

This file was deleted.

14 changes: 6 additions & 8 deletions docs/extensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,8 @@ Force import
This package provides *force import* feature. When force import is enabled,
then rows with errors will be skipped and rest of the rows will be handled.

__________
Admin page
__________
^^^^^^^^^^

This functionality available in admin:

Expand All @@ -197,9 +196,8 @@ In case if some rows contain any errors it will be reported on parse/import stag

.. figure:: _static/images/force_import_results.png

___
API
___
^^^

In api there're 2 fields: ``force_import`` and ``skip_parse_step``.

Expand All @@ -217,7 +215,7 @@ Widgets
This package also provides additional widgets for some types of data.

FileWidget
__________
^^^^^^^^^^

Working with file fields is a common issue. ``FileWidget`` allows to import/export files
including links to external resources that store files and save them in ``DEFAULT_FILE_STORAGE``.
Expand All @@ -227,7 +225,7 @@ also supports ``AWS_STORAGE_BUCKET_NAME`` setting.


IntermediateManyToManyWidget
____________________________
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

``IntermediateManyToManyWidget`` allows to import/export objects with related items.
Default M2M widget store just IDs of related objects. With intermediate widget
Expand All @@ -238,15 +236,15 @@ Fields
------

M2MField
________
^^^^^^^^

This is resource field for M2M fields. Provides faster import of related fields.

This implementation deletes intermediate models, which were excluded
and creates intermediate models only for newly added models.

IntermediateManyToManyField
___________________________
^^^^^^^^^^^^^^^^^^^^^^^^^^^

This is resource field for M2M with custom ``through`` model.

Expand Down
36 changes: 0 additions & 36 deletions docs/make.bat

This file was deleted.

2 changes: 1 addition & 1 deletion provision/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from . import ci, project
from . import ci, docs, project
14 changes: 14 additions & 0 deletions provision/docs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import pathlib

import invoke
import saritasa_invocations

LOCAL_DOCS_DIR = pathlib.Path("docs/_build")


@invoke.task
def build(context: invoke.Context):
"""Build documentation."""
saritasa_invocations.print_success("Start building of local documentation")
context.run(f"sphinx-build -E -a docs {LOCAL_DOCS_DIR}")
saritasa_invocations.print_success("Building completed")
36 changes: 33 additions & 3 deletions provision/project.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,46 @@
import pathlib
import shutil

import invoke
import saritasa_invocations
from invoke import task


@task
def init(context, clean=False):
@invoke.task
def init(context: invoke.Context, clean: bool = False):
"""Prepare env for working with project."""
saritasa_invocations.print_success("Setting up git config")
saritasa_invocations.git.setup(context)
saritasa_invocations.print_success("Initial assembly of all dependencies")
saritasa_invocations.poetry.install(context)
if clean:
saritasa_invocations.docker.clear(context)
clear(context)
saritasa_invocations.django.migrate(context)
saritasa_invocations.pytest.run(context)
saritasa_invocations.django.createsuperuser(context)


@invoke.task
def clear(context: invoke.Context):
"""Clear package directory from cache files."""
saritasa_invocations.print_success("Start clearing")
build_dirs = ("build", "dist", ".eggs")
coverage_dirs = ("htmlcov",)
cache_dirs = (".mypy_cache", ".pytest_cache")

saritasa_invocations.print_success("Remove cache directories")
for directory in build_dirs + coverage_dirs + cache_dirs:
shutil.rmtree(directory, ignore_errors=True)

cwd = pathlib.Path(".")
# remove egg paths
saritasa_invocations.print_success("Remove egg directories")
for path in cwd.glob("*.egg-info"):
shutil.rmtree(path, ignore_errors=True)

for path in cwd.glob("*.egg"):
path.unlink(missing_ok=True)

# remove last coverage file
saritasa_invocations.print_success("Remove coverage file")
pathlib.Path(".coverage").unlink(missing_ok=True)
1 change: 1 addition & 0 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

ns = Collection(
provision.project,
provision.docs,
provision.ci,
saritasa_invocations.celery,
saritasa_invocations.django,
Expand Down

0 comments on commit b0ef3f6

Please sign in to comment.