@@ -16,24 +16,22 @@ Follow](https://img.shields.io/twitter/follow/ojoshe)](https://x.com/ojoshe)
1616
1717** simple-modern-uv** is a minimal, modern ** Python project template** for new projects
1818(Python 3.11–3.13) based on [ ** uv** ] ( https://docs.astral.sh/uv/ ) . This template aims to
19- be a good base for serious work but also simple so it' s an easy option for any small
19+ be a good base for serious work but also simple so it’ s an easy option for any small
2020project, like an open source library or tool.
2121
2222## In a Hurry?
2323
24- > [ !TIP]
25- >
26- > You can try out this template right from your terminal.
27- > Try running:
28- >
29- > ``` shell
30- > uvx uvinit
31- > ` ` `
32- >
33- > The [uvinit](https://git.new/uvinit) tool now walks you through using this template.
34- >
35- > For more installation options, scroll down to [How to Use This
36- > Template](# how-to-use-this-template).
24+ You can try out this template right from your terminal.
25+ Try running:
26+
27+ ``` shell
28+ uvx uvinit
29+ ```
30+
31+ The [ uvinit] ( https://git.new/uvinit ) tool now walks you through using this template.
32+
33+ For more installation options, scroll down to [ How to Use This
34+ Template] ( #how-to-use-this-template ) .
3735
3836## Why a New Python Project Template?
3937
@@ -65,19 +63,19 @@ project, like an open source library or tool.
6563Apologies for the digression.
6664The point is that unfortunately, the accidents of history make it quite confusing to
6765learn best practices for setting up Python projects and dependencies.
68- But it shouldn' t have to be this difficult, especially since uv has now significantly
66+ But it shouldn’ t have to be this difficult, especially since uv has now significantly
6967simplified Python dev tooling.
7068
71- If you haven' t switched to uv, I can say I too was a little hesitant.
72- It' s often possible to switch dev tooling prematurely because a the new tool is shiny
69+ If you haven’ t switched to uv, I can say I too was a little hesitant.
70+ It’ s often possible to switch dev tooling prematurely because a the new tool is shiny
7371and exciting. But the advantages of uv have become too numerous to ignore.
7472[ This article] ( https://www.bitecode.dev/p/a-year-of-uv-pros-cons-and-should ) (Feb 2025)
7573has a good overview.
7674
7775This is the template I now use myself as I have been migrating from Poetry to uv for
78- several projects. It' s new but it' s working well.
76+ several projects. It’ s new but it’ s working well.
7977
80- ## But I Don' t Like Templates
78+ ## But I Don’ t Like Templates
8179
8280A lot of more senior engineers have justified hesitancy about templates.
8381Templates can be a real problem if they add mindless, unexamined complexity.
@@ -86,17 +84,17 @@ code you can adapt, instead of leaving you to figure out each tool choice and se
8684or blog posts (that are typically not maintained or updated).
8785
8886I think a good project template should be ** 3 Ms: minimalist, modern, and maintained** .
89- I looked at [other templates](# alternatives) but wanted one that was modern and " done
90- right" but *absolutely as simple as possible*. Few existing templates seem to be both
87+ I looked at [ other templates] ( #alternatives ) but wanted one that was modern and “ done
88+ right” but * absolutely as simple as possible* . Few existing templates seem to be both
9189simple and use the newest generation of tools and best practices.
9290
9391The template is short enough to read and understand in about 10 minutes.
94- It' s **only ~300 lines of code** so you can just look at it, use it, and change what you
92+ It’ s ** only ~ 300 lines of code** so you can just look at it, use it, and change what you
9593want without fuss.
9694
9795Because this template is minimal, you can always start with it and then pull in other
9896tools and features if you want them.
99- (In fact, even if you don' t like this template, you might want to use it as inspiration
97+ (In fact, even if you don’ t like this template, you might want to use it as inspiration
10098for your * own* Copier template, to take advantage of the Copier update workflow
10199discussed next.)
102100
@@ -114,17 +112,15 @@ tools, you can pull those improvements back into your project, much like a git m
114112You could even fork this repo yourself, then build your own forked template, and
115113maintain it yourself.
116114
117- > [!NOTE]
118- >
119- > If you're not familiar with Copier, take a moment to understand the
120- > [update feature](#updating-your-project-template).
121- > Then the options below will make sense.
122- > I put a few more thoughts on why a workflow like this is underrated is in
123- > [a Twitter thread](https://x.com/ojoshe/status/1896696860297019733).
115+ If you’re not familiar with Copier, take a moment to understand the
116+ [ update feature] ( #updating-your-project-template ) .
117+ Then the options below will make sense.
118+ I put a few more thoughts on why a workflow like this is underrated is in
119+ [ a Twitter thread] ( https://x.com/ojoshe/status/1896696860297019733 ) .
124120
125121## What Tools are In This Template?
126122
127- simple-modern-uv uses uses the tools I' ve come to think are best for new projects:
123+ simple-modern-uv uses uses the tools I’ ve come to think are best for new projects:
128124
129125- [ ** uv** ] ( https://github.com/astral-sh/uv ) for project setup and dependencies.
130126 There is also a simple makefile for dev workflows, but it simply is a convenience for
@@ -176,44 +172,34 @@ The template includes a few **starter docs** for you, collaborators, and users:
176172- [ publishing.md] ( https://github.com/jlevy/simple-modern-uv/blob/main/template/publishing.md )
177173 covers how to publish your project to PyPI.
178174
179- > [!TIP]
180- >
181- > If you haven't done it before, publishing a package to PyPI can be a bit confusing,
182- > especially because the
183- > [official Python docs](https://packaging.python.org/en/latest/guides/section-build-and-publish/)
184- > cover older and more complex workflows.
185- > Be sure to check ` publishing.md` for a modern and simple way that uses uv and GitHub
186- > actions.
187-
188- You can edit or delete these, but typically it's sufficient to just edit the README.md.
175+ If you haven’t done it before, publishing a package to PyPI can be a bit confusing,
176+ especially because the
177+ [ official Python docs] ( https://packaging.python.org/en/latest/guides/section-build-and-publish/ )
178+ cover older and more complex workflows.
179+ Be sure to check ` publishing.md ` for a modern and simple way that uses uv and GitHub
180+ actions.
181+
182+ You can edit or delete these, but typically it’s sufficient to just edit the README.md.
189183It helps to have the others in separate files so they get updated whenever you update
190184the template.
191185
192186## Agent Rules
193187
194- This template also includes a few **agent rules** for use with Cursor, Claude Code, and
195- OpenAI Codex.
196-
197- These cover a few specific rules for modern Python as well as remind agents to build,
198- lint, and run tests correctly using uv.
188+ Previously, this template included a few agent rules for use with Claude Code, Codex,
189+ Cursor, etc. But agent rules are changing so fast I have since removed them from this
190+ template and instead suggest adding your own or copying my recent rules from the
191+ [ Speculate] ( https://github.com/jlevy/speculate ) repo.
199192
200- The rules are in [.cursor/rules](template/.cursor/rules) and copied by the
201- [Makefile](template/Makefile) to
202- [` CLAUDE.md` ](https://docs.anthropic.com/en/docs/claude-code/memory) and
203- [` AGENTS.md` ](https://github.com/openai/codex#memory--project-docs) so that the same
204- rules work for Claude Code and OpenAI Codex.
205- (Of course you can adjust these as you wish.)
206-
207- ## What's the Best Python Type Checker?
193+ ## What’s the Best Python Type Checker?
208194
209195The choice of what tool to use for type checking deserves some explanation.
210196This seems to be a confusing area.
211197
212- Like many, I' d previously been using [Mypy](https://github.com/python/mypy), the OG type
198+ Like many, I’ d previously been using [ Mypy] ( https://github.com/python/mypy ) , the OG type
213199checker for Python. Mypy has since been enhanced with
214200[ BasedMypy] ( https://github.com/KotlinIsland/basedmypy ) .
215201
216- The other popular alternative is Microsoft' s
202+ The other popular alternative is Microsoft’ s
217203[ Pyright] ( https://github.com/microsoft/pyright ) .
218204And it has a newer extension and fork called
219205[ BasedPyright] ( https://github.com/DetachHead/basedpyright ) .
@@ -224,13 +210,13 @@ checker warnings align with your IDE warnings.
224210With the rises of AI-powered IDEs like Cursor and Windsurf that are VSCode extensions,
225211it seems like type checking support as a VSCode-compatible extension is essential.
226212
227- However, Microsoft' s popular
213+ However, Microsoft’ s popular
228214[ Mypy VSCode extension] ( https://marketplace.visualstudio.com/items?itemName=ms-python.mypy-type-checker )
229215is licensed only for use in VSCode (not other IDEs) and
230216[ sometimes] ( https://forum.cursor.com/t/pylance-server-fails-to-initialize-due-to-licensing-restriction/48548 )
231217[ refuses] ( https://forum.cursor.com/t/does-pylance-just-not-work-with-cursor-how-to-get-imports-in-quick-fix-menu/5747 )
232- to work in Cursor. [Cursor' s docs](https://docs.cursor.com/guides/languages/python)
233- suggest Mypy but don' t suggest a VSCode extension.
218+ to work in Cursor. [ Cursor’ s docs] ( https://docs.cursor.com/guides/languages/python )
219+ suggest Mypy but don’ t suggest a VSCode extension.
234220
235221After some experimentation, I found
236222[ BasedPyright] ( https://github.com/detachhead/basedpyright ) to be a credible improvement
@@ -243,24 +229,24 @@ So I have now switched this template to use BasedPyright.
243229
244230## What Does This Template Not Include?
245231
246- The template doesn' t have lots of options or try to use every bell and whistle.
232+ The template doesn’ t have lots of options or try to use every bell and whistle.
247233It just adds the above essentials.
248234
249235This template ** does not** handle:
250236
251237- Using Docker
252238
253- - Private or enterprise package repositories (but you can add this—see [uv' s docs on
239+ - Private or enterprise package repositories (but you can add this—see [ uv’ s docs on
254240 alternative
255241 indexes] ( https://docs.astral.sh/uv/guides/integration/alternative-indexes/ ) )
256242
257243- Building websites or docs, e.g. with [ mkdocs] ( https://github.com/mkdocs/mkdocs )
258244
259245- Using [ Conda] ( https://github.com/conda/conda ) for dependencies (but note many deep
260- learning libraries like PyTorch now support pip so this isn' t as necessary as often as
246+ learning libraries like PyTorch now support pip so this isn’ t as necessary as often as
261247 it used to be)
262248
263- - Using a code repo or build system that isn' t GitHub and GitHub Actions
249+ - Using a code repo or build system that isn’ t GitHub and GitHub Actions
264250
265251- Boilerplate docs or project management of any kind, like issue templates, contributing
266252 guidelines, code of conduct, etc.
@@ -274,13 +260,11 @@ references.
274260
275261## How to Use This Template
276262
277- > [!NOTE]
278- >
279- > By default this template uses MIT license.
280- > If you want a different license or are not publishing your project as open source,
281- > update ` license` in pyproject.yaml and the LICENSE file.
282- > If desired, you may delete the ` .github/workflows/publish.yml` file if you are not
283- > publishing to PyPI.
263+ By default this template uses MIT license.
264+ If you want a different license or are not publishing your project as open source,
265+ update ` license ` in pyproject.yaml and the LICENSE file.
266+ If desired, you may delete the ` .github/workflows/publish.yml ` file if you are not
267+ publishing to PyPI.
284268
285269The template can be used in three ways.
286270Option 1 is the quickest option with full flexibility.
@@ -289,14 +273,14 @@ Option 3 is handy if you prefer a GitHub template.
289273
290274### Option 1: Run ` uvx uvinit `
291275
292- I' ve now created a little tool, [uvinit](https://www.github.com/jlevy/uvinit) that
276+ I’ ve now created a little tool, [ uvinit] ( https://www.github.com/jlevy/uvinit ) that
293277copies this template for you and walks you through everything:
294278
295279``` shell
296280uvx uvinit
297281```
298282
299- It' s the same as running ` copier` and a few ` git` commands yourself, with a little more
283+ It’ s the same as running ` copier ` and a few ` git ` commands yourself, with a little more
300284guidance and less typing.
301285
302286### Option 2: Use ` copier ` and ` git ` Yourself
@@ -349,7 +333,7 @@ If you prefer you can click the **use this template** on
349333[ ** this repository** ] ( https://github.com/jlevy/simple-modern-uv-template ) , which is the
350334current output of this template.
351335
352- Go there and hit the " Use this template" button.
336+ Go there and hit the “ Use this template” button.
353337Once you have the code, search for ** ` changeme ` ** for all field names like project name,
354338author, etc. You want to do this to the ` .copier-answers.yml ` file as well.
355339You will also want to check the license/copyright.
@@ -377,8 +361,8 @@ There are a couple other good uv templates, especially
377361[ ** copier-uv** ] ( https://github.com/pawamoy/copier-uv ) you may wish to consider.
378362
379363This template takes a somewhat different philosophy.
380- I found existing templates to have machinery or files you often don' t need.
381- And it' s hard to maintain a complex template repo.
364+ I found existing templates to have machinery or files you often don’ t need.
365+ And it’ s hard to maintain a complex template repo.
382366This is intended instead to be a very simple template.
383367You can always add to it if you want.
384368
@@ -403,7 +387,7 @@ For [Conda](https://github.com/conda/conda) dependencies, also consider the newe
403387
404388## Contributing
405389
406- I' m new to uv, so please help me improve this!
390+ I’ m new to uv, so please help me improve this!
407391Please use the Discussions thread with any feedback or suggestions.
408392PRs welcome on [ this repository] ( https://github.com/jlevy/simple-modern-uv ) (not on the
409393GitHub template repo, which mirrors this one).
0 commit comments