Skip to content

Commit

Permalink
Switch from pipenv to uv
Browse files Browse the repository at this point in the history
* Remove pipenv
* Add pre-commit-uv
* Add CI/CD-Pipelines
* Add dependency bot
* Update security
  • Loading branch information
veit committed Oct 22, 2024
1 parent 705f923 commit 4ac6f03
Show file tree
Hide file tree
Showing 52 changed files with 690 additions and 975 deletions.
2 changes: 1 addition & 1 deletion docs/clean-prep/bulwark.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"## 1. Installation\n",
"\n",
"``` console\n",
"$ pipenv install bulwark\n",
"$ uv add bulwark\n",
"Installing bulwark…\n",
"Adding bulwark to Pipfile's [packages]…\n",
"✔ Installation Succeeded\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/clean-prep/string-matching.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"Alternatively, you can install the two libraries with other package managers, for example\n",
"\n",
"``` bash\n",
"$ pipenv install fuzzywuzzy[speedup]\n",
"$ uv add fuzzywuzzy[speedup]\n",
"```"
]
},
Expand Down
1 change: 0 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@
),
"sphinx": ("https://www.sphinx-doc.org/en/master", None),
"nbsphinx": ("https://nbsphinx.readthedocs.io/en/0.4.2", None),
"pipenv": ("https://pipenv.pypa.io/en/latest", None),
"spack": ("https://spack-tutorial.readthedocs.io/en/latest", None),
"ipyparallel": ("https://ipyparallel.readthedocs.io/en/latest", None),
"bokeh": ("https://docs.bokeh.org/en/latest", None),
Expand Down
2 changes: 1 addition & 1 deletion docs/data-processing/apis/fastapi/example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Run the server with:

.. code-block:: console
$ pipenv run uvicorn main:app --reload
$ uv run uvicorn main:app --reload
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO: Started reloader process [89155] using statreload
INFO: Started server process [89164]
Expand Down
8 changes: 4 additions & 4 deletions docs/data-processing/apis/fastapi/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Requirements

.. code-block:: console
$ pipenv install fastapi
$ uv add fastapi
Adding fastapi to Pipfile's [packages]…
✔ Installation Succeeded
Locking [dev-packages] dependencies…
Expand All @@ -27,7 +27,7 @@ server, such as `uvicorn <http://www.uvicorn.org/>`_:

.. code-block:: console
$ pipenv install uvicorn
$ uv add uvicorn
Adding uvicorn to Pipfile's [packages]…
✔ Installation Succeeded
Locking [dev-packages] dependencies…
Expand Down Expand Up @@ -69,10 +69,10 @@ They can be installed, e.g. with:

.. code-block:: console
$ pipenv install fastapi[ujson]
$ uv add fastapi[ujson]
Alternatively you can install all of these with:

.. code-block:: console
$ pipenv install fastapi[all]
$ uv add fastapi[all]
8 changes: 4 additions & 4 deletions docs/data-processing/apis/grpc/example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ Generate the gRPC Code

.. code-block:: console
$ pipenv install grpcio grpcio-tools
$ pipenv run python -m grpc_tools.protoc --python_out=. --grpc_python_out=. accounts.proto
$ uv add grpcio grpcio-tools
$ uv run python -m grpc_tools.protoc --python_out=. --grpc_python_out=. accounts.proto
This generates two files:

Expand Down Expand Up @@ -88,11 +88,11 @@ Run client and server

.. code-block:: console
$ pipenv run python accounts_server.py
$ uv run python accounts_server.py
#. Starting the client from another terminal:

.. code-block:: console
$ pipenv run python accounts_client.py
$ uv run python accounts_client.py
Account created: tom
6 changes: 3 additions & 3 deletions docs/data-processing/apis/grpc/test.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ gRPC can be tested automatically with `pytest-grpc

.. code-block:: console
$ pipenv install pytest-grpc
$ uv add pytest-grpc
Installing pytest-grpc…
Adding pytest-grpc to Pipfile's [packages]…
✔ Installation Succeeded
Expand Down Expand Up @@ -48,13 +48,13 @@ gRPC can be tested automatically with `pytest-grpc

.. code-block:: console
$ pipenv run pytest --fixtures tests/
$ uv run pytest --fixtures tests/
or directly against the Python code:

.. code-block:: console
$ pipenv run pytest --fixtures tests/ --grpc-fake-server
$ uv run pytest --fixtures tests/ --grpc-fake-server
============================= test session starts ==============================
platform darwin -- Python 3.7.3, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /Users/veit/cusy/trn/Python4DataScience/docs/data/grpc
Expand Down
2 changes: 1 addition & 1 deletion docs/data-processing/httpx/install-example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"Alternatively, you can install httpx with other package managers, for example\n",
"\n",
"``` bash\n",
"$ pipenv install httpx\n",
"$ uv add httpx\n",
"```"
]
},
Expand Down
4 changes: 2 additions & 2 deletions docs/data-processing/intake/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Intake can be easily installed for your Jupyter kernel with:

.. code-block:: console
$ pipenv install intake
$ uv add intake
Create a catalog with sample data
---------------------------------
Expand All @@ -27,7 +27,7 @@ For the following examples we need some data sets that we create with:

.. code-block:: console
$ pipenv run intake example
$ uv run intake example
Creating example catalog...
Writing us_states.yml
Writing states_1.csv
Expand Down
2 changes: 1 addition & 1 deletion docs/data-processing/postgresql/ipython-sql.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ You can easily install ipython-sql in your Jupyter kernel with:

.. code-block:: console
$ pipenv install ipython-sql
$ uv add ipython-sql
First steps
-----------
Expand Down
2 changes: 1 addition & 1 deletion docs/data-processing/serialisation-formats/excel.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"source": [
"# Excel\n",
"\n",
"pandas also supports reading table data stored in Excel 2003 (and higher) files, either with the `ExcelFile` class or the `pandas.read_excel` function. Internally, these tools use the add-on packages [xlrd](https://xlrd.readthedocs.io/en/latest/) and [openpyxl](https://openpyxl.readthedocs.io/en/stable/) to read XLS and XLSX files respectively. These must be installed separately from pandas with pipenv.\n",
"pandas also supports reading table data stored in Excel 2003 (and higher) files, either with the `ExcelFile` class or the `pandas.read_excel` function. Internally, these tools use the add-on packages [xlrd](https://xlrd.readthedocs.io/en/latest/) and [openpyxl](https://openpyxl.readthedocs.io/en/stable/) to read XLS and XLSX files respectively. These must be installed separately from pandas with uv.\n",
"\n",
"To use `ExcelFile`, create an instance by passing a path to an xls or xlsx file:"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
" Alternatively, you can install BeautifulSoup with other package managers, for example\n",
"\n",
" ``` console\n",
" $ pipenv install beautifulsoup4\n",
" $ uv add beautifulsoup4\n",
" ```"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"Alternatively, you can install BeautifulSoup with other package managers, for example\n",
"\n",
"```console\n",
"$ pipenv install lxml beautifulsoup4 html5lib\n",
"$ uv add lxml beautifulsoup4 html5lib\n",
"```"
]
},
Expand Down
2 changes: 1 addition & 1 deletion docs/performance/asyncio-example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"You can install the package with\n",
"\n",
"``` bash\n",
"$ pipenv install nest-asyncio\n",
"$ uv add nest-asyncio\n",
"```\n",
"\n",
"You can then import it into your notebook and use it with:"
Expand Down
14 changes: 7 additions & 7 deletions docs/performance/dask.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"source": [
"## Scales from laptops to clusters\n",
"\n",
"Dask can be easily installed on a laptop with pipenv and expands the size of the datasets from *fits in memory* to *fits on disk*. Dask can also scale to a cluster of hundreds of machines. It is resilient, elastic, data-local and has low latency. For more information, see the [distributed scheduler](https://distributed.dask.org/en/latest/) documentation. This simple transition between a single machine and a cluster allows users to both start easily and grow as needed."
"Dask can be installed on a laptop with uv and expands the size of the datasets from *fits in memory* to *fits on disk*. Dask can also scale to a cluster of hundreds of machines. It is resilient, elastic, data-local and has low latency. For more information, see the [distributed scheduler](https://distributed.dask.org/en/latest/) documentation. This simple transition between a single machine and a cluster allows users to both start easily and grow as needed."
]
},
{
Expand All @@ -32,16 +32,16 @@
"You can install everything that is required for most common applications of Dask (arrays, dataframes, …). This installs both Dask and dependencies such as NumPy, Pandas, etc. that are required for various workloads:\n",
"\n",
"``` bash\n",
"$ pipenv install \"dask[complete]\"\n",
"$ uv add \"dask[complete]\"\n",
"```\n",
"\n",
"However, only individual subsets can be installed with:\n",
"\n",
"``` bash\n",
"$ pipenv install \"dask[array]\"\n",
"$ pipenv install \"dask[dataframe]\"\n",
"$ pipenv install \"dask[diagnostics]\"\n",
"$ pipenv install \"dask[distributed]\"\n",
"$ uv add \"dask[array]\"\n",
"$ uv add \"dask[dataframe]\"\n",
"$ uv add \"dask[diagnostics]\"\n",
"$ uv add \"dask[distributed]\"\n",
"```"
]
},
Expand Down Expand Up @@ -313,7 +313,7 @@
"For the following example, Dask must be installed with the `distributed` option, e.g.\n",
"\n",
"``` bash\n",
"$ pipenv install dask[distributed]\n",
"$ uv add dask[distributed]\n",
"```\n",
"</div>"
]
Expand Down
6 changes: 3 additions & 3 deletions docs/performance/ipython-profiler.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@
"Alternatively, you can install `line-profiler` with other package managers, for example\n",
"\n",
"``` bash\n",
"$ pipenv install line_profiler\n",
"$ uv add line_profiler\n",
"```\n",
"\n",
"Now you can load IPython with the `line_profiler` extension:"
Expand Down Expand Up @@ -336,7 +336,7 @@
"Alternatively you can install `memory-profiler` with other package managers, for example\n",
"\n",
"``` bash\n",
"$ pipenv install memory_profiler\n",
"$ uv add memory_profiler\n",
"```"
]
},
Expand Down Expand Up @@ -450,7 +450,7 @@
"It can be easily installed in the kernel with\n",
"\n",
"```\n",
"$ pipenv install py-heat-magic\n",
"$ uv add py-heat-magic\n",
"Installing py-heat-magic…\n",
"…```"
]
Expand Down
2 changes: 1 addition & 1 deletion docs/performance/scalene.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"Linux, MacOS and WSL:\n",
"\n",
"``` bash\n",
"$ pipenv install scalene\n",
"$ uv add scalene\n",
"```"
]
},
Expand Down
2 changes: 1 addition & 1 deletion docs/productive/dvc/fds.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ FastDS can be easily installed with:

.. code-block:: console
$ pipenv install fastds
$ uv add fastds
Introduction
------------
Expand Down
12 changes: 1 addition & 11 deletions docs/productive/dvc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Finally, external dependencies can also be specified with Pipenv.

.. code-block:: console
$ pipenv install dvc[ssh]
$ uv add dvc[ssh]
Alternatively, DVC can also be installed via other package managers:

Expand All @@ -75,16 +75,6 @@ Alternatively, DVC can also be installed via other package managers:
$ brew install iterative/homebrew-dvc/dvc
.. note::

The following example was created with a current DVC version (1.0.0a9),
which partly uses a different syntax than earlier versions. You can
currently (8th June 2020) only install this with pip:

.. code-block:: console
$ pipenv install dvc[all]==1.0.0a9
.. toctree::
:hidden:

Expand Down
2 changes: 1 addition & 1 deletion docs/productive/dvc/pipeline.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ The generated ``dvc.yaml`` file looks like this, for example:
stages:
split:
cmd: pipenv run python src/split.py data/data.xml
cmd: uv run python src/split.py data/data.xml
deps:
- data/data.xml
- src/split.py
Expand Down
21 changes: 11 additions & 10 deletions docs/productive/envs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@
..
.. SPDX-License-Identifier: BSD-3-Clause
Reproduce environments
======================
Python environments
===================

Reproducible and secure Python environments are difficult to ensure. With
the Python package manager :term:`pip`, the call would look like this:
The Python Basics tutorial already describes how you can create a Python
environment with :ref:`python-basics:venv`. However, creating this reproducibly
and securely is much more complex. With the Python package manager :term:`pip`,
it could look like this, for example:

.. code-block:: console
$ python -m pip install --no-deps --require-hashes ----only-binary=:all:
Dedicated environments (for example with :doc:`pipenv/index`, :term:`devpi` and
:doc:`Spack <spack/index>` simplify this if you save the file with their
specifications, for example ``Pipfile``, ``Pipfile.lock``, ``package-lock.json``
:abbr:`etc (et cetera)`. In this way, you and others can reproduce the
environments.
Dedicated environments (for example with :term:`uv` or :doc:`Spack
<spack/index>` simplify this if you save the files with the specifications, for
example with :file:`uv.lock` or or :file:`spack.lock`. This way you and others
can reproduce your environments.

.. toctree::
:hidden:

uv/index
spack/index
pipenv/index
Loading

0 comments on commit 4ac6f03

Please sign in to comment.