]> xn--ix-yja.es Git - alex.git/commitdiff
Update stuff to use uv
authoralex <alex@pdp7.net>
Mon, 17 Feb 2025 19:39:00 +0000 (20:39 +0100)
committeralexpdp7 <alex@corcoles.net>
Mon, 17 Feb 2025 19:40:04 +0000 (20:40 +0100)
programming/python/creating_nice_python_cli_tools.md
programming/python/project_setup.md

index 53b3f51b4c6a09e12ec15893aca53a5e60e793c0..b192da1a578b5c5c2a36a9bafc40428a32dc7927 100644 (file)
@@ -3,8 +3,8 @@ Following this advice can make your tools easy to install by others, pleasant to
 * Use [my suggestions for setting up Python projects](project_setup.md), particularly:
   * Provide instructions for installing your tool using [pipx](https://github.com/pypa/pipx).
     Using pipx, people can install and upgrade your script using a simple command that requires no administrative privileges (but it requires having Python and pipx installed).
-  * As you are using [poetry](https://python-poetry.org/), following the indications above:
-    * Use [Poetry's support for specifying scripts](https://python-poetry.org/docs/pyproject/#scripts), so when installing your tool via pipx or other means, your scripts are added to the user's path.
+  * As you are using [uv](https://docs.astral.sh/uv/), following the indications above:
+    * Use [entry points](https://docs.astral.sh/uv/concepts/projects/config/#entry-points), so when installing your tool via pipx or other means, your scripts are added to the user's path.
     * Dependencies you define will be installed automatically along with your application.
       This reduces the effort users need to use your application if you need third-party libraries.
       However, I would still advise to avoid unnecessary dependencies (for simple HTTP requests you can use the base library. If you do complex requests, then using a third-party library might be much simpler).
index 57c26c559a24c8a3ca19b83dfc2ddcc9c60dfe91..10beb94844bb166fb34ba14045f37eaa595c7231 100644 (file)
@@ -8,26 +8,19 @@ Pipx is a tool that installs Python packages to your user environment. It create
 
 Pipx is useful for two purposes:
 
-* To install tools such as poetry
+* To install tools such as uv
 * To let other users install your software easily
 
-# Use Poetry
-
-> [!NOTE]
-> I have been using [rye](https://rye.astral.sh/) recently.
-> Not enough to recommend it unconditionally over Poetry, but I am liking it so far.
-> Consider testing it.
-> It uses [Python redistributable builds](https://github.com/indygreg/python-build-standalone) to manage Python versions, so you can choose to use more modern Python versions.
+# Use uv
 
 When using third-party dependencies in your Python code, it is highly interesting to avoid installing any project-specific dependency outside the project.
 
 To achieve that, traditionally virtualenvs are used; those are miniature Python installations where you can install any library you want. Virtualenvs need to be explicitly activated to be used, so it is easy to have a virtualenv for each Python project you are working on.
 
-Poetry is a tool that leverages virtualenvs to manage a project's dependencies, managing virtualenvs automatically.
-
-There are many similar tools such as pipenv and there are many multiple ways to specify a project's dependencies (`setup.py`, `requirements.txt`, etc.); Poetry provides a convenient way to do everything.
+uv is a tool that leverages virtualenvs to manage a project's dependencies, managing virtualenvs automatically.
+uv can also manage Python distributions, downloading automatically Python versions other than the existing ones on your system.
 
-You can install poetry using pipx.
+There are many similar tools such as pipenv and there are many multiple ways to specify a project's dependencies (`setup.py`, `requirements.txt`, etc.); uv provides a convenient way to do everything.
 
 Consider reading [some brief notes about Python dependency management](dependency_handling.md).
 
@@ -62,13 +55,9 @@ Set up your version control so changes cannot be made to your main codeline with
 > Consider testing it.
 > It requires slightly less configuration and it comes with more lints.
 
-## Use Black
+## Use Ruff
 
-Use Black to format your code.
-
-## Use flake8
-
-Use `flake8` to gate changes. Use `flake8-black` to prevent committed code which does not follow Black style.
+Use Ruff to format and lint your code.
 
 # Version control
 
@@ -94,8 +83,6 @@ Even if you are not running your code using the latest versions of Python, try t
 
 Use continuous integration to run your tests in all supported versions of Python.
 
-This implies that development should be possible to do without using a specific version of Python, so pyenv or similar is not strictly needed.
-
 # Use ipython and ipdb
 
 Add ipython and ipdb as development dependencies.