diff --git a/.github/workflows/create-draft-release.yml b/.github/workflows/create-draft-release.yml new file mode 100644 index 0000000000..f289321afa --- /dev/null +++ b/.github/workflows/create-draft-release.yml @@ -0,0 +1,42 @@ +name: Build static files and create draft release + +on: + push: + tags: + - "*" + workflow_dispatch: + + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 18 + + - name: Build frontend static files + working-directory: ./mathesar_ui + run: npm ci && npm run build + + - name: Move static files + run: mv ./mathesar/static/mathesar ./static_files + + - name: Zip static files + uses: montudor/action-zip@v1 + with: + args: zip -qq -r static_files.zip static_files + + - name: Create a draft release + id: create_release + uses: shogo82148/actions-create-release@v1 + with: + draft: true + + - name: Upload assets + uses: shogo82148/actions-upload-release-asset@v1 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: static_files.zip \ No newline at end of file diff --git a/.github/workflows/test-and-lint-code.yml b/.github/workflows/test-and-lint-code.yml index 7d52674e87..0aa3149f3a 100644 --- a/.github/workflows/test-and-lint-code.yml +++ b/.github/workflows/test-and-lint-code.yml @@ -113,7 +113,8 @@ jobs: needs.all_be_tests_required.outputs.tests_should_run strategy: matrix: - pg-version: [13, 14, 15] + py-version: [3.9-bookworm, 3.10-bookworm, 3.11-bookworm, 3.12-bookworm] + pg-version: [13, 14, 15, 16] steps: - uses: actions/checkout@v4 - name: Copy env file @@ -125,6 +126,7 @@ jobs: - name: Build the stack run: docker compose -f docker-compose.dev.yml up --build -d test-service env: + PYTHON_VERSION: ${{ matrix.py-version }} PG_VERSION: ${{ matrix.pg-version }} - name: Run tests with pytest run: docker exec mathesar_service_test ./run_pytest.sh @@ -137,7 +139,7 @@ jobs: needs.all_be_tests_required.outputs.tests_should_run strategy: matrix: - pg-version: [13, 14, 15] + pg-version: [13, 14, 15, 16] steps: - uses: actions/checkout@v4 - name: Copy env file diff --git a/Dockerfile b/Dockerfile index 20f7c6d16a..84b2fb3a9f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,24 +1,19 @@ -FROM python:3.9-buster -ARG PYTHON_REQUIREMENTS=requirements.txt +#=========== STAGE: BASE =====================================================# +ARG PYTHON_VERSION=3.9-bookworm +FROM python:$PYTHON_VERSION AS base + ENV PYTHONUNBUFFERED=1 ENV DOCKERIZE_VERSION v0.6.1 -ENV NODE_MAJOR 18 ARG BUILD_PG_MAJOR=15 ENV PG_MAJOR=$BUILD_PG_MAJOR RUN set -eux; -#---------- 1. INSTALL SYSTEM DEPENDENCIES -----------------------------------# - RUN mkdir -p /etc/apt/keyrings; # Add Postgres source RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - ; \ - echo "deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main" > /etc/apt/sources.list.d/pgdg.list; - -# Add Node.js source -RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg; \ - echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list; + echo "deb http://apt.postgresql.org/pub/repos/apt/ bookworm-pgdg main" > /etc/apt/sources.list.d/pgdg.list; # Install common dependencies RUN apt-get update && \ @@ -28,7 +23,6 @@ RUN apt-get update && \ curl \ gnupg \ gettext \ - nodejs \ locales \ && rm -rf /var/lib/apt/lists/* @@ -42,18 +36,12 @@ RUN apt-get update && \ postgresql-$PG_MAJOR postgresql-client-$PG_MAJOR postgresql-contrib-$PG_MAJOR \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -#---------- 2. CONFIGURE SYSTEM DEPENDENCIES ---------------------------------# - -# Postgres - ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin ENV PGDATA /var/lib/postgresql/mathesar VOLUME /etc/postgresql/ VOLUME /var/lib/postgresql/ - # We set the default STOPSIGNAL to SIGINT, which corresponds to what PostgreSQL # calls "Fast Shutdown mode" wherein new connections are disallowed and any # in-progress transactions are aborted, allowing PostgreSQL to stop cleanly and @@ -64,17 +52,59 @@ STOPSIGNAL SIGINT EXPOSE 5432 +# Mathesar source +WORKDIR /code/ +COPY . . -#---------- 3. SETUP MATHESAR ------------------------------------------------# -WORKDIR /code/ +#=========== STAGE: DEVELOPMENT ==============================================# -COPY requirements* ./ -RUN pip install --no-cache-dir -r ${PYTHON_REQUIREMENTS} -COPY . . +FROM base AS development + +ENV NODE_MAJOR 18 + +# Install dev requirements +RUN pip install --no-cache-dir -r requirements-dev.txt +# Compile translation files +RUN python manage.py compilemessages + +# Add NodeJS source +RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg; \ + echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list; + +# Install node +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + nodejs \ + && rm -rf /var/lib/apt/lists/* + +# Build frontend source RUN cd mathesar_ui && npm ci && npm run build EXPOSE 8000 3000 6006 +ENTRYPOINT ["./dev-run.sh"] + + +#=========== STAGE: PRODUCTION ===============================================# + +FROM base AS production + +# Install prod requirements +RUN pip install --no-cache-dir -r requirements-prod.txt + +# Compile translation files +RUN python manage.py compilemessages + +# Copy built frontend static files +COPY --from=development /code/mathesar/static/mathesar ./mathesar/static/mathesar/ + +# Remove FE source, tests, docs +RUN rm -rf ./mathesar_ui +RUN rm -rf ./mathesar/tests ./db/tests +RUN rm -rf ./docs + +EXPOSE 8000 + ENTRYPOINT ["./run.sh"] diff --git a/README.md b/README.md index 7344f65aea..df5b5dd66b 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,6 @@ License GitHub closed issues GitHub commit activity - Codecov

diff --git a/config/context_processors.py b/config/context_processors.py index e4d87670df..85d6fa80a7 100644 --- a/config/context_processors.py +++ b/config/context_processors.py @@ -8,19 +8,26 @@ def frontend_settings(request): manifest_data = get_manifest_data() development_mode = settings.MATHESAR_MODE == 'DEVELOPMENT' + display_language = get_display_language_from_request(request) + fallback_language = settings.FALLBACK_LANGUAGE - i18n_settings = get_i18n_settings(manifest_data, development_mode) frontend_settings = { 'development_mode': development_mode, 'manifest_data': manifest_data, 'live_demo_mode': getattr(settings, 'MATHESAR_LIVE_DEMO', False), 'live_demo_username': getattr(settings, 'MATHESAR_LIVE_DEMO_USERNAME', None), 'live_demo_password': getattr(settings, 'MATHESAR_LIVE_DEMO_PASSWORD', None), - **i18n_settings + 'display_language': display_language, + 'include_i18n_fallback': display_language != fallback_language, } # Only include development URL if we're in development mode. if frontend_settings['development_mode'] is True: frontend_settings['client_dev_url'] = settings.MATHESAR_CLIENT_DEV_URL + i18n_settings = get_i18n_settings_dev(display_language) + else: + i18n_settings = get_i18n_settings_prod(display_language, manifest_data) + + frontend_settings = {**frontend_settings, **i18n_settings} return frontend_settings @@ -36,30 +43,33 @@ def get_display_language_from_request(request): return lang_from_locale_middleware -def get_i18n_settings(manifest_data, development_mode): - """ - Hard coding this for now - but will be taken from users model - and cookies later on - """ - display_language = 'en' - fallback_language = 'en' - +def get_i18n_settings_dev(display_language): client_dev_url = settings.MATHESAR_CLIENT_DEV_URL + fallback_language = settings.FALLBACK_LANGUAGE - if development_mode is True: - module_translations_file_path = f'{client_dev_url}/src/i18n/languages/{display_language}/index.ts' - legacy_translations_file_path = f'{client_dev_url}/src/i18n/languages/{display_language}/index.ts' - else: - try: - module_translations_file_path = static(manifest_data[display_language]["file"]) - legacy_translations_file_path = static(manifest_data[f"{display_language}-legacy"]["file"]) - except KeyError: - module_translations_file_path = static(manifest_data[fallback_language]["file"]) - legacy_translations_file_path = static(manifest_data[f"{fallback_language}-legacy"]["file"]) + return { + 'dev_display_language_url': f'{client_dev_url}/src/i18n/languages/{display_language}/index.ts', + 'dev_fallback_language_url': f'{client_dev_url}/src/i18n/languages/{fallback_language}/index.ts', + } + + +def get_prod_translation_file_urls(language, manifest_data): + prod_module_url = static(manifest_data[f"language_{language}"]["file"]) + prod_legacy_url = static(manifest_data[f"language_{language}_legacy"]["file"]) + + return { + 'module': prod_module_url, + 'legacy': prod_legacy_url, + } + + +def get_i18n_settings_prod(display_language, manifest_data): + fallback_language = settings.FALLBACK_LANGUAGE + + display_language_urls = get_prod_translation_file_urls(display_language, manifest_data) + fallback_language_urls = get_prod_translation_file_urls(fallback_language, manifest_data) return { - 'module_translations_file_path': module_translations_file_path, - 'legacy_translations_file_path': legacy_translations_file_path, - 'display_language': display_language + 'prod_display_language_urls': display_language_urls, + 'prod_fallback_language_urls': fallback_language_urls, } diff --git a/config/settings/common_settings.py b/config/settings/common_settings.py index 44bdb23bff..4d395ef80d 100644 --- a/config/settings/common_settings.py +++ b/config/settings/common_settings.py @@ -15,7 +15,6 @@ from decouple import Csv, config as decouple_config from dj_database_url import parse as db_url -from django.utils.translation import gettext_lazy # We use a 'tuple' with pipes as delimiters as decople naively splits the global @@ -272,11 +271,13 @@ def pipe_delim(pipe_string): # i18n LANGUAGES = [ - ('en', gettext_lazy('English')), - ('ja', gettext_lazy('Japanese')), + ('en', 'English'), + ('ja', 'Japanese'), ] LOCALE_PATHS = [ 'translations' ] LANGUAGE_COOKIE_NAME = 'display_language' +FALLBACK_LANGUAGE = 'en' + SALT_KEY = SECRET_KEY diff --git a/config/settings/production.py b/config/settings/production.py index 9af47d2268..f2b6b2af72 100644 --- a/config/settings/production.py +++ b/config/settings/production.py @@ -3,6 +3,14 @@ # Override default settings DEBUG = False MATHESAR_MODE = 'PRODUCTION' + +''' +This tells Django to trust the X-Forwarded-Proto header that comes from our proxy, +and any time its value is 'https', then the request is guaranteed to be secure +(i.e., it originally came in via HTTPS). +''' +SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') + # Use a local.py module for settings that shouldn't be version tracked try: from .local import * # noqa diff --git a/demo/settings.py b/demo/settings.py index 2288b5d7f8..4ef3245d01 100644 --- a/demo/settings.py +++ b/demo/settings.py @@ -2,7 +2,8 @@ from decouple import config as decouple_config INSTALLED_APPS += [ # noqa - "demo" + "demo", + "health_check", ] MIDDLEWARE += [ # noqa diff --git a/demo/urls.py b/demo/urls.py index 91c5188feb..51edf8e1d9 100644 --- a/demo/urls.py +++ b/demo/urls.py @@ -17,5 +17,6 @@ def permission_denied(_, *args, **kwargs): re_path(r'^api/ui/v0/users/(?P[^/.]+)/password_reset/', permission_denied, name='password_reset'), path('api/ui/v0/users/password_change/', permission_denied, name='password_change'), path('auth/password_reset_confirm/', RedirectView.as_view(url='/'), name='password_reset'), + path(r'health/', include('health_check.urls')), path('', include(root_urls)), ] diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 248a0bff4b..22717e2af1 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -36,9 +36,10 @@ services: image: mathesar/mathesar-dev:latest build: context: . + target: development dockerfile: Dockerfile args: - PYTHON_REQUIREMENTS: requirements-dev.txt + PYTHON_VERSION: ${PYTHON_VERSION-3.9-bookworm} environment: - MODE=${MODE-DEVELOPMENT} - DEBUG=${DEBUG-True} @@ -52,7 +53,6 @@ services: - POSTGRES_PASSWORD=mathesar - POSTGRES_HOST=mathesar_dev_db - POSTGRES_PORT=5432 - entrypoint: ./dev-run.sh volumes: - .:/code/ - ui_node_modules:/code/mathesar_ui/node_modules/ @@ -76,9 +76,10 @@ services: - POSTGRES_PORT=5432 build: context: . + target: development dockerfile: Dockerfile args: - PYTHON_REQUIREMENTS: requirements-dev.txt + PYTHON_VERSION: ${PYTHON_VERSION-3.9-bookworm} depends_on: - dev-db ports: diff --git a/docker-compose.yml b/docker-compose.yml index f191da922d..7ff8c91d71 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -160,7 +160,6 @@ services: # WARNING: MATHESAR_DATABASES is deprecated, and will be removed in a future release. MATHESAR_DATABASES: ${MATHESAR_DATABASES:-} - entrypoint: ./run.sh volumes: - ./msar/static:/code/static - ./msar/media:/code/media diff --git a/docs/docs/administration/debug.md b/docs/docs/administration/debug.md new file mode 100644 index 0000000000..2bfe872b4b --- /dev/null +++ b/docs/docs/administration/debug.md @@ -0,0 +1,44 @@ +# Debug Mathesar + +For now, we only support turning on Debugging by using our special docker image. More methods will follow in future releases. + +## Use the debugging Mathesar docker image + +There is a debugging-enabled Mathesar docker image available at `mathesar/mathesar-debug` that is the same as the `mathesar/mathesar-prod` image, except that it has more debugging output available in the console where it's run, and it also produces more verbose errors in the browser when something goes wrong. + +You can use this image to figure out (or to help the Mathesar team figure out) what's wrong if your Mathesar installation isn't working as expected. The procedure is to + +1. Run Mathesar with the `mathesar/mathesar-debug` image, and then +1. Observe and report any additional output or clues to the Mathesar team. + +### Docker Compose + +Just replace the line + +``` + image: mathesar/mathesar-prod:latest +``` + +with + +``` + image: mathesar/mathesar-debug:latest +``` + +### Basic Mathesar docker image + +If you are just trying the Mathesar Docker image directly as instructed in the [introduction](../index.md#try-locally), replace the command + +``` +docker run -it --name mathesar -p 8000:8000 mathesar/mathesar-prod:latest +``` + +with + +``` +docker run -it --name mathesar -p 8000:8000 mathesar/mathesar-debug:latest +``` + +### Other setups + +The debugging docker image should work anywhere the production image works. This means you can just replace any pull or run of the image `mathesar/mathesar-prod:latest` with `mathesar/mathesar-debug:latest`. diff --git a/docs/docs/administration/upgrade/0.1.4.md b/docs/docs/administration/upgrade/0.1.4.md index 9fd47fd678..04866d4123 100644 --- a/docs/docs/administration/upgrade/0.1.4.md +++ b/docs/docs/administration/upgrade/0.1.4.md @@ -149,10 +149,11 @@ If you installed Mathesar [from scratch](../../installation/build-from-source/in !!! note Your installation directory may be different from above if you used a different directory when installing Mathesar. -1. Pull the latest version from the repository +1. Pull version 0.1.4 from the repository ``` git pull https://github.com/mathesar-foundation/mathesar.git + git checkout 0.1.4 ``` 1. Update Python dependencies diff --git a/docs/docs/administration/upgrade/0.1.5.md b/docs/docs/administration/upgrade/0.1.5.md index a751862786..012c2921f0 100644 --- a/docs/docs/administration/upgrade/0.1.5.md +++ b/docs/docs/administration/upgrade/0.1.5.md @@ -14,4 +14,4 @@ docker compose -f /etc/mathesar/docker-compose.yml up --pull always -d ### For installations done from scratch -If you installed from scratch, the upgrade instructions are the same as [for 0.1.4](../../administration/upgrade/0.1.4/#scratch), but you can skip Step 5 – you do not need to change the environment variables. +If you installed from scratch, the upgrade instructions are the same as [for 0.1.4](./0.1.4.md#scratch), except that you'll need to specify version 0.1.5 when pulling code from the repository in Step 2. You should also skip Step 5 – you do not need to change the environment variables. diff --git a/docs/docs/administration/upgrade/0.1.6.md b/docs/docs/administration/upgrade/0.1.6.md new file mode 100644 index 0000000000..67a779abe0 --- /dev/null +++ b/docs/docs/administration/upgrade/0.1.6.md @@ -0,0 +1,86 @@ +# Upgrade Mathesar to 0.1.6 + +### For installations using Docker Compose + +If you have a Docker compose installation (including one from the guided script), run the command below: + +``` +docker compose -f /etc/mathesar/docker-compose.yml up --pull always -d +``` + +!!! warning "Your installation directory may be different" + You may need to change `/etc/mathesar/` in the command above if you chose to install Mathesar to a different directory. + + +### For installations done from scratch + +If you installed Mathesar [from scratch](../../installation/build-from-source/index.md), then use these steps to upgrade your installation to 0.1.6. + +1. Go to your Mathesar installation directory + + ``` + cd xMATHESAR_INSTALLATION_DIRx + ``` + + !!! note + Your installation directory may be different from above if you used a different directory when installing Mathesar. + +1. Pull version 0.1.6 from the repository + + ``` + git pull https://github.com/mathesar-foundation/mathesar.git + git checkout 0.1.6 + ``` + +1. Update Python dependencies + + ``` + pip install -r requirements-prod.txt + ``` + +1. Activate our virtual environment + + ``` + source ./mathesar-venv/bin/activate + ``` + +1. You can skip the following if you're upgrading from versions 0.1.4 and above. + - If you're upgrading from versions <= 0.1.3, update your environment variables according to the [the new configuration specification](../../configuration/env-variables.md#db). + - In particular, you must put the connection info for the internal DB into new `POSTGRES_*` variables. The `DJANGO_DATABASE_URL` variable is no longer supported. + +1. Add the environment variables to the shell before running Django commands + + ``` + export $(sudo cat .env) + ``` + +1. Run Django migrations + + ``` + python manage.py migrate + ``` + +1. Download and extract frontend assets + + ``` + wget https://github.com/mathesar-foundation/mathesar/releases/download/0.1.6/static_files.zip + unzip static_files.zip && mv static_files mathesar/static/mathesar && rm static_files.zip + ``` + +1. Compile Mathesar translation files + + ``` + python manage.py compilemessages + ``` + +1. Update Mathesar functions on the database: + + ``` + python -m mathesar.install --skip-confirm | tee /tmp/install.py.log + ``` + +1. Restart the gunicorn server + + ``` + systemctl restart gunicorn + ``` diff --git a/docs/docs/installation/build-from-source/index.md b/docs/docs/installation/build-from-source/index.md index c9c542ed2e..e28efe0bf7 100644 --- a/docs/docs/installation/build-from-source/index.md +++ b/docs/docs/installation/build-from-source/index.md @@ -23,41 +23,36 @@ You should have **root access** to the machine you're installing Mathesar on. You'll need to install the following system packages before you install Mathesar: -- [Python](https://www.python.org/downloads/) 3.9 or 3.10 +- [Python](https://www.python.org/downloads/) 3.9, 3.10, or 3.11 !!! note "Python version" + Python _older_ than 3.9 will not run Mathesar. - Python _newer_ than 3.10 will run Mathesar, but will require some slightly modified installation steps which we have [not yet documented](https://github.com/centerofci/mathesar/issues/2872). + Python 3.12 will run Mathesar, but you'll have to take extra steps to get some dependencies to build. Installing a package for your OS that provides the `libpq-fe.h` header file should be enough in most cases. On Debian 12, this header is provided by the `libpq-dev` package. - [PostgreSQL](https://www.postgresql.org/download/linux/) 13 or newer (Verify by logging in, and running the query: `SELECT version();`) -- [NodeJS](https://nodejs.org/en/download) 18 or newer (Verify with `node --version`) - - _(This is required for installation only and will eventually be [relaxed](https://github.com/centerofci/mathesar/issues/2871))_ - -- [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) 9 or newer (Verify with `npm --version`) - - _(This is required for installation only and will eventually be [relaxed](https://github.com/centerofci/mathesar/issues/2871))_ - - [Caddy](https://caddyserver.com/docs/install) (Verify with `caddy version`) - [git](https://git-scm.com/downloads) (Verify with `git --version`) +- [GNU gettext](https://www.gnu.org/software/gettext/) (Verify with `gettext --version`) ### Domain (optional) + If you want Mathesar to be accessible over the internet, you'll probably want to set up a domain or sub-domain to use. **If you don't need a domain, you can skip this section.** Before you start installation, **ensure that the DNS for your sub-domain or domain is pointing to the machine that you're installing Mathesar on**. ## Customizing this Guide + Type your domain name into the box below. Do not include a trailing slash. Then press Enter to customize this guide with your domain name. - ## Installation Steps ### Set up the database @@ -83,12 +78,6 @@ Then press Enter to customize this guide with your domain name. CREATE DATABASE mathesar_django OWNER mathesar; ``` -1. Now we let us create a database for storing your data. - - ```postgresql - CREATE DATABASE your_db_name OWNER mathesar; - ``` - 1. Press Ctrl+D to exit the `psql` shell. @@ -137,7 +126,7 @@ Then press Enter to customize this guide with your domain name. 1. Clone the git repo into the installation directory. ``` - git clone https://github.com/centerofci/mathesar.git . + git clone https://github.com/mathesar-foundation/mathesar.git . ``` 1. Checkout the tag of the latest stable release, `{{mathesar_version}}`. @@ -149,9 +138,6 @@ Then press Enter to customize this guide with your domain name. !!! warning "Important" If you don't run the above command you'll end up installing the latest _development_ version of Mathesar, which will be less stable. - !!! tip - You can install a specific Mathesar release by running commands like `git checkout 0.1.1` (to install version 0.1.1, for example). You can see all available versions by running `git tag`. - 1. We need to create a python virtual environment for the Mathesar application. ``` @@ -220,16 +206,20 @@ Then press Enter to customize this guide with your domain name. You need to export the environment variables each time you restart the shell as they don't persist across sessions. -1. Install the frontend dependencies +1. Download release static files and extract into the correct directory ``` - npm ci --prefix mathesar_ui + wget https://github.com/mathesar-foundation/mathesar/releases/download/{{mathesar_version}}/static_files.zip + unzip static_files.zip && mv static_files mathesar/static/mathesar && rm static_files.zip ``` - -1. Compile the Mathesar Frontend App - ``` - npm run --prefix mathesar_ui build --max_old_space_size=4096 - ``` + + +1. Compile Mathesar translation files + + ``` + python manage.py compilemessages + ``` + 1. Install Mathesar functions on the database: diff --git a/docs/docs/releases/0.1.6.md b/docs/docs/releases/0.1.6.md new file mode 100644 index 0000000000..6fb0c59674 --- /dev/null +++ b/docs/docs/releases/0.1.6.md @@ -0,0 +1,76 @@ +# Mathesar 0.1.6 + +## Summary + +Mathesar 0.1.6 introduces Japanese localization of the UI and adds better support for working with long text in individual record pages. Improvements for administrators include compatibility with Python 3.10 and 3.11, support for databases running PostgreSQL 16, and the removal of `npm` and `nodejs` as dependencies when installing from scratch. + +_This page provides a comprehensive list of all changes in the release._ + +## Upgrading to 0.1.6 + +See our guide on [upgrading Mathesar to 0.1.6](../administration/upgrade/0.1.6.md). + +## Improvements + +### You can now configure Mathesar's UI to display in Japanese + +The language setting is stored per-user and can be modified when logging in or when editing a user. This changes the text displayed on buttons and other UI elements within Mathesar. It does not change the display of data within your database (e.g. table names, column names, and cell values). We are hoping to support more languages beyond English and Japanese eventually. Please reach out to us if your are interested in helping to add more translations! + +![image](https://github.com/mathesar-foundation/mathesar/assets/52523023/f100423a-922c-4b6c-ad22-3c16cd06afde) + +_[#3486](https://github.com/mathesar-foundation/mathesar/pull/3486 "Enable i18n")_, _[#3484](https://github.com/mathesar-foundation/mathesar/pull/3484 "Updates for file translations/en/LC_MESSAGES/django.po in ja")_, _[#3483](https://github.com/mathesar-foundation/mathesar/pull/3483 "Updates for file mathesar_ui/src/i18n/languages/en/dict.json in ja")_, _[#3472](https://github.com/mathesar-foundation/mathesar/pull/3472 "Separate pluralized string to fix Transifex sync")_, _[#3501](https://github.com/mathesar-foundation/mathesar/pull/3501 "Fix layout problem in Data Explorer actions pane")_ + +### Text fields now auto-expands on the record page to accommodate longer texts + +**Before** + +All text inputs on the record page had the same height, regardless of their content. + +![image](https://github.com/mathesar-foundation/mathesar/assets/52523023/e6ded1de-7b81-49f9-9b2e-7a6311a22d4f) + +**After** + +All text inputs in record page dynamically adjust to accommodate the content seamlessly. + +![image](https://github.com/mathesar-foundation/mathesar/assets/52523023/31e031cc-5c71-447f-9381-c4d6fae03b2d) + +_[#3470](https://github.com/mathesar-foundation/mathesar/pull/3470 "Make textarea inputs auto-expand to accommodate longer text fields on the record page")_, _[#3488](https://github.com/mathesar-foundation/mathesar/pull/3488 "Fix regression with record selector not filtering")_, [#3495](https://github.com/mathesar-foundation/mathesar/pull/3495 "Prevent record selector inputs from growing taller") + +### Mathesar is now compatible with Python versions: 3.10 and 3.11 along with 3.9 + +Mathesar now officially supports Python versions 3.10 and 3.11, in addition to the existing 3.9 compatibility. This will provide great flexibility while building Mathesar from source on an OS that natively ships with relatively newer versions of Python. + +_[#3478](https://github.com/mathesar-foundation/mathesar/pull/3478 "Extend mathesar to support python 3.10 and above")_, _[#3499](https://github.com/mathesar-foundation/mathesar/pull/3499 "Fix CSRF failures when app is behind a reverse proxy")_, _[#3503](https://github.com/mathesar-foundation/mathesar/pull/3503 "Remove 3.12 support from docs")_, [#3504](https://github.com/mathesar-foundation/mathesar/pull/3504 "Parameterize dev service python version") + +### Mathesar is now compatible with PostgreSQL 16 + +Mathesar now officially supports, and is tested against, Postgres versions 13, 14, 15 and 16. + +_[#3480](https://github.com/mathesar-foundation/mathesar/pull/3480 "Add PG 16 to testing matrix")_ + +### NodeJS is no longer a requirement for building Mathesar from source + +We removed NodeJS as a dependency in favour of providing users with pre-built static assest for building Mathesar from source. + +_[#3489](https://github.com/mathesar-foundation/mathesar/pull/3489 "GH workflow to create draft release with built static files")_ + +## Bug fix + +- Fixed connection creation failures due to schema name collisions while adding provided sample schema(s) in the database _[#3490](https://github.com/mathesar-foundation/mathesar/pull/3490 "Fix schema creation errors while adding a new connection")_ + +## Documentation + +- Documented upgrade instructions for v0.1.6 _[#3507](https://github.com/mathesar-foundation/mathesar/pull/3507 "Adds upgrade documentation for 0.1.6, fixes existing issues with upgrade docs")_ +- 0.1.6 release notes _[#3506](https://github.com/mathesar-foundation/mathesar/pull/3506 "Release notes v0.1.6")_ +- Documented mathesar-debug image for Docker based installations _[#3513](https://github.com/mathesar-foundation/mathesar/pull/3513 "Add Debug image docs")_ +- Fixed upgrade instructions for v0.1.5 _[#3469](https://github.com/mathesar-foundation/mathesar/pull/3469 "Merge pull request #3468 from mathesar-foundation/upgrade_instruction_fix")_ +- Updated Mathesar's version number in docs _[#3476](https://github.com/mathesar-foundation/mathesar/pull/3476 "Merge pull request #3475 from mathesar-foundation/version_number_in_docs")_ +- Added MkDocs edit URI _[#3482](https://github.com/mathesar-foundation/mathesar/pull/3482 "Added MkDocs edit URI")_ +- Removed stale code coverage badge _[#3491](https://github.com/mathesar-foundation/mathesar/pull/3491 "Remove stale code coverage badge")_ + +## Maintenance + +- Added a health check endpoint for Mathesar _[#3479](https://github.com/mathesar-foundation/mathesar/pull/3479 "Add health check endpoint to Mathesar")_ +- Bumped Django from 4.2.8 to 4.2.10 _[#3492](https://github.com/mathesar-foundation/mathesar/pull/3492 "Bump django from 4.2.8 to 4.2.10")_ +- Removed NodeJS from Docker production image _[#3474](https://github.com/mathesar-foundation/mathesar/pull/3474 "Add multiple stages to Dockerfile, remove NodeJS & unnecessary source files from production image")_ +- Post release cleanup _[#3463](https://github.com/mathesar-foundation/mathesar/pull/3463 "Merge pull request #3460 from mathesar-foundation/0.1.5")_ diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 44bebe4a32..a486a03c4d 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -1,7 +1,8 @@ site_name: Mathesar Documentation site_url: https://docs.mathesar.org/ -repo_url: https://github.com/centerofci/mathesar/ -repo_name: centerofci/mathesar +repo_url: https://github.com/mathesar-foundation/mathesar/ +repo_name: mathesar-foundation/mathesar +edit_uri: edit/develop/docs/docs/ nav: - Introduction: @@ -13,10 +14,12 @@ nav: - Environment variables: configuration/env-variables.md - Administration: - Upgrade: + - To 0.1.6: administration/upgrade/0.1.6.md - To 0.1.5: administration/upgrade/0.1.5.md - To 0.1.4: administration/upgrade/0.1.4.md - To older versions: administration/upgrade/older.md - Uninstall Mathesar: administration/uninstall.md + - Debug Mathesar: administration/debug.md - Using Mathesar: - Introduction: user-guide/index.md - Importing data: user-guide/importing-data.md @@ -24,6 +27,7 @@ nav: - Users & access levels: user-guide/users.md - Glossary: user-guide/glossary.md - Releases: + - '0.1.6': releases/0.1.6.md - '0.1.5': releases/0.1.5.md - '0.1.4': releases/0.1.4.md - '0.1.3': releases/0.1.3.md @@ -96,4 +100,4 @@ markdown_extensions: permalink: true extra: - mathesar_version: 0.1.5 + mathesar_version: 0.1.6 diff --git a/mathesar/__init__.py b/mathesar/__init__.py index c105751bbb..7af7cf2dce 100644 --- a/mathesar/__init__.py +++ b/mathesar/__init__.py @@ -1,3 +1,3 @@ default_app_config = 'mathesar.apps.MathesarConfig' -__version__ = "0.1.5" +__version__ = "0.1.6" diff --git a/mathesar/api/db/viewsets/tables.py b/mathesar/api/db/viewsets/tables.py index c03c426e03..635ab234d4 100644 --- a/mathesar/api/db/viewsets/tables.py +++ b/mathesar/api/db/viewsets/tables.py @@ -110,7 +110,7 @@ def split_table(self, request, pk=None): table = self.get_object() column_names_id_map = table.get_column_name_id_bidirectional_map() serializer = SplitTableRequestSerializer(data=request.data, context={"request": request, 'table': table}) - if serializer.is_valid(True): + if serializer.is_valid(raise_exception=True): # We need to get the column names before splitting the table, # as they are the only reference to the new column after it is moved to a new table columns_to_extract = serializer.validated_data['extract_columns'] @@ -128,14 +128,14 @@ def split_table(self, request, pk=None): 'fk_column': remainder_fk_column.id } response_serializer = SplitTableResponseSerializer(data=split_table_response) - response_serializer.is_valid(True) + response_serializer.is_valid(raise_exception=True) return Response(response_serializer.data, status=status.HTTP_201_CREATED) @action(methods=['post'], detail=True) def move_columns(self, request, pk=None): table = self.get_object() serializer = MoveTableRequestSerializer(data=request.data, context={"request": request, 'table': table}) - if serializer.is_valid(True): + if serializer.is_valid(raise_exception=True): target_table = serializer.validated_data['target_table'] move_columns = serializer.validated_data['move_columns'] table.move_columns( diff --git a/mathesar/api/serializers/dependents.py b/mathesar/api/serializers/dependents.py index 45ba05b17e..2cf5c7b792 100644 --- a/mathesar/api/serializers/dependents.py +++ b/mathesar/api/serializers/dependents.py @@ -77,4 +77,4 @@ class DependentSerializer(serializers.Serializer): class DependentFilterSerializer(serializers.Serializer): - exclude = serializers.MultipleChoiceField(DATABASE_OBJECT_TYPES, required=False) + exclude = serializers.MultipleChoiceField(choices=DATABASE_OBJECT_TYPES, required=False) diff --git a/mathesar/state/django.py b/mathesar/state/django.py index 16b0dd2ba4..a812a9ca93 100644 --- a/mathesar/state/django.py +++ b/mathesar/state/django.py @@ -145,7 +145,7 @@ def _invalidate_columns_with_incorrect_display_options(tables): data=column.display_options, context={DISPLAY_OPTIONS_SERIALIZER_MAPPING_KEY: column.db_type} ) - if not serializer.is_valid(False): + if not serializer.is_valid(raise_exception=False): columns_with_invalid_display_option.append(column.id) if len(columns_with_invalid_display_option) > 0: models.Column.current_objects.filter(id__in=columns_with_invalid_display_option).update(display_options=None) diff --git a/mathesar/templates/mathesar/index.html b/mathesar/templates/mathesar/index.html index 30e8593603..078c5664de 100644 --- a/mathesar/templates/mathesar/index.html +++ b/mathesar/templates/mathesar/index.html @@ -19,12 +19,20 @@ {% endfor %} {% endif %} - - {% if development_mode %} + + {% if include_i18n_fallback %} + + {% endif %} + {% else %} + + {% if include_i18n_fallback %} + + {% endif %} + + + + {% if include_i18n_fallback %} + + {% endif %} + -{#if isTranslationsLoaded} - - - -{:else if !isTranslationsLoaded} -

- -
-{/if} + + {#if $isTranslationLoading} +
+ +
+ {:else} + {#key $locale} + + {/key} + {/if} +
+ + +