* 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).
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).
> 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
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.