Skip to content

Commit

Permalink
Merge pull request #3539 from mathesar-foundation/0.1.7
Browse files Browse the repository at this point in the history
Release 0.1.7
  • Loading branch information
ghislaineguerin authored Apr 30, 2024
2 parents b99e82c + 7fabd12 commit 0762414
Show file tree
Hide file tree
Showing 34 changed files with 1,785 additions and 105 deletions.
1 change: 0 additions & 1 deletion .github/workflows/test-and-lint-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ jobs:
with:
checkName: "flake8"
path: "."
plugins: flake8-no-types
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
21 changes: 19 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ EXPOSE 8000 3000 6006
ENTRYPOINT ["./dev-run.sh"]


#=========== STAGE: PRODUCTION ===============================================#
#=========== STAGE: COMMON ===================================================#

FROM base AS production
from base as common

# Install prod requirements
RUN pip install --no-cache-dir -r requirements-prod.txt
Expand All @@ -105,6 +105,23 @@ RUN rm -rf ./mathesar_ui
RUN rm -rf ./mathesar/tests ./db/tests
RUN rm -rf ./docs


#=========== STAGE: DEMO =====================================================#

FROM common AS demo

# Install prod requirements
RUN pip install --no-cache-dir -r requirements-demo.txt

EXPOSE 8000

ENTRYPOINT ["./run.sh"]


#=========== STAGE: PRODUCTION ===============================================#

FROM common AS production

EXPOSE 8000

ENTRYPOINT ["./run.sh"]
5 changes: 5 additions & 0 deletions config/settings/common_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def pipe_delim(pipe_string):
"django_filters",
"django_property_filter",
"drf_spectacular",
"modernrpc",
"mathesar",
]

Expand All @@ -64,6 +65,10 @@ def pipe_delim(pipe_string):

ROOT_URLCONF = "config.urls"

MODERNRPC_METHODS_MODULES = [
'mathesar.rpc.connections'
]

TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
Expand Down
3 changes: 3 additions & 0 deletions demo/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"demo.middleware.LiveDemoModeMiddleware",
]


SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

MATHESAR_MODE = 'PRODUCTION'
MATHESAR_LIVE_DEMO = True
MATHESAR_LIVE_DEMO_USERNAME = decouple_config('MATHESAR_LIVE_DEMO_USERNAME', default=None)
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/administration/upgrade/0.1.5.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Upgrade Mathesar to 0.1.5

### For installations using Docker Compose
## For installations using Docker Compose

If you have a Docker compose installation (including one from the guided script), run the command below:

Expand All @@ -12,6 +12,6 @@ docker compose -f /etc/mathesar/docker-compose.yml up --pull always -d
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
## For installations done from scratch

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.
4 changes: 2 additions & 2 deletions docs/docs/administration/upgrade/0.1.6.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Upgrade Mathesar to 0.1.6

### For installations using Docker Compose
## For installations using Docker Compose

If you have a Docker compose installation (including one from the guided script), run the command below:

Expand All @@ -12,7 +12,7 @@ docker compose -f /etc/mathesar/docker-compose.yml up --pull always -d
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
## 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.

Expand Down
86 changes: 86 additions & 0 deletions docs/docs/administration/upgrade/0.1.7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Upgrade Mathesar to 0.1.7

## 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.7.

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.7 from the repository

```
git pull https://github.com/mathesar-foundation/mathesar.git
git checkout 0.1.7
```

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.7/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
```
8 changes: 8 additions & 0 deletions docs/docs/api/rest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# REST API

Mathesar has a REST API that the front end uses to interact with the backend.

For Mathesar's beta release, we are actively transitioning to a new [RPC-style API](https://wiki.mathesar.org/projects/2024/architecture-transition/rpc/) and will soon be phasing out the REST API entirely.

The REST API is not documented and is not intended to be used by third-party developers.

92 changes: 92 additions & 0 deletions docs/docs/api/rpc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# RPC API

Mathesar has an API available at `/api/rpc/v0/` which follows the [JSON-RPC](https://www.jsonrpc.org/specification) spec version 2.0.

## About

### Status

We are currently in the process of [transitioning](https://wiki.mathesar.org/projects/2024/architecture-transition/rpc/) our API architecture from a [RESTful](rest.md) API to this RPC-style API, and we hope to have all functionality available through the RPC API by Mathesar's beta release.

!!! caution "Stability"
The RPC API is not yet stable and may change in the future, even after we've completed the transition to the RPC API architecture. If you build logic that depends on this API, be mindful that it may change in the future without warning or notice.

### Usage

To use an RPC function:

- Call it with a dot path starting from its root path.
- Always use named parameters.
- Ensure that your request includes HTTP headers for valid session IDs, as well as CSRF cookies and tokens.

!!! example

To call function `add_from_known_connection` from the `connections` section of this page, you'd send something like:

`POST /api/rpc/v0/`

```json
{
"jsonrpc": "2.0",
"id": 234,
"method": "connections.add_from_known_connection",
"params": {
"nickname": "anewconnection",
"db_name": "mynewcooldb"
},
}
```

---

::: mathesar.rpc.connections
options:
members:
- add_from_known_connection
- add_from_scratch
- DBModelReturn

## Responses

### Success

Upon a successful call to an RPC function, the API will return a success object. Such an object has the following form:

```json
{
"jsonrpc": "2.0",
"id": 234,
"result": <any>
}
```

The `result` is whatever was returned by the underlying function.

### Errors

When an error is produced by a call to the RPC endpoint, we produce an error of the following form:

```json
{
"jsonrpc": "2.0",
"id": 234,
"error": {
"code": <int>,
"message": <str>
}
}
```

The `code` is a negative integer. Some codes are produced according to the [JSON-RPC spec](https://www.jsonrpc.org/specification#error_object).

Other error codes are grouped according to the library that produced the Exception:

- `builtins`: -31xxx
- `psycopg` or `psycopg2`: -30xxx
- `django`: -29xxx
- `mathesar` (our code): -28xxx
- `db` (our code): -27xxx
- `sqlalchemy`: -26xxx
- other: -25xxx

Unrecognized errors from a given library return a "round number" code, so an unknown `builtins` error gets the code -31000.
48 changes: 48 additions & 0 deletions docs/docs/releases/0.1.7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Mathesar 0.1.7

## Summary

Mathesar 0.1.7 introduces linked table navigation from the data cell context menu. This release also fixes the regeneration of exploration share URLs and removes the 'group' suffix in the Data Explorer column names.

_This page provides a comprehensive list of all changes in the release._

## Upgrading to 0.1.7

See our guide on [upgrading Mathesar to 0.1.7](../administration/upgrade/0.1.7.md).

## Improvements

### Linked Table Navigation from Cell Context Menu

Users can now navigate to linked tables from the cell context menu, providing a more seamless experience when working with linked data.

![image](https://github.com/mathesar-foundation/mathesar/assets/845767/3015b1e8-7038-41b3-a9ec-59a4d55780d0)

_[#3526](https://github.com/mathesar-foundation/mathesar/pull/3526 " Navigate to linked table via cell context menu ")_

## Bug fixes

### Fixed Regeneration of Exploration Share URL

Fixed an issue where clicking "Regenerate Link" for a shared exploration failed to create a new URL and resulted in a 404 API request. Now, users will see a successful API call with a new, regenerated share URL.

_[#3521](https://github.com/mathesar-foundation/mathesar/pull/3521 "Fix regeneration of exploration share URL")_

### Remove 'group' Suffix in Data Explorer

Resolved an issue in the Data Explorer where the grouping column name was incorrectly suffixed with 'group'. Now, the original column names are preserved when summarizing data.

_[#3357](https://github.com/mathesar-foundation/mathesar/pull/3357 "Removed the 'group' suffix in Data Explorer")_

## Documentation

- Upgrade Instructions for 0.1.7 _[#3534](https://github.com/mathesar-foundation/mathesar/pull/3534 "Upgrade instructions for 0.1.7")_

## Maintenance

- Bump Django from 4.2.10 to 4.2.11 _[#3496](https://github.com/mathesar-foundation/mathesar/pull/3496 "Bump django from 4.2.10 to 4.2.11")_
- Made Release Notes Script Portable _[#3529](https://github.com/mathesar-foundation/mathesar/pull/3529 "Made release notes script portable.")_
- Removed Stray Changes Post Script Update _[#3530](https://github.com/mathesar-foundation/mathesar/pull/3530 "Removed stray change left over from #3529")_
- Integrated Changes from Previous Release Preparation _[#3517](https://github.com/mathesar-foundation/mathesar/pull/3517 "Merge pull request #3494 from mathesar-foundation/0.1.6")_
- Added Demo Target in Dockerfile for Future Deployments _[#3523](https://github.com/mathesar-foundation/mathesar/pull/3523 "Add demo target to Dockerfile")_
- New RPC Endpoint Implementation for Superuser Functions _[#3524](https://github.com/mathesar-foundation/mathesar/pull/3524 "Modern rpc prototype")_
7 changes: 7 additions & 0 deletions docs/docs/releases/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

This is developer documentation to help with release notes. It is not published in our docs guide.

## Requirements

- Install [DuckDB](https://duckdb.org/#quickinstall).
- On Macs, the easiest way to do this is via [Homebrew](https://brew.sh/): `brew install duckdb`.
- Install the [GitHub CLI](https://cli.github.com/).
- On Macs, the easiest way to do this is via [Homebrew](https://brew.sh/): `brew install gh`.

## How to generate release notes

1. Run the `find_missing_prs.sh` script, passing the release version number as the only argument.
Expand Down
13 changes: 10 additions & 3 deletions docs/docs/releases/find_missing_prs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ TEMPLATE_FILE=TEMPLATE.md
# If the notes file doesn't yet exist, create one
if [ ! -f $NOTES_FILE ]; then
cp $TEMPLATE_FILE $NOTES_FILE
sed -i "s/__VERSION__/$RELEASE/g" $NOTES_FILE
# Note: We're not using the `-i` option to sed because it's not portable
sed "s/__VERSION__/$RELEASE/g" $NOTES_FILE > $NOTES_FILE.tmp
mv $NOTES_FILE.tmp $NOTES_FILE
fi

PREV_NOTES_FILE=$(ls -1 | sort | grep -B 1 $NOTES_FILE | head -n 1)
Expand Down Expand Up @@ -80,12 +82,17 @@ mkdir -p "$CACHE_DIR"
# branch but not included in the master branch.
git log --format=%H --first-parent $PREV_RELEASE..$RELEASE_BRANCH > $COMMITS_FILE

ONE_YEAR_AGO=$(python3 -c "
from datetime import datetime, timedelta
one_year_ago = datetime.utcnow() - timedelta(days=365)
print(one_year_ago.strftime('%Y-%m-%d'))")

# Find and cache details about all the PRs merged within the past year. This
# gets more PRs than we need, but we'll filter it shortly.
gh pr list \
--limit 1000 \
--json additions,author,deletions,mergeCommit,title,url \
--search "is:closed merged:>$(date -d '1 year ago' '+%Y-%m-%d')" \
--search "is:closed merged:>$ONE_YEAR_AGO" \
--jq 'map({
additions: .additions,
mergeCommit: .mergeCommit.oid,
Expand All @@ -95,7 +102,7 @@ gh pr list \

# Find and cache the URLs to any PRs that we've already referenced in the
# release notes.
grep -Po 'https://github\.com/mathesar-foundation/mathesar/pull/\d*' \
grep -Eo 'https://github\.com/mathesar-foundation/mathesar/pull/[0-9]+' \
$NOTES_FILE > $INCLUDED_PRS_FILE

# Generate a CSV containing details for PRs that match commits in the release
Expand Down
Loading

0 comments on commit 0762414

Please sign in to comment.