diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b484b832..0afe8f5f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,7 @@ name: CI on: [push, pull_request] jobs: - build_backend: + backend: if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository runs-on: ubuntu-20.04 steps: @@ -13,8 +13,7 @@ jobs: cache-dependency-path: "**/requirements*.txt" - run: pip install -r requirements.txt # Check requirements.txt contains production requirements. - - working-directory: backend - run: ./manage.py --help + - run: ./manage.py --help - run: pip install -r requirements_dev.txt - name: Run Pelican backend migrations run: | @@ -28,7 +27,6 @@ jobs: DATABASE_URL: postgresql://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres PELICAN_BACKEND_DATABASE_URL: postgresql://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres shell: bash - working-directory: backend run: | ./manage.py migrate ./manage.py makemigrations --check --dry-run @@ -48,7 +46,7 @@ jobs: ports: - 5432/tcp - build_frontend: + frontend: if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository runs-on: ubuntu-20.04 defaults: diff --git a/.github/workflows/i18n.yml b/.github/workflows/i18n.yml index 251de2ba..f674cc86 100644 --- a/.github/workflows/i18n.yml +++ b/.github/workflows/i18n.yml @@ -18,8 +18,7 @@ jobs: sudo apt update sudo apt install gettext translate-toolkit - run: pip install -r requirements.txt - - working-directory: backend - run: python manage.py makemessages -a + - run: python manage.py makemessages -a - name: Count incomplete translations shell: bash run: | diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1f5ae81b..23482b7e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -32,5 +32,4 @@ jobs: - shell: bash run: curl -s -S --retry 3 $BASEDIR/tests/script.sh | bash - - run: pip install -r requirements_dev.txt - - working-directory: backend - run: pytest /tmp/test_requirements.py + - run: pytest /tmp/test_requirements.py diff --git a/.gitignore b/.gitignore index 06daa984..fc75a57e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,8 +3,8 @@ node_modules *.mo dist .coverage -htmlcov -credentials.json -google_drive_cache -/backend/static +/htmlcov +/credentials.json +/google_drive_cache +/static /docs/_build diff --git a/Dockerfile_django b/Dockerfile_django index 401ee1d6..ab205ec7 100644 --- a/Dockerfile_django +++ b/Dockerfile_django @@ -17,7 +17,7 @@ RUN pip install --no-cache-dir -r /tmp/requirements.txt WORKDIR /workdir USER runner:runner -COPY --chown=runner:runner backend . +COPY --chown=runner:runner . . ENV DJANGO_ENV=production ENV WEB_CONCURRENCY=2 diff --git a/Dockerfile_static b/Dockerfile_static index d646bebd..e5d5550d 100644 --- a/Dockerfile_static +++ b/Dockerfile_static @@ -15,12 +15,12 @@ ENV DJANGO_ENV=production WORKDIR /workdir/frontend RUN npx vue-cli-service build -WORKDIR /workdir/backend +WORKDIR /workdir RUN python manage.py collectstatic --noinput -v2 FROM nginxinc/nginx-unprivileged:latest as production-stage USER root COPY --from=build-stage --chown=nginx:root /workdir/frontend/dist /usr/share/nginx/html -COPY --from=build-stage --chown=nginx:root /workdir/backend/static /usr/share/nginx/html/static +COPY --from=build-stage --chown=nginx:root /workdir/static /usr/share/nginx/html/static COPY --chown=nginx:root frontend/default.conf /etc/nginx/conf.d/default.conf USER nginx diff --git a/backend/api/__init__.py b/api/__init__.py similarity index 100% rename from backend/api/__init__.py rename to api/__init__.py diff --git a/backend/api/apps.py b/api/apps.py similarity index 100% rename from backend/api/apps.py rename to api/apps.py diff --git a/backend/api/models.py b/api/models.py similarity index 100% rename from backend/api/models.py rename to api/models.py diff --git a/backend/api/rabbitmq.py b/api/rabbitmq.py similarity index 100% rename from backend/api/rabbitmq.py rename to api/rabbitmq.py diff --git a/backend/api/routers.py b/api/routers.py similarity index 100% rename from backend/api/routers.py rename to api/routers.py diff --git a/backend/api/urls.py b/api/urls.py similarity index 100% rename from backend/api/urls.py rename to api/urls.py diff --git a/backend/api/views.py b/api/views.py similarity index 100% rename from backend/api/views.py rename to api/views.py diff --git a/biome.json b/biome.json index 21f319e2..96ae8383 100644 --- a/biome.json +++ b/biome.json @@ -13,7 +13,7 @@ "indentStyle": "space", "indentWidth": 4, "lineWidth": 119, - "ignore": ["backend/release-schema.json"] + "ignore": ["release-schema.json"] }, "json": { "formatter": { diff --git a/backend/core/__init__.py b/core/__init__.py similarity index 100% rename from backend/core/__init__.py rename to core/__init__.py diff --git a/backend/core/asgi.py b/core/asgi.py similarity index 100% rename from backend/core/asgi.py rename to core/asgi.py diff --git a/backend/core/locale/en/LC_MESSAGES/django.po b/core/locale/en/LC_MESSAGES/django.po similarity index 100% rename from backend/core/locale/en/LC_MESSAGES/django.po rename to core/locale/en/LC_MESSAGES/django.po diff --git a/backend/core/locale/en_US/LC_MESSAGES/django.po b/core/locale/en_US/LC_MESSAGES/django.po similarity index 100% rename from backend/core/locale/en_US/LC_MESSAGES/django.po rename to core/locale/en_US/LC_MESSAGES/django.po diff --git a/backend/core/locale/es/LC_MESSAGES/django.po b/core/locale/es/LC_MESSAGES/django.po similarity index 100% rename from backend/core/locale/es/LC_MESSAGES/django.po rename to core/locale/es/LC_MESSAGES/django.po diff --git a/backend/core/settings.py b/core/settings.py similarity index 98% rename from backend/core/settings.py rename to core/settings.py index db12573d..3c5685d6 100644 --- a/backend/core/settings.py +++ b/core/settings.py @@ -270,8 +270,6 @@ # The path to a service account JSON file, for writing exports to Google Drive. # https://developers.google.com/workspace/guides/create-credentials#service-account -# WARNING: If you change the directory for the production default, update `backend/Dockerfile` and -# `docker-compose.yaml` volumes. SERVICE_ACCOUNT_JSON_FILE = os.getenv("SERVICE_ACCOUNT_JSON_FILE", "credentials.json") # The Google Docs IDs for templates, when writing exports to Google Drive. diff --git a/backend/core/urls.py b/core/urls.py similarity index 100% rename from backend/core/urls.py rename to core/urls.py diff --git a/backend/core/wsgi.py b/core/wsgi.py similarity index 100% rename from backend/core/wsgi.py rename to core/wsgi.py diff --git a/docs/conf.py b/docs/conf.py index 3d5dadf0..d451e8c8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -11,7 +11,7 @@ import django -sys.path.insert(0, os.path.join(os.path.abspath(".."), "backend")) +sys.path.insert(0, os.path.abspath("..")) os.environ["DJANGO_SETTINGS_MODULE"] = "core.settings" django.setup() diff --git a/docs/contributing/add-check.rst b/docs/contributing/add-check.rst index faebfacd..7c376f29 100644 --- a/docs/contributing/add-check.rst +++ b/docs/contributing/add-check.rst @@ -3,7 +3,7 @@ Add a check In all cases: -#. Add a line to ``backend/export/translations.py`` +#. Add a line to ``exporter/translations.py`` Field-level ----------- @@ -15,7 +15,7 @@ The UI otherwise automatically supports new field-level checks. Compiled release-level ---------------------- -#. Add an element to ``CHECKS`` in ``backend/exporter/template_tags/resource.py`` +#. Add an element to ``CHECKS`` in ``exporter/template_tags/resource.py`` #. Add an element to ``order`` in ``frontend/src/components/ResourceLevelList.vue`` #. If a section other than ``coherent``, ``consistent`` or ``reference`` is used, add it to ``sections`` in ``frontend/src/views/Resource.vue`` #. Add new keys to ``resourceLevel.coherent``, ``resourceLevel.consistent`` and/or ``resourceLevel.reference`` in ``frontend/src/messages/en.js`` @@ -25,7 +25,7 @@ The UI otherwise automatically supports new compiled release-level checks. Dataset-level ------------- -#. Add a key-value pair to ``CHECK_TYPES`` in ``backend/exporter/template_tags/dataset.py`` +#. Add a key-value pair to ``CHECK_TYPES`` in ``exporter/template_tags/dataset.py`` #. Add a key-value pair to ``checkTypeData`` in ``frontend/src/plugins/datasetMixins.js`` #. Add an element to the appropriate array in ``frontend/src/components/DatasetLevelSection.vue`` #. Add new keys to ``datasetLevel`` in ``frontend/src/messages/en.js`` diff --git a/docs/contributing/add-metadata.rst b/docs/contributing/add-metadata.rst index f35b0043..b991fcec 100644 --- a/docs/contributing/add-metadata.rst +++ b/docs/contributing/add-metadata.rst @@ -3,5 +3,5 @@ Add metadata #. Update the template in ``frontend/src/views/Overview.vue``. #. Add new keys to ``overview`` in ``frontend/src/messages/en.js``. -#. Update the ``tags`` tuple and return value in ``backend/exporter/template_tags/overview.py``. +#. Update the ``tags`` tuple and return value in ``exporter/template_tags/overview.py``. diff --git a/docs/contributing/index.rst b/docs/contributing/index.rst index 1ba36672..1027ed76 100644 --- a/docs/contributing/index.rst +++ b/docs/contributing/index.rst @@ -24,12 +24,6 @@ Set up the git pre-commit hook: Backend ~~~~~~~ -Change to the ``backend`` directory: - -.. code-block:: bash - - cd backend - Install development dependencies: .. code-block:: bash @@ -47,7 +41,7 @@ If you don't have an instance of `Pelican backend `__'s database is treated as a read-only `legacy database `__, with ``managed = False`` in all model's ``Meta`` class, and with a ``DATABASE_ROUTERS`` setting that routes queries to its database. -To update ``backend/api/models.py`` following changes to Pelican backend's database schema: +To update ``api/models.py`` following changes to Pelican backend's database schema: -- Run ``python backend/manage.py inspectdb > backend/api/models.py`` +- Run ``python manage.py inspectdb > api/models.py`` - Replace comments at top of file - Replace ``models.DO_NOTHING`` with ``on_delete=models.CASCADE`` - ``Dataset.meta``: Add ``blank=True, default=dict`` diff --git a/docs/contributing/update-check.rst b/docs/contributing/update-check.rst index 16cbea82..35ecc217 100644 --- a/docs/contributing/update-check.rst +++ b/docs/contributing/update-check.rst @@ -11,5 +11,5 @@ Pelican frontend does not pre-emptively disallow new versions, since breaking ch For example, changing the histogram bins (buckets) in Pelican backend would require supporting more bins in: - - ``backend/exporter/leaf_tags/dataset.py`` + - ``exporter/leaf_tags/dataset.py`` - ``frontend/src/components/BarChartSingleValue.vue`` diff --git a/docs/export.rst b/docs/export.rst index 269ce4ab..c9c9e530 100644 --- a/docs/export.rst +++ b/docs/export.rst @@ -127,7 +127,7 @@ Simple tags accept no arguments. * - ``{% lifecycleImage %}`` - this image in a frame with the number of objects per contracting stage - .. image:: ../backend/exporter/assets/images/lifecycle.png + .. image:: ../exporter/assets/images/lifecycle.png Date leaf tags ^^^^^^^^^^^^^^ diff --git a/backend/exporter/__init__.py b/exporter/__init__.py similarity index 100% rename from backend/exporter/__init__.py rename to exporter/__init__.py diff --git a/backend/exporter/apps.py b/exporter/apps.py similarity index 100% rename from backend/exporter/apps.py rename to exporter/apps.py diff --git a/backend/exporter/assets/fonts/GT Eesti Pro Display Bold.ttf b/exporter/assets/fonts/GT Eesti Pro Display Bold.ttf similarity index 100% rename from backend/exporter/assets/fonts/GT Eesti Pro Display Bold.ttf rename to exporter/assets/fonts/GT Eesti Pro Display Bold.ttf diff --git a/backend/exporter/assets/fonts/GT Eesti Pro Display Regular.ttf b/exporter/assets/fonts/GT Eesti Pro Display Regular.ttf similarity index 100% rename from backend/exporter/assets/fonts/GT Eesti Pro Display Regular.ttf rename to exporter/assets/fonts/GT Eesti Pro Display Regular.ttf diff --git a/backend/exporter/assets/fonts/UbuntuMono-B.ttf b/exporter/assets/fonts/UbuntuMono-B.ttf similarity index 100% rename from backend/exporter/assets/fonts/UbuntuMono-B.ttf rename to exporter/assets/fonts/UbuntuMono-B.ttf diff --git a/backend/exporter/assets/fonts/UbuntuMono-BI.ttf b/exporter/assets/fonts/UbuntuMono-BI.ttf similarity index 100% rename from backend/exporter/assets/fonts/UbuntuMono-BI.ttf rename to exporter/assets/fonts/UbuntuMono-BI.ttf diff --git a/backend/exporter/assets/fonts/UbuntuMono-R.ttf b/exporter/assets/fonts/UbuntuMono-R.ttf similarity index 100% rename from backend/exporter/assets/fonts/UbuntuMono-R.ttf rename to exporter/assets/fonts/UbuntuMono-R.ttf diff --git a/backend/exporter/assets/fonts/UbuntuMono-RI.ttf b/exporter/assets/fonts/UbuntuMono-RI.ttf similarity index 100% rename from backend/exporter/assets/fonts/UbuntuMono-RI.ttf rename to exporter/assets/fonts/UbuntuMono-RI.ttf diff --git a/backend/exporter/assets/images/lifecycle.png b/exporter/assets/images/lifecycle.png similarity index 100% rename from backend/exporter/assets/images/lifecycle.png rename to exporter/assets/images/lifecycle.png diff --git a/backend/exporter/decorators.py b/exporter/decorators.py similarity index 100% rename from backend/exporter/decorators.py rename to exporter/decorators.py diff --git a/backend/exporter/document.py b/exporter/document.py similarity index 100% rename from backend/exporter/document.py rename to exporter/document.py diff --git a/backend/exporter/exceptions.py b/exporter/exceptions.py similarity index 100% rename from backend/exporter/exceptions.py rename to exporter/exceptions.py diff --git a/backend/exporter/gdocs.py b/exporter/gdocs.py similarity index 100% rename from backend/exporter/gdocs.py rename to exporter/gdocs.py diff --git a/backend/exporter/graphs.py b/exporter/graphs.py similarity index 100% rename from backend/exporter/graphs.py rename to exporter/graphs.py diff --git a/backend/exporter/leaf_tags/__init__.py b/exporter/leaf_tags/__init__.py similarity index 100% rename from backend/exporter/leaf_tags/__init__.py rename to exporter/leaf_tags/__init__.py diff --git a/backend/exporter/leaf_tags/dataset.py b/exporter/leaf_tags/dataset.py similarity index 100% rename from backend/exporter/leaf_tags/dataset.py rename to exporter/leaf_tags/dataset.py diff --git a/backend/exporter/leaf_tags/field.py b/exporter/leaf_tags/field.py similarity index 100% rename from backend/exporter/leaf_tags/field.py rename to exporter/leaf_tags/field.py diff --git a/backend/exporter/leaf_tags/generic.py b/exporter/leaf_tags/generic.py similarity index 100% rename from backend/exporter/leaf_tags/generic.py rename to exporter/leaf_tags/generic.py diff --git a/backend/exporter/leaf_tags/overview.py b/exporter/leaf_tags/overview.py similarity index 100% rename from backend/exporter/leaf_tags/overview.py rename to exporter/leaf_tags/overview.py diff --git a/backend/exporter/leaf_tags/resource.py b/exporter/leaf_tags/resource.py similarity index 100% rename from backend/exporter/leaf_tags/resource.py rename to exporter/leaf_tags/resource.py diff --git a/backend/exporter/locale/en/LC_MESSAGES/django.po b/exporter/locale/en/LC_MESSAGES/django.po similarity index 100% rename from backend/exporter/locale/en/LC_MESSAGES/django.po rename to exporter/locale/en/LC_MESSAGES/django.po diff --git a/backend/exporter/locale/en_US/LC_MESSAGES/django.po b/exporter/locale/en_US/LC_MESSAGES/django.po similarity index 100% rename from backend/exporter/locale/en_US/LC_MESSAGES/django.po rename to exporter/locale/en_US/LC_MESSAGES/django.po diff --git a/backend/exporter/locale/es/LC_MESSAGES/django.po b/exporter/locale/es/LC_MESSAGES/django.po similarity index 100% rename from backend/exporter/locale/es/LC_MESSAGES/django.po rename to exporter/locale/es/LC_MESSAGES/django.po diff --git a/backend/exporter/tag.py b/exporter/tag.py similarity index 100% rename from backend/exporter/tag.py rename to exporter/tag.py diff --git a/backend/exporter/template_tags/__init__.py b/exporter/template_tags/__init__.py similarity index 100% rename from backend/exporter/template_tags/__init__.py rename to exporter/template_tags/__init__.py diff --git a/backend/exporter/template_tags/base.py b/exporter/template_tags/base.py similarity index 100% rename from backend/exporter/template_tags/base.py rename to exporter/template_tags/base.py diff --git a/backend/exporter/template_tags/dataset.py b/exporter/template_tags/dataset.py similarity index 100% rename from backend/exporter/template_tags/dataset.py rename to exporter/template_tags/dataset.py diff --git a/backend/exporter/template_tags/field.py b/exporter/template_tags/field.py similarity index 100% rename from backend/exporter/template_tags/field.py rename to exporter/template_tags/field.py diff --git a/backend/exporter/template_tags/overview.py b/exporter/template_tags/overview.py similarity index 100% rename from backend/exporter/template_tags/overview.py rename to exporter/template_tags/overview.py diff --git a/backend/exporter/template_tags/resource.py b/exporter/template_tags/resource.py similarity index 100% rename from backend/exporter/template_tags/resource.py rename to exporter/template_tags/resource.py diff --git a/backend/exporter/translations.py b/exporter/translations.py similarity index 100% rename from backend/exporter/translations.py rename to exporter/translations.py diff --git a/backend/exporter/urls.py b/exporter/urls.py similarity index 100% rename from backend/exporter/urls.py rename to exporter/urls.py diff --git a/backend/exporter/util.py b/exporter/util.py similarity index 100% rename from backend/exporter/util.py rename to exporter/util.py diff --git a/backend/exporter/views.py b/exporter/views.py similarity index 100% rename from backend/exporter/views.py rename to exporter/views.py diff --git a/backend/manage.py b/manage.py similarity index 100% rename from backend/manage.py rename to manage.py diff --git a/pyproject.toml b/pyproject.toml index 51862cef..ffee8f10 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,6 @@ version = "0.0.0" [tool.ruff] line-length = 119 target-version = "py311" -src = ["backend"] [tool.ruff.lint] select = ["ALL"] @@ -29,13 +28,13 @@ ignore-variadic-names = true "docs/*" = ["D100", "INP001"] "{*/signals,*/views,*/migrations/*}.py" = ["ARG001"] "{*/admin,*/routers,*/views,*/commands/*}.py" = ["ARG002"] -"{*/admin,*/forms,*/models,*/routers,*/migrations/*,*/tests/*}.py" = ["RUF012"] +"{*/admin,*/forms,*/models,*/routers,*/migrations/*,tests/*}.py" = ["RUF012"] "*/{serializers,views}.py" = ["RUF012"] "*/migrations/*" = ["E501"] -"*/tests/*" = [ +"tests/*" = [ "D", "FBT003", "INP001", "PLR2004", "PT", "S", "TRY003", ] -"*/exporter/*" = [ +"exporter/*" = [ "D205", "ARG001", # tag "ARG002", # data diff --git a/backend/release-schema.json b/release-schema.json similarity index 100% rename from backend/release-schema.json rename to release-schema.json diff --git a/backend/tests/__init__.py b/tests/__init__.py similarity index 100% rename from backend/tests/__init__.py rename to tests/__init__.py diff --git a/backend/tests/api/__init__.py b/tests/api/__init__.py similarity index 100% rename from backend/tests/api/__init__.py rename to tests/api/__init__.py diff --git a/backend/tests/api/test_views.py b/tests/api/test_views.py similarity index 100% rename from backend/tests/api/test_views.py rename to tests/api/test_views.py diff --git a/backend/tests/exporter/__init__.py b/tests/exporter/__init__.py similarity index 100% rename from backend/tests/exporter/__init__.py rename to tests/exporter/__init__.py diff --git a/backend/tests/exporter/test_tag.py b/tests/exporter/test_tag.py similarity index 100% rename from backend/tests/exporter/test_tag.py rename to tests/exporter/test_tag.py diff --git a/backend/tests/exporter/test_tags.py b/tests/exporter/test_tags.py similarity index 100% rename from backend/tests/exporter/test_tags.py rename to tests/exporter/test_tags.py diff --git a/backend/tests/fixtures/pelican-backend.sql.gz b/tests/fixtures/pelican-backend.sql.gz similarity index 100% rename from backend/tests/fixtures/pelican-backend.sql.gz rename to tests/fixtures/pelican-backend.sql.gz