diff --git a/archivebox/__init__.py b/archivebox/__init__.py index 066c2ee7..045650ff 100755 --- a/archivebox/__init__.py +++ b/archivebox/__init__.py @@ -85,8 +85,8 @@ ARCHIVEBOX_BUILTIN_PLUGINS = { 'workers': PACKAGE_DIR / 'workers', 'core': PACKAGE_DIR / 'core', 'crawls': PACKAGE_DIR / 'crawls', + # 'machine': PACKAGE_DIR / 'machine' # 'search': PACKAGE_DIR / 'search', - # 'core': PACKAGE_DIR / 'core', } # Load all user-defined ArchiveBox plugins diff --git a/archivebox/abid_utils/__init__.py b/archivebox/abid_utils/__init__.py deleted file mode 100644 index 12c2f475..00000000 --- a/archivebox/abid_utils/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__package__ = 'abid_utils' diff --git a/archivebox/abid_utils/apps.py b/archivebox/abid_utils/apps.py deleted file mode 100644 index 4f2fa465..00000000 --- a/archivebox/abid_utils/apps.py +++ /dev/null @@ -1,7 +0,0 @@ -from django.apps import AppConfig - - -class AbidUtilsConfig(AppConfig): - default_auto_field = 'django.db.models.BigAutoField' - - name = 'abid_utils' diff --git a/archivebox/abid_utils/tests.py b/archivebox/abid_utils/tests.py deleted file mode 100644 index 7ce503c2..00000000 --- a/archivebox/abid_utils/tests.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.test import TestCase - -# Create your tests here. diff --git a/archivebox/api/admin.py b/archivebox/api/admin.py index f478815d..0461a05f 100644 --- a/archivebox/api/admin.py +++ b/archivebox/api/admin.py @@ -3,7 +3,7 @@ __package__ = 'archivebox.api' from signal_webhooks.admin import WebhookAdmin from signal_webhooks.utils import get_webhook_model -from abid_utils.admin import ABIDModelAdmin +from archivebox.base_models.admin import ABIDModelAdmin from api.models import APIToken diff --git a/archivebox/api/migrations/0003_rename_user_apitoken_created_by_apitoken_abid_and_more.py b/archivebox/api/migrations/0003_rename_user_apitoken_created_by_apitoken_abid_and_more.py index 58bcac5a..392bd2d8 100644 --- a/archivebox/api/migrations/0003_rename_user_apitoken_created_by_apitoken_abid_and_more.py +++ b/archivebox/api/migrations/0003_rename_user_apitoken_created_by_apitoken_abid_and_more.py @@ -1,6 +1,5 @@ # Generated by Django 5.0.6 on 2024-06-03 01:52 -import abid_utils.models import charidfield.fields import django.db.models.deletion import signal_webhooks.fields @@ -9,6 +8,8 @@ import uuid from django.conf import settings from django.db import migrations, models +import archivebox.base_models.models + class Migration(migrations.Migration): @@ -63,7 +64,7 @@ class Migration(migrations.Migration): ('id', models.UUIDField(blank=True, null=True, unique=True)), ('uuid', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)), ('abid', charidfield.fields.CharIDField(blank=True, db_index=True, default=None, help_text='ABID-format identifier for this entity (e.g. snp_01BJQMF54D093DXEAWZ6JYRPAQ)', max_length=30, null=True, prefix='whk_', unique=True)), - ('created_by', models.ForeignKey(default=abid_utils.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ('created_by', models.ForeignKey(default=archivebox.base_models.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], options={ 'verbose_name': 'API Outbound Webhook', diff --git a/archivebox/api/migrations/0007_alter_apitoken_created_by.py b/archivebox/api/migrations/0007_alter_apitoken_created_by.py index 6888bd22..97c51195 100644 --- a/archivebox/api/migrations/0007_alter_apitoken_created_by.py +++ b/archivebox/api/migrations/0007_alter_apitoken_created_by.py @@ -1,10 +1,11 @@ # Generated by Django 5.1 on 2024-08-20 22:52 -import abid_utils.models import django.db.models.deletion from django.conf import settings from django.db import migrations, models +import archivebox.base_models.models + class Migration(migrations.Migration): @@ -17,6 +18,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='apitoken', name='created_by', - field=models.ForeignKey(default=abid_utils.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), + field=models.ForeignKey(default=archivebox.base_models.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), ), ] diff --git a/archivebox/api/migrations/0008_alter_apitoken_created_alter_apitoken_created_by_and_more.py b/archivebox/api/migrations/0008_alter_apitoken_created_alter_apitoken_created_by_and_more.py index 4776e096..52ff5057 100644 --- a/archivebox/api/migrations/0008_alter_apitoken_created_alter_apitoken_created_by_and_more.py +++ b/archivebox/api/migrations/0008_alter_apitoken_created_alter_apitoken_created_by_and_more.py @@ -1,10 +1,11 @@ # Generated by Django 5.1 on 2024-09-04 23:32 -import abid_utils.models import django.db.models.deletion from django.conf import settings from django.db import migrations, models +import archivebox.base_models.models + class Migration(migrations.Migration): @@ -17,7 +18,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='apitoken', name='created', - field=abid_utils.models.AutoDateTimeField(db_index=True, default=None), + field=archivebox.base_models.models.AutoDateTimeField(db_index=True, default=None), ), migrations.AlterField( model_name='apitoken', @@ -32,7 +33,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='outboundwebhook', name='created', - field=abid_utils.models.AutoDateTimeField(db_index=True, default=None), + field=archivebox.base_models.models.AutoDateTimeField(db_index=True, default=None), ), migrations.AlterField( model_name='outboundwebhook', diff --git a/archivebox/api/migrations/0009_rename_created_apitoken_created_at_and_more.py b/archivebox/api/migrations/0009_rename_created_apitoken_created_at_and_more.py index 05c30c08..c07ff808 100644 --- a/archivebox/api/migrations/0009_rename_created_apitoken_created_at_and_more.py +++ b/archivebox/api/migrations/0009_rename_created_apitoken_created_at_and_more.py @@ -1,8 +1,9 @@ # Generated by Django 5.1 on 2024-09-05 00:26 -import abid_utils.models from django.db import migrations, models +import archivebox.base_models.models + class Migration(migrations.Migration): @@ -29,7 +30,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='outboundwebhook', name='created_at', - field=abid_utils.models.AutoDateTimeField(db_index=True, default=None), + field=archivebox.base_models.models.AutoDateTimeField(db_index=True, default=None), ), migrations.AlterField( model_name='outboundwebhook', diff --git a/archivebox/api/models.py b/archivebox/api/models.py index 419c03bd..0486c147 100644 --- a/archivebox/api/models.py +++ b/archivebox/api/models.py @@ -11,7 +11,7 @@ from signal_webhooks.models import WebhookBase from django_stubs_ext.db.models import TypedModelMeta -from abid_utils.models import ABIDModel, ABIDField, AutoDateTimeField +from archivebox.base_models.models import ABIDModel, ABIDField, AutoDateTimeField diff --git a/archivebox/base_models/__init__.py b/archivebox/base_models/__init__.py new file mode 100644 index 00000000..8469c859 --- /dev/null +++ b/archivebox/base_models/__init__.py @@ -0,0 +1 @@ +__package__ = 'archivebox.base_models' diff --git a/archivebox/abid_utils/abid.py b/archivebox/base_models/abid.py similarity index 99% rename from archivebox/abid_utils/abid.py rename to archivebox/base_models/abid.py index f10dd93c..3c98938f 100644 --- a/archivebox/abid_utils/abid.py +++ b/archivebox/base_models/abid.py @@ -1,4 +1,4 @@ -__package__ = 'archivebox.abid_utils' +__package__ = 'archivebox.base_models' from typing import NamedTuple, Any, Union, Dict diff --git a/archivebox/abid_utils/admin.py b/archivebox/base_models/admin.py similarity index 99% rename from archivebox/abid_utils/admin.py rename to archivebox/base_models/admin.py index 60df1099..9f098566 100644 --- a/archivebox/abid_utils/admin.py +++ b/archivebox/base_models/admin.py @@ -1,4 +1,4 @@ -__package__ = 'archivebox.abid_utils' +__package__ = 'archivebox.base_models' from typing import Any diff --git a/archivebox/base_models/apps.py b/archivebox/base_models/apps.py new file mode 100644 index 00000000..25e12f9b --- /dev/null +++ b/archivebox/base_models/apps.py @@ -0,0 +1,7 @@ +# from django.apps import AppConfig + + +# class AbidUtilsConfig(AppConfig): +# default_auto_field = 'django.db.models.BigAutoField' + +# name = 'base_models' diff --git a/archivebox/abid_utils/migrations/__init__.py b/archivebox/base_models/migrations/__init__.py similarity index 100% rename from archivebox/abid_utils/migrations/__init__.py rename to archivebox/base_models/migrations/__init__.py diff --git a/archivebox/abid_utils/models.py b/archivebox/base_models/models.py similarity index 100% rename from archivebox/abid_utils/models.py rename to archivebox/base_models/models.py diff --git a/archivebox/cli/archivebox_add.py b/archivebox/cli/archivebox_add.py index c90ed323..095539d3 100644 --- a/archivebox/cli/archivebox_add.py +++ b/archivebox/cli/archivebox_add.py @@ -53,7 +53,7 @@ def add(urls: str | list[str], from crawls.models import Seed, Crawl from workers.orchestrator import Orchestrator - from abid_utils.models import get_or_create_system_user_pk + from archivebox.base_models.models import get_or_create_system_user_pk diff --git a/archivebox/core/admin_archiveresults.py b/archivebox/core/admin_archiveresults.py index da90df1d..599626eb 100644 --- a/archivebox/core/admin_archiveresults.py +++ b/archivebox/core/admin_archiveresults.py @@ -17,8 +17,8 @@ import abx from archivebox.config import DATA_DIR from archivebox.config.common import SERVER_CONFIG from archivebox.misc.paginators import AccelleratedPaginator +from archivebox.base_models.admin import ABIDModelAdmin -from abid_utils.admin import ABIDModelAdmin from core.models import ArchiveResult, Snapshot diff --git a/archivebox/core/admin_snapshots.py b/archivebox/core/admin_snapshots.py index 08a9b9b7..4b9b66b3 100644 --- a/archivebox/core/admin_snapshots.py +++ b/archivebox/core/admin_snapshots.py @@ -23,7 +23,7 @@ from archivebox.index.html import snapshot_icons from archivebox.extractors import archive_links from archivebox.main import remove -from archivebox.abid_utils.admin import ABIDModelAdmin +from archivebox.base_models.admin import ABIDModelAdmin from archivebox.workers.tasks import bg_archive_links, bg_add from core.models import Tag diff --git a/archivebox/core/admin_tags.py b/archivebox/core/admin_tags.py index 495c801f..d6cd5306 100644 --- a/archivebox/core/admin_tags.py +++ b/archivebox/core/admin_tags.py @@ -5,8 +5,8 @@ from django.utils.html import format_html, mark_safe import abx -from abid_utils.admin import ABIDModelAdmin from archivebox.misc.paginators import AccelleratedPaginator +from archivebox.base_models.admin import ABIDModelAdmin from core.models import Tag diff --git a/archivebox/core/migrations/0024_auto_20240513_1143.py b/archivebox/core/migrations/0024_auto_20240513_1143.py index f8cf645c..95095334 100644 --- a/archivebox/core/migrations/0024_auto_20240513_1143.py +++ b/archivebox/core/migrations/0024_auto_20240513_1143.py @@ -2,7 +2,8 @@ from django.db import migrations from datetime import datetime -from abid_utils.abid import abid_from_values, DEFAULT_ABID_URI_SALT + +from archivebox.base_models.abid import abid_from_values, DEFAULT_ABID_URI_SALT def calculate_abid(self): diff --git a/archivebox/core/migrations/0026_archiveresult_created_archiveresult_created_by_and_more.py b/archivebox/core/migrations/0026_archiveresult_created_archiveresult_created_by_and_more.py index 83eeff1e..a2a1d717 100644 --- a/archivebox/core/migrations/0026_archiveresult_created_archiveresult_created_by_and_more.py +++ b/archivebox/core/migrations/0026_archiveresult_created_archiveresult_created_by_and_more.py @@ -1,11 +1,12 @@ # Generated by Django 5.0.6 on 2024-05-13 13:01 -import abid_utils.models import django.db.models.deletion import django.utils.timezone from django.conf import settings from django.db import migrations, models +import archivebox.base_models.models + def updated_created_by_ids(apps, schema_editor): """Get or create a system user with is_superuser=True to be the default owner for new DB rows""" @@ -45,7 +46,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='archiveresult', name='created_by', - field=models.ForeignKey(null=True, default=abid_utils.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), + field=models.ForeignKey(null=True, default=archivebox.base_models.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), ), migrations.AddField( model_name='archiveresult', @@ -61,7 +62,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='snapshot', name='created_by', - field=models.ForeignKey(null=True, default=abid_utils.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), + field=models.ForeignKey(null=True, default=archivebox.base_models.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), ), migrations.AddField( model_name='snapshot', @@ -77,7 +78,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='tag', name='created_by', - field=models.ForeignKey(null=True, default=abid_utils.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), + field=models.ForeignKey(null=True, default=archivebox.base_models.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), ), migrations.AddField( model_name='tag', @@ -101,16 +102,16 @@ class Migration(migrations.Migration): migrations.AddField( model_name='snapshot', name='created_by', - field=models.ForeignKey(default=abid_utils.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), + field=models.ForeignKey(default=archivebox.base_models.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), ), migrations.AlterField( model_name='archiveresult', name='created_by', - field=models.ForeignKey(default=abid_utils.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), + field=models.ForeignKey(default=archivebox.base_models.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), ), migrations.AddField( model_name='tag', name='created_by', - field=models.ForeignKey(default=abid_utils.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), + field=models.ForeignKey(default=archivebox.base_models.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), ), ] diff --git a/archivebox/core/migrations/0027_update_snapshot_ids.py b/archivebox/core/migrations/0027_update_snapshot_ids.py index 23a0ba5c..5ca82d61 100644 --- a/archivebox/core/migrations/0027_update_snapshot_ids.py +++ b/archivebox/core/migrations/0027_update_snapshot_ids.py @@ -3,7 +3,7 @@ from django.db import migrations from datetime import datetime -from abid_utils.abid import ABID, abid_from_values, DEFAULT_ABID_URI_SALT +from archivebox.base_models.abid import ABID, abid_from_values, DEFAULT_ABID_URI_SALT def calculate_abid(self): diff --git a/archivebox/core/migrations/0034_alter_archiveresult_old_id_alter_archiveresult_uuid.py b/archivebox/core/migrations/0034_alter_archiveresult_old_id_alter_archiveresult_uuid.py index 5109a69b..17bba178 100644 --- a/archivebox/core/migrations/0034_alter_archiveresult_old_id_alter_archiveresult_uuid.py +++ b/archivebox/core/migrations/0034_alter_archiveresult_old_id_alter_archiveresult_uuid.py @@ -1,11 +1,10 @@ # Generated by Django 5.0.6 on 2024-08-18 05:37 -import core.models import uuid import random from django.db import migrations, models -from abid_utils.abid import ABID +from archivebox.base_models.abid import ABID def rand_int_id(): diff --git a/archivebox/core/migrations/0059_tag_id.py b/archivebox/core/migrations/0059_tag_id.py index 07eed9c5..956c2bf8 100644 --- a/archivebox/core/migrations/0059_tag_id.py +++ b/archivebox/core/migrations/0059_tag_id.py @@ -2,8 +2,8 @@ from datetime import datetime from django.db import migrations, models -from abid_utils.abid import abid_from_values -from abid_utils.models import ABID +from archivebox.base_models.abid import abid_from_values +from archivebox.base_models.models import ABID def calculate_abid(self): """ diff --git a/archivebox/core/migrations/0069_alter_archiveresult_created_alter_snapshot_added_and_more.py b/archivebox/core/migrations/0069_alter_archiveresult_created_alter_snapshot_added_and_more.py index fcc9b0aa..a5c4aa25 100644 --- a/archivebox/core/migrations/0069_alter_archiveresult_created_alter_snapshot_added_and_more.py +++ b/archivebox/core/migrations/0069_alter_archiveresult_created_alter_snapshot_added_and_more.py @@ -1,9 +1,10 @@ # Generated by Django 5.1 on 2024-08-28 09:40 -import abid_utils.models import django.utils.timezone from django.db import migrations +import archivebox.base_models.models + class Migration(migrations.Migration): @@ -15,21 +16,21 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='archiveresult', name='created', - field=abid_utils.models.AutoDateTimeField(db_index=True, default=django.utils.timezone.now), + field=archivebox.base_models.models.AutoDateTimeField(db_index=True, default=django.utils.timezone.now), ), migrations.AlterField( model_name='snapshot', name='added', - field=abid_utils.models.AutoDateTimeField(db_index=True, default=django.utils.timezone.now), + field=archivebox.base_models.models.AutoDateTimeField(db_index=True, default=django.utils.timezone.now), ), migrations.AlterField( model_name='snapshot', name='created', - field=abid_utils.models.AutoDateTimeField(db_index=True, default=django.utils.timezone.now), + field=archivebox.base_models.models.AutoDateTimeField(db_index=True, default=django.utils.timezone.now), ), migrations.AlterField( model_name='tag', name='created', - field=abid_utils.models.AutoDateTimeField(db_index=True, default=django.utils.timezone.now), + field=archivebox.base_models.models.AutoDateTimeField(db_index=True, default=django.utils.timezone.now), ), ] diff --git a/archivebox/core/migrations/0070_alter_archiveresult_created_by_alter_snapshot_added_and_more.py b/archivebox/core/migrations/0070_alter_archiveresult_created_by_alter_snapshot_added_and_more.py index 40dfe6c2..da7cb1b6 100644 --- a/archivebox/core/migrations/0070_alter_archiveresult_created_by_alter_snapshot_added_and_more.py +++ b/archivebox/core/migrations/0070_alter_archiveresult_created_by_alter_snapshot_added_and_more.py @@ -1,10 +1,11 @@ # Generated by Django 5.1 on 2024-09-04 09:00 -import abid_utils.models import django.db.models.deletion from django.conf import settings from django.db import migrations, models +import archivebox.base_models.models + class Migration(migrations.Migration): @@ -17,22 +18,22 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='archiveresult', name='created_by', - field=models.ForeignKey(default=abid_utils.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, related_name='archiveresult_set', to=settings.AUTH_USER_MODEL), + field=models.ForeignKey(default=archivebox.base_models.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, related_name='archiveresult_set', to=settings.AUTH_USER_MODEL), ), migrations.AlterField( model_name='snapshot', name='added', - field=abid_utils.models.AutoDateTimeField(db_index=True, default=None), + field=archivebox.base_models.models.AutoDateTimeField(db_index=True, default=None), ), migrations.AlterField( model_name='snapshot', name='created', - field=abid_utils.models.AutoDateTimeField(db_index=True, default=None), + field=archivebox.base_models.models.AutoDateTimeField(db_index=True, default=None), ), migrations.AlterField( model_name='snapshot', name='created_by', - field=models.ForeignKey(default=abid_utils.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, related_name='snapshot_set', to=settings.AUTH_USER_MODEL), + field=models.ForeignKey(default=archivebox.base_models.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, related_name='snapshot_set', to=settings.AUTH_USER_MODEL), ), migrations.AlterField( model_name='snapshot', @@ -47,6 +48,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='tag', name='created', - field=abid_utils.models.AutoDateTimeField(db_index=True, default=None), + field=archivebox.base_models.models.AutoDateTimeField(db_index=True, default=None), ), ] diff --git a/archivebox/core/migrations/0071_remove_archiveresult_old_id_remove_snapshot_old_id_and_more.py b/archivebox/core/migrations/0071_remove_archiveresult_old_id_remove_snapshot_old_id_and_more.py index e19666ad..6960ed19 100644 --- a/archivebox/core/migrations/0071_remove_archiveresult_old_id_remove_snapshot_old_id_and_more.py +++ b/archivebox/core/migrations/0071_remove_archiveresult_old_id_remove_snapshot_old_id_and_more.py @@ -1,10 +1,11 @@ # Generated by Django 5.1 on 2024-09-04 23:23 -import abid_utils.models import django.db.models.deletion from django.conf import settings from django.db import migrations, models +import archivebox.base_models.models + class Migration(migrations.Migration): @@ -30,7 +31,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='archiveresult', name='created', - field=abid_utils.models.AutoDateTimeField(db_index=True, default=None), + field=archivebox.base_models.models.AutoDateTimeField(db_index=True, default=None), ), migrations.AlterField( model_name='archiveresult', diff --git a/archivebox/core/models.py b/archivebox/core/models.py index 6a4f6d17..5d9c5974 100644 --- a/archivebox/core/models.py +++ b/archivebox/core/models.py @@ -24,31 +24,17 @@ from django.conf import settings import abx from archivebox.config import CONSTANTS - -from abid_utils.models import ABIDModel, ABIDField, AutoDateTimeField, ModelWithOutputDir -from workers.models import ModelWithStateMachine -from workers.tasks import bg_archive_snapshot -from crawls.models import Crawl -# from machine.models import Machine, NetworkInterface - from archivebox.misc.system import get_dir_size from archivebox.misc.util import parse_date, base_url from archivebox.index.schema import Link from archivebox.index.html import snapshot_icons from archivebox.extractors import ARCHIVE_METHODS_INDEXING_PRECEDENCE +from archivebox.base_models.models import ABIDModel, ABIDField, AutoDateTimeField, ModelWithOutputDir - -# class BaseModel(models.Model): -# # TODO: migrate all models to a shared base class with all our standard fields and helpers: -# # ulid/created_at/modified_at/created_by/is_deleted/as_json/from_json/etc. -# # -# # id = models.AutoField(primary_key=True, serialize=False, verbose_name='ID') -# # ulid = models.CharField(max_length=26, null=True, blank=True, db_index=True, unique=True) - -# class Meta(TypedModelMeta): -# abstract = True - - +from workers.models import ModelWithStateMachine +from workers.tasks import bg_archive_snapshot +from crawls.models import Crawl +# from machine.models import Machine, NetworkInterface diff --git a/archivebox/core/settings.py b/archivebox/core/settings.py index 22b0d9a4..9e2ce6c5 100644 --- a/archivebox/core/settings.py +++ b/archivebox/core/settings.py @@ -61,7 +61,6 @@ INSTALLED_APPS = [ 'django_object_actions', # provides easy Django Admin action buttons on change views https://github.com/crccheck/django-object-actions # Our ArchiveBox-provided apps - # 'abid_utils', # handles ABID ID creation, handling, and models 'config', # ArchiveBox config settings (loaded as a plugin, don't need to add it here) 'machine', # handles collecting and storing information about the host machine, network interfaces, installed binaries, etc. 'workers', # handles starting and managing background workers and processes (orchestrators and actors) diff --git a/archivebox/crawls/admin.py b/archivebox/crawls/admin.py index 34221fa6..5e785f6a 100644 --- a/archivebox/crawls/admin.py +++ b/archivebox/crawls/admin.py @@ -5,7 +5,7 @@ from django.contrib import admin from archivebox import DATA_DIR -from abid_utils.admin import ABIDModelAdmin +from archivebox.base_models.admin import ABIDModelAdmin from core.models import Snapshot from crawls.models import Seed, Crawl, CrawlSchedule diff --git a/archivebox/crawls/models.py b/archivebox/crawls/models.py index d37908af..802b0be0 100644 --- a/archivebox/crawls/models.py +++ b/archivebox/crawls/models.py @@ -11,10 +11,10 @@ from django.conf import settings from django.urls import reverse_lazy from django.utils import timezone -from workers.models import ModelWithStateMachine - from archivebox.config import CONSTANTS -from abid_utils.models import ABIDModel, ABIDField, AutoDateTimeField, ModelWithHealthStats, get_or_create_system_user_pk +from archivebox.base_models.models import ABIDModel, ABIDField, AutoDateTimeField, ModelWithHealthStats, get_or_create_system_user_pk + +from workers.models import ModelWithStateMachine if TYPE_CHECKING: from core.models import Snapshot, ArchiveResult diff --git a/archivebox/index/sql.py b/archivebox/index/sql.py index 18b811e7..19701a95 100644 --- a/archivebox/index/sql.py +++ b/archivebox/index/sql.py @@ -35,7 +35,7 @@ def remove_from_sql_main_index(snapshots: QuerySet, atomic: bool=False, out_dir: @enforce_types def write_link_to_sql_index(link: Link, created_by_id: int | None=None): from core.models import Snapshot, ArchiveResult - from abid_utils.models import get_or_create_system_user_pk + from archivebox.base_models.models import get_or_create_system_user_pk info = {k: v for k, v in link._asdict().items() if k in Snapshot.keys} diff --git a/archivebox/machine/admin.py b/archivebox/machine/admin.py index e3039a78..c75ed6cb 100644 --- a/archivebox/machine/admin.py +++ b/archivebox/machine/admin.py @@ -5,7 +5,7 @@ import abx from django.contrib import admin from django.utils.html import format_html -from abid_utils.admin import ABIDModelAdmin +from archivebox.base_models.admin import ABIDModelAdmin from machine.models import Machine, NetworkInterface, InstalledBinary diff --git a/archivebox/machine/migrations/0001_initial.py b/archivebox/machine/migrations/0001_initial.py index 815ed70e..92bfd6a3 100644 --- a/archivebox/machine/migrations/0001_initial.py +++ b/archivebox/machine/migrations/0001_initial.py @@ -1,6 +1,6 @@ # Generated by Django 5.1.1 on 2024-10-02 04:34 -import archivebox.abid_utils.models +import archivebox.base_models.models import charidfield.fields import django.db.models.deletion from django.db import migrations, models @@ -42,7 +42,7 @@ class Migration(migrations.Migration): ), ( "created_at", - archivebox.abid_utils.models.AutoDateTimeField( + archivebox.base_models.models.AutoDateTimeField( db_index=True, default=None ), ), @@ -99,7 +99,7 @@ class Migration(migrations.Migration): ), ( "created_at", - archivebox.abid_utils.models.AutoDateTimeField( + archivebox.base_models.models.AutoDateTimeField( db_index=True, default=None ), ), diff --git a/archivebox/machine/migrations/0002_alter_machine_stats_installedbinary.py b/archivebox/machine/migrations/0002_alter_machine_stats_installedbinary.py index 8ecd5b73..7112ef63 100644 --- a/archivebox/machine/migrations/0002_alter_machine_stats_installedbinary.py +++ b/archivebox/machine/migrations/0002_alter_machine_stats_installedbinary.py @@ -1,6 +1,6 @@ # Generated by Django 5.1.1 on 2024-10-03 07:25 -import archivebox.abid_utils.models +import archivebox.base_models.models import charidfield.fields import django.db.models.deletion from django.db import migrations, models @@ -47,7 +47,7 @@ class Migration(migrations.Migration): ), ( "created_at", - archivebox.abid_utils.models.AutoDateTimeField( + archivebox.base_models.models.AutoDateTimeField( db_index=True, default=None ), ), diff --git a/archivebox/machine/models.py b/archivebox/machine/models.py index 44e9e078..09d6e840 100644 --- a/archivebox/machine/models.py +++ b/archivebox/machine/models.py @@ -12,7 +12,7 @@ import abx import archivebox from abx_pkg import Binary, BinProvider -from archivebox.abid_utils.models import ABIDModel, ABIDField, AutoDateTimeField, ModelWithHealthStats +from archivebox.base_models.models import ABIDModel, ABIDField, AutoDateTimeField, ModelWithHealthStats from .detect import get_host_guid, get_os_info, get_vm_info, get_host_network, get_host_stats diff --git a/archivebox/personas/models.py b/archivebox/personas/models.py index 0b5c693b..c83f4a48 100644 --- a/archivebox/personas/models.py +++ b/archivebox/personas/models.py @@ -1,8 +1,8 @@ -from django.db import models +# from django.db import models -from abid_utils.models import ABIDModel, ABIDField, AutoDateTimeField, ModelWithHealthStats +# from archivebox.base_models.models import ABIDModel, ABIDField, AutoDateTimeField, ModelWithHealthStats -from django.conf import settings +# from django.conf import settings # class Persona(ABIDModel, ModelWithHealthStats):