From dcbc01a58a41fd0b6d7edf1597d2d449916f94c0 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 26 Apr 2023 14:43:26 -0400 Subject: [PATCH 1/5] Add github action to codespell main on push and PRs --- .github/workflows/codespell.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/codespell.yml diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 0000000000..243ba8ce5f --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,19 @@ +--- +name: Codespell + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + codespell: + name: Check for spelling errors + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Codespell + uses: codespell-project/actions-codespell@v1 From f34353704d856fa087e1ba1541f718fe8bd4a4e4 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 26 Apr 2023 14:43:26 -0400 Subject: [PATCH 2/5] Add rudimentary codespell config --- pyproject.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index e3b1d3c279..65611de885 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -107,3 +107,8 @@ module = "sqlmodel.sql.expression" warn_unused_ignores = false # invalidate CI cache: 1 + +[tool.codespell] +skip = '.git,*.pdf,*.svg' +# +# ignore-words-list = '' From 319bcb23b281365a331bf1d10db1ffd655027505 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 26 Apr 2023 14:45:00 -0400 Subject: [PATCH 3/5] Tune up to skips --- pyproject.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 65611de885..c8014dda80 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -109,6 +109,6 @@ warn_unused_ignores = false # invalidate CI cache: 1 [tool.codespell] -skip = '.git,*.pdf,*.svg' -# -# ignore-words-list = '' +skip = '.git,*.pdf,*.svg,*.drawio' +# Ines - name +ignore-words-list = 'ines' From 8f176d25cbfdbfe867e18d001d44c36654bec283 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 26 Apr 2023 14:45:02 -0400 Subject: [PATCH 4/5] [DATALAD RUNCMD] run codespell throughout === Do not change lines below === { "chain": [], "cmd": "codespell -w", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --- docs/help.md | 2 +- docs/tutorial/automatic-id-none-refresh.md | 14 +++++++------- docs/tutorial/code-structure.md | 2 +- docs/tutorial/connect/create-connected-tables.md | 2 +- .../create-db-and-table-with-db-browser.md | 2 +- docs/tutorial/fastapi/tests.md | 2 +- docs/tutorial/index.md | 4 ++-- docs/tutorial/insert.md | 2 +- docs/tutorial/many-to-many/create-data.md | 2 +- docs/tutorial/one.md | 2 +- .../relationship-attributes/back-populates.md | 2 +- .../relationship-attributes/read-relationships.md | 2 +- docs/tutorial/select.md | 4 ++-- docs/tutorial/where.md | 4 ++-- .../annotations/en/tutorial002.md | 2 +- .../tutorial/insert/annotations/en/tutorial003.md | 2 +- .../tutorial/update/annotations/en/tutorial004.md | 2 +- sqlmodel/default.py | 4 ++-- tests/test_validation.py | 2 +- 19 files changed, 29 insertions(+), 29 deletions(-) diff --git a/docs/help.md b/docs/help.md index d0d2308de2..7e378c50b4 100644 --- a/docs/help.md +++ b/docs/help.md @@ -147,7 +147,7 @@ Here's what to have in mind and how to review a pull request: * Don't worry too much about things like commit message styles, I will squash and merge customizing the commit manually. -* Also don't worry about style rules, there are already automatized tools checking that. +* Also don't worry about style rules, there are already automated tools checking that. And if there's any other style or consistency need, I'll ask directly for that, or I'll add commits on top with the needed changes. diff --git a/docs/tutorial/automatic-id-none-refresh.md b/docs/tutorial/automatic-id-none-refresh.md index bbf74dd307..d41cd14e91 100644 --- a/docs/tutorial/automatic-id-none-refresh.md +++ b/docs/tutorial/automatic-id-none-refresh.md @@ -36,7 +36,7 @@ When we create a new `Hero` instance, we don't set the `id`: {!./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py[ln:23-26]!} -# Code below ommitted 👇 +# Code below omitted 👇 ```
@@ -125,7 +125,7 @@ We can verify by creating a session using a `with` block and adding the objects. {!./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py[ln:23-41]!} -# Code below ommitted 👇 +# Code below omitted 👇 ```
@@ -238,7 +238,7 @@ To confirm and understand how this **automatic expiration and refresh** of data {!./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py[ln:33-58]!} -# Code below ommitted 👇 +# Code below omitted 👇 ```
@@ -271,7 +271,7 @@ Let's see how it works: ```console $ python app.py -// Output above ommitted 👆 +// Output above omitted 👆 // After committing, the objects are expired and have no values After committing the session @@ -335,7 +335,7 @@ You can do that too with `session.refresh(object)`: {!./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py[ln:33-67]!} -# Code below ommitted 👇 +# Code below omitted 👇 ```
@@ -362,7 +362,7 @@ Here's how the output would look like: ```console $ python app.py -// Output above ommitted 👆 +// Output above omitted 👆 // The first refresh INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age @@ -427,7 +427,7 @@ And the output shows again the same data: ```console $ python app.py -// Output above ommitted 👆 +// Output above omitted 👆 // By finishing the with block, the Session is closed, including a rollback of any pending transaction that could have been there and was not committed INFO Engine ROLLBACK diff --git a/docs/tutorial/code-structure.md b/docs/tutorial/code-structure.md index 59a9e4bd9a..502c8bf958 100644 --- a/docs/tutorial/code-structure.md +++ b/docs/tutorial/code-structure.md @@ -168,7 +168,7 @@ Let's assume that now the file structure is: ### Circular Imports and Type Annotations -The problem with circular imports is that Python can't resolve them at *runtime*. +The problem with circular imports is that Python can't resolve them at *runtime*. But when using Python **type annotations** it's very common to need to declare the type of some variables with classes imported from other files. diff --git a/docs/tutorial/connect/create-connected-tables.md b/docs/tutorial/connect/create-connected-tables.md index 452c904ebe..14a310f59d 100644 --- a/docs/tutorial/connect/create-connected-tables.md +++ b/docs/tutorial/connect/create-connected-tables.md @@ -106,7 +106,7 @@ This is the same model we have been using up to now, we are just adding the new Most of that should look familiar: -The column will be named `team_id`. It will be an integer, and it could be `NULL` in the database (or `None` in Python), becase there could be some heroes that don't belong to any team. +The column will be named `team_id`. It will be an integer, and it could be `NULL` in the database (or `None` in Python), because there could be some heroes that don't belong to any team. We add a default of `None` to the `Field()` so we don't have to explicitly pass `team_id=None` when creating a hero. diff --git a/docs/tutorial/create-db-and-table-with-db-browser.md b/docs/tutorial/create-db-and-table-with-db-browser.md index a1bb394024..4437f15a6d 100644 --- a/docs/tutorial/create-db-and-table-with-db-browser.md +++ b/docs/tutorial/create-db-and-table-with-db-browser.md @@ -164,6 +164,6 @@ Of course, you can also go and take a full SQL course or read a book about SQL, We saw how to interact with SQLite databases in files using **DB Browser for SQLite** in a visual user interface. -We also saw how to use it to write some SQL directly to the SQLite database. This will be useful to verify the data in the database is looking correclty, to debug, etc. +We also saw how to use it to write some SQL directly to the SQLite database. This will be useful to verify the data in the database is looking correctly, to debug, etc. In the next chapters we will start using **SQLModel** to interact with the database, and we will continue to use **DB Browser for SQLite** at the same time to look at the database underneath. 🔍 diff --git a/docs/tutorial/fastapi/tests.md b/docs/tutorial/fastapi/tests.md index f817a883a1..cc6ad65c6f 100644 --- a/docs/tutorial/fastapi/tests.md +++ b/docs/tutorial/fastapi/tests.md @@ -82,7 +82,7 @@ But now, we need to deal with a bit of logistics and details we are not paying a This test looks fine, but there's a problem. -If we run it, it will use the same **production database** that we are using to store our very important **heroes**, and we will end up adding unnecesary data to it, or even worse, in future tests we could end up removing production data. +If we run it, it will use the same **production database** that we are using to store our very important **heroes**, and we will end up adding unnecessary data to it, or even worse, in future tests we could end up removing production data. So, we should use an independent **testing database**, just for the tests. diff --git a/docs/tutorial/index.md b/docs/tutorial/index.md index 33cf6226c4..513d4d74a6 100644 --- a/docs/tutorial/index.md +++ b/docs/tutorial/index.md @@ -139,7 +139,7 @@ Here are the commands you could use: // Remember that you might need to use python3.9 or similar 💡 // Create the virtual environment using the module "venv" $ python3 -m venv env - // ...here it creates the virtual enviroment in the directory "env" + // ...here it creates the virtual environment in the directory "env" // Activate the virtual environment $ source ./env/bin/activate // Verify that the virtual environment is active @@ -161,7 +161,7 @@ Here are the commands you could use: ```console // Create the virtual environment using the module "venv" # >$ python3 -m venv env - // ...here it creates the virtual enviroment in the directory "env" + // ...here it creates the virtual environment in the directory "env" // Activate the virtual environment # >$ .\env\Scripts\Activate.ps1 // Verify that the virtual environment is active diff --git a/docs/tutorial/insert.md b/docs/tutorial/insert.md index 5947e1e5dc..ecf87adbad 100644 --- a/docs/tutorial/insert.md +++ b/docs/tutorial/insert.md @@ -171,7 +171,7 @@ The first step is to import the `Session` class: ```Python hl_lines="3" {!./docs_src/tutorial/insert/tutorial001.py[ln:1-3]!} -# Code below ommitted 👇 +# Code below omitted 👇 ```
diff --git a/docs/tutorial/many-to-many/create-data.md b/docs/tutorial/many-to-many/create-data.md index 22afb7ce7e..2a51f5acae 100644 --- a/docs/tutorial/many-to-many/create-data.md +++ b/docs/tutorial/many-to-many/create-data.md @@ -179,4 +179,4 @@ INFO Engine ROLLBACK ## Recap -After setting up the model link, using it with **relationship attributes** is fairly straighforward, just Python objects. ✨ +After setting up the model link, using it with **relationship attributes** is fairly straightforward, just Python objects. ✨ diff --git a/docs/tutorial/one.md b/docs/tutorial/one.md index 3b60653ed9..f06343f67f 100644 --- a/docs/tutorial/one.md +++ b/docs/tutorial/one.md @@ -12,7 +12,7 @@ Let's see the utilities to read a single row. ## Continue From Previous Code -We'll continue with the same examples we have been using in the previous chapters to create and select data and we'll keep udpating them. +We'll continue with the same examples we have been using in the previous chapters to create and select data and we'll keep updating them.
👀 Full file preview diff --git a/docs/tutorial/relationship-attributes/back-populates.md b/docs/tutorial/relationship-attributes/back-populates.md index 86a4c2a70a..27129a066c 100644 --- a/docs/tutorial/relationship-attributes/back-populates.md +++ b/docs/tutorial/relationship-attributes/back-populates.md @@ -123,7 +123,7 @@ Now let's update **Spider-Boy**, removing him from the team by setting `hero_spi
-The first important thing is, we *haven't commited* the hero yet, so accessing the list of heroes would not trigger an automatic refresh. +The first important thing is, we *haven't committed* the hero yet, so accessing the list of heroes would not trigger an automatic refresh. But in our code, in this exact point in time, we already said that **Spider-Boy** is no longer part of the **Preventers**. 🔥 diff --git a/docs/tutorial/relationship-attributes/read-relationships.md b/docs/tutorial/relationship-attributes/read-relationships.md index 181b229589..c970b5eb06 100644 --- a/docs/tutorial/relationship-attributes/read-relationships.md +++ b/docs/tutorial/relationship-attributes/read-relationships.md @@ -52,7 +52,7 @@ With what we have learned **up to now**, we could use a `select()` statement, th ## Get Relationship Team - New Way -But now that we have the **relationship attributes**, we can just access them, and **SQLModel** (actually SQLAlchemy) will go and fetch the correspoinding data from the database, and make it available in the attribute. ✨ +But now that we have the **relationship attributes**, we can just access them, and **SQLModel** (actually SQLAlchemy) will go and fetch the corresponding data from the database, and make it available in the attribute. ✨ So, the highlighted block above, has the same results as the block below: diff --git a/docs/tutorial/select.md b/docs/tutorial/select.md index fb638c1212..5de32db5a1 100644 --- a/docs/tutorial/select.md +++ b/docs/tutorial/select.md @@ -190,7 +190,7 @@ First we have to import `select` from `sqlmodel` at the top of the file: ```Python hl_lines="3" {!./docs_src/tutorial/select/tutorial001.py[ln:1-3]!} -# More code below ommitted 👇 +# More code below omitted 👇 ```
@@ -472,7 +472,7 @@ SQLAlchemy's own `Session` has a method `session.execute()`. It doesn't have a ` If you see SQLAlchemy tutorials, they will always use `session.execute()`. -**SQLModel**'s own `Session` inherits directly from SQLAlchemy's `Session`, and adds this additonal method `session.exec()`. Underneath, it uses the same `session.execute()`. +**SQLModel**'s own `Session` inherits directly from SQLAlchemy's `Session`, and adds this additional method `session.exec()`. Underneath, it uses the same `session.execute()`. But `session.exec()` does several **tricks** combined with the tricks in `session()` to give you the **best editor support**, with **autocompletion** and **inline errors** everywhere, even after getting data from a select. ✨ diff --git a/docs/tutorial/where.md b/docs/tutorial/where.md index ca85a4dd00..47f1b9b113 100644 --- a/docs/tutorial/where.md +++ b/docs/tutorial/where.md @@ -206,7 +206,7 @@ We care specially about the **select** statement: ## Filter Rows Using `WHERE` with **SQLModel** -Now, the same way that we add `WHERE` to a SQL statement to filter rows, we can add a `.where()` to a **SQLModel** `select()` statment to filter rows, which will filter the objects returned: +Now, the same way that we add `WHERE` to a SQL statement to filter rows, we can add a `.where()` to a **SQLModel** `select()` statement to filter rows, which will filter the objects returned: ```Python hl_lines="5" # Code above omitted 👆 @@ -748,7 +748,7 @@ FROM hero WHERE hero.age >= ? AND hero.age < ? INFO Engine [no key 0.00014s] (35, 40) -// The two heros printed +// The two heroes printed age=35 id=5 name='Black Lion' secret_name='Trevor Challa' age=36 id=6 name='Dr. Weird' secret_name='Steve Weird' diff --git a/docs_src/tutorial/automatic_id_none_refresh/annotations/en/tutorial002.md b/docs_src/tutorial/automatic_id_none_refresh/annotations/en/tutorial002.md index fd33fec778..8306d9b898 100644 --- a/docs_src/tutorial/automatic_id_none_refresh/annotations/en/tutorial002.md +++ b/docs_src/tutorial/automatic_id_none_refresh/annotations/en/tutorial002.md @@ -157,7 +157,7 @@ Hero 3: ``` -21. Print the line `"After commiting the session, show IDs"`. +21. Print the line `"After committing the session, show IDs"`. Generates the output: diff --git a/docs_src/tutorial/insert/annotations/en/tutorial003.md b/docs_src/tutorial/insert/annotations/en/tutorial003.md index 8236078567..6e364d407b 100644 --- a/docs_src/tutorial/insert/annotations/en/tutorial003.md +++ b/docs_src/tutorial/insert/annotations/en/tutorial003.md @@ -6,7 +6,7 @@ 3. Use a `with` block to create a `Session` using the `engine`. - The new **sesion** will be assigned to the variable `session`. + The new **session** will be assigned to the variable `session`. And it will be automatically closed when the `with` block is finished. diff --git a/docs_src/tutorial/update/annotations/en/tutorial004.md b/docs_src/tutorial/update/annotations/en/tutorial004.md index 55755cd88d..3fcf1040ec 100644 --- a/docs_src/tutorial/update/annotations/en/tutorial004.md +++ b/docs_src/tutorial/update/annotations/en/tutorial004.md @@ -132,7 +132,7 @@ !!! tip SQLAlchemy is still using the previous transaction, so it doesn't have to create a new one. -18. Print the first hero, now udpated. +18. Print the first hero, now updated. This generates the output: diff --git a/sqlmodel/default.py b/sqlmodel/default.py index bb44972e24..e8e37a5566 100644 --- a/sqlmodel/default.py +++ b/sqlmodel/default.py @@ -6,7 +6,7 @@ class _DefaultPlaceholder: You shouldn't use this class directly. It's used internally to recognize when a default value has been overwritten, even - if the overriden default value was truthy. + if the overridden default value was truthy. """ def __init__(self, value: Any): @@ -27,6 +27,6 @@ def Default(value: _TDefaultType) -> _TDefaultType: You shouldn't use this function directly. It's used internally to recognize when a default value has been overwritten, even - if the overriden default value was truthy. + if the overridden default value was truthy. """ return _DefaultPlaceholder(value) # type: ignore diff --git a/tests/test_validation.py b/tests/test_validation.py index a3ff6e39ba..ad60fcb945 100644 --- a/tests/test_validation.py +++ b/tests/test_validation.py @@ -7,7 +7,7 @@ def test_validation(clear_sqlmodel): - """Test validation of implicit and explict None values. + """Test validation of implicit and explicit None values. # For consistency with pydantic, validators are not to be called on # arguments that are not explicitly provided. From 2618538ac8946d6046d8f0502e898f9fe88a6767 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 10 May 2023 15:58:59 -0400 Subject: [PATCH 5/5] BF: need v2 of codespell action to pick up config from pyproject.toml --- .github/workflows/codespell.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml index 243ba8ce5f..99b3dec599 100644 --- a/.github/workflows/codespell.yml +++ b/.github/workflows/codespell.yml @@ -16,4 +16,4 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Codespell - uses: codespell-project/actions-codespell@v1 + uses: codespell-project/actions-codespell@v2