Compare commits

..
2 Commits
3 changed files with 117 additions and 1 deletions
+3 -1
View File
@@ -10,7 +10,7 @@ working across different projects via [VisualMode](https://www.visualmode.dev/).
For a steady stream of TILs, [sign up for my newsletter](https://visualmode.kit.com/newsletter). For a steady stream of TILs, [sign up for my newsletter](https://visualmode.kit.com/newsletter).
_1836 TILs and counting..._ _1838 TILs and counting..._
See some of the other learning resources I work on: See some of the other learning resources I work on:
@@ -472,6 +472,7 @@ If you've learned something here, support my efforts writing daily TILs by
### GitHub ### GitHub
- [Access Your GitHub Profile Photo](github/access-your-github-profile-photo.md) - [Access Your GitHub Profile Photo](github/access-your-github-profile-photo.md)
- [Create And Push To New Repo From CLI](github/create-and-push-to-new-repo-from-cli.md)
- [List PRs Awaiting Your Review](github/list-prs-awaiting-your-review.md) - [List PRs Awaiting Your Review](github/list-prs-awaiting-your-review.md)
- [Open A PR To An Unforked Repo](github/open-a-pr-to-an-unforked-repo.md) - [Open A PR To An Unforked Repo](github/open-a-pr-to-an-unforked-repo.md)
- [Open File To Specific Line In Browser](github/open-file-to-specific-line-in-browser.md) - [Open File To Specific Line In Browser](github/open-file-to-specific-line-in-browser.md)
@@ -1113,6 +1114,7 @@ If you've learned something here, support my efforts writing daily TILs by
- [Store And Access Immutable Data In A Tuple](python/store-and-access-immutable-data-in-a-tuple.md) - [Store And Access Immutable Data In A Tuple](python/store-and-access-immutable-data-in-a-tuple.md)
- [Strictly Separate Positional And Keyword Arguments](python/strictly-separate-positional-and-keyword-arguments.md) - [Strictly Separate Positional And Keyword Arguments](python/strictly-separate-positional-and-keyword-arguments.md)
- [Test A Function With Pytest](python/test-a-function-with-pytest.md) - [Test A Function With Pytest](python/test-a-function-with-pytest.md)
- [Try Out The Latest Version Of Ruff](python/try-out-the-latest-version-of-ruff.md)
- [Turn Method Into Cached Property On Class Instance](python/turn-method-into-cached-property-on-class-instance.md) - [Turn Method Into Cached Property On Class Instance](python/turn-method-into-cached-property-on-class-instance.md)
- [Use pipx To Install End User Apps](python/use-pipx-to-install-end-user-apps.md) - [Use pipx To Install End User Apps](python/use-pipx-to-install-end-user-apps.md)
- [Use `__post_init__` For `dataclass` Validations](python/use-post-init-for-dataclass-validations.md) - [Use `__post_init__` For `dataclass` Validations](python/use-post-init-for-dataclass-validations.md)
@@ -0,0 +1,45 @@
# Create And Push To New Repo From CLI
I figured there must be a good way to create a new repo in GitHub using the `gh`
CLI based on a local git repo. I spend so much time in existing git projects
that already have GitHub repos that I haven't had the chance to figure this out.
Until now.
I just finished a first pass on a fresh project for [a GitHub profile
README](https://github.com/jbranchaud/jbranchaud). It was time to put it up on
GitHub and see if worked. Instead of going through the GitHub web UI to create
this new repo, I found the `gh repo create` subcommand. I then asked Claude what
flags I needed for my use case. The recommendation was as follows:
```bash
gh repo create --public --source=. --remote=origin --push
✓ Created repository jbranchaud/jbranchaud on github.com
https://github.com/jbranchaud/jbranchaud
✓ Added remote https://github.com/jbranchaud/jbranchaud.git
Enumerating objects: 11, done.
Counting objects: 100% (11/11), done.
Delta compression using up to 16 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (11/11), 4.21 KiB | 4.21 MiB/s, done.
Total 11 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
To https://github.com/jbranchaud/jbranchaud.git
* [new branch] HEAD -> main
branch 'main' set up to track 'origin/main' by rebasing.
✓ Pushed commits to https://github.com/jbranchaud/jbranchaud.git
```
This created the repo on GitHub for my authenticated profile (`jbranchaud`)
using the name of the current directory (`jbranchaud`). It then setup the
`origin` remote to point to that repo on GitHub. It then pushed the current
state of `main` up to the remote.
- `--public` configures the created repo to be a public, rather than private,
one.
- `--source=.` tells the command to run for the current directory (I ran this
from the root of this new project)
- `--remote=origin` tells it what the remote should be called, though `origin`
is the default, so this wasn't strictly necessary
- `--push` tells the command to push to the remote once it is created and
configured
See `gh repo create --help` for more details and examples.
@@ -0,0 +1,69 @@
# Try Out The Latest Version Of Ruff
I have [a Python project](https://github.com/jbranchaud/py-vmt) using
[`ruff`](https://github.com/astral-sh/ruff) pinned to version `0.15.20`.
```toml
[dependency-groups]
dev = [
"basedpyright>=1.39.9",
"freezegun>=1.5.5",
"pytest>=9.0.2",
"ruff>=0.15.20",
"types-dateparser>=1.3.0.20260211",
]
```
All source files are in alignment with the enabled `ruff` rules, so all checks
pass.
[Simon Willison just posted](https://simonwillison.net/2026/Jul/25/ruff/) about
a new version of `ruff` (`v0.16.0`) dropping that enables a TON of new rules. He
mentioned running it against some of his biggest projects and getting a bunch of
errors.
I was curious to see how my project would fare, so I ran the
[`uvx`](https://docs.astral.sh/uv/guides/tools/) command that Simon recommended
in his post.
```bash
uvx ruff@latest check .
I001 [*] Import block is un-sorted or un-formatted
--> defaults.py:1:1
|
1 | / from datetime import datetime, timezone
2 | | import time
| |___________^
|
help: Organize imports
|
1 + import time
2 | from datetime import datetime, timezone
- import time
3 |
|
UP017 [*] Use `datetime.UTC` alias
--> defaults.py:11:36
...
Found 48 errors.
[*] 41 fixable with the `--fix` option.
```
Even this small project of mine has 48 errors. Luckily 41 of them can be
automatically fixed by `ruff`.
It is the `@latest` tag that tells
[`uvx`](https://docs.astral.sh/uv/guides/tools/) to find and run the latest
version of `ruff` which currently happens to be `0.16.0`. I can also reliably
point to a specific version like so:
```bash
uvx ruff@0.15.14 check .
All checks passed!
```
Here is [a listing](https://github.com/astral-sh/ruff/tags) of all tagged `ruff`
versions.