|
281 | 281 | :term:`Python Package Index` (:term:`PyPI`). In general, this could lead to |
282 | 282 | source code, documentation, task managers, :abbr:`etc (et cetera)`. |
283 | 283 |
|
| 284 | +.. error:: |
| 285 | + If you receive the error in uv: :samp:`error: No \`project\` table found in: |
| 286 | + \`{/PATH/TO/}pyproject.toml\``, you probably haven’t defined a ``[project]`` |
| 287 | + section. This can occur in repositories that only use the |
| 288 | + :file:`pyproject.toml` file to configure tools such as Black and Ruff, but |
| 289 | + do not define the project itself. |
| 290 | + |
| 291 | + To resolve the issue, you can insert a ``[project]`` section that must |
| 292 | + contain at least ``name`` and ``version``. Alternatively, you can also use |
| 293 | + ``uv run`` with the ``--no-project`` option. |
| 294 | + |
284 | 295 | .. seealso:: |
285 | 296 | * `Declaring project metadata |
286 | 297 | <https://packaging.python.org/en/latest/specifications/pyproject-toml/#declaring-project-metadata-the-project-table>`_ |
@@ -518,6 +529,24 @@ structure for packages. |
518 | 529 | └── mypack |
519 | 530 | └── __init__.py |
520 | 531 |
|
| 532 | +file:`.python-version` |
| 533 | + specifies which Python version should be used for developing the project. |
| 534 | + |
| 535 | + .. error:: |
| 536 | + If you receive the following error message: error: :samp:`error: The |
| 537 | + Python request from \`.python-version\` resolved to Python {U.V.W}, which |
| 538 | + is incompatible with the project's Python requirement: \`>={X.Y}\`. Use |
| 539 | + \`uv python pin\` to update the \`.python-version\` file to a compatible |
| 540 | + version.`, this indicates a conflict between the version specified in the |
| 541 | + :file:`.python-version` file and the ``requires-python`` specification in |
| 542 | + the :file:`pyproject.toml` file. You now have three different options: |
| 543 | + |
| 544 | + * Update your :file:`.python-version` file with :samp:`uv python pin |
| 545 | + {X.Y.Z}`. |
| 546 | + * Override the Python version for a single command with :samp:`uv run |
| 547 | + --python {X.Y} {COMMAND}`. |
| 548 | + * Update ``requires-python``. |
| 549 | + |
521 | 550 | :file:`mypack/pyproject.toml` |
522 | 551 | The file :file:`pyproject.toml` contains a ``scripts`` entry point |
523 | 552 | ``mypack:main``: |
@@ -594,89 +623,66 @@ where :file:`pyproject.toml` is located: |
594 | 623 | other hand only for chips with the x86 instruction set and a 64-bit |
595 | 624 | architecture |
596 | 625 |
|
| 626 | + .. seealso:: |
| 627 | + * :pep:`427` |
| 628 | + |
597 | 629 | :file:`mypack-0.1.0.tar.gz` |
598 | | - is a :term:`source distribution`. |
| 630 | + is a :term:`source distribution` |
599 | 631 |
|
600 | 632 | .. seealso:: |
601 | | - For more information on ``sdist``, see `Core metadata specifications |
602 | | - <https://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata>`_ |
603 | | - and `PyPA specifications |
604 | | - <https://packaging.python.org/en/latest/specifications/>`_. |
| 633 | + * `Core metadata specifications |
| 634 | + <https://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata>`_ |
| 635 | + * `PyPA specifications |
| 636 | + <https://packaging.python.org/en/latest/specifications/>`_ |
605 | 637 |
|
606 | 638 | Testing |
607 | 639 | ------- |
608 | 640 |
|
609 | | -.. tab:: Linux/macOS |
610 | | - |
611 | | - .. code-block:: console |
612 | | -
|
613 | | - $ mkdir test_env |
614 | | - $ cd test_env |
615 | | - $ python3 -m venv .venv |
616 | | - $ . .venv/bin/activate |
617 | | - $ python -m pip install dist/dataprep-0.1.0-cp313-cp313-macosx_13_0_arm64.whl |
618 | | - Processing ./dist/dataprep-0.1.0-cp313-cp313-macosx_13_0_arm64.whl |
619 | | - Collecting Cython (from dataprep==0.1.0) |
620 | | - Using cached Cython-3.0.11-py2.py3-none-any.whl.metadata (3.2 kB) |
621 | | - … |
622 | | - Successfully installed Cython-3.0.11 dataprep-0.1.0 numpy-2.1.2 pandas-2.2.3 python-dateutil-2.9.0.post0 pytz-2024.2 six-1.16.0 tzdata-2024.2 |
623 | | -
|
624 | | -.. tab:: Windows |
625 | | - |
626 | | - .. code-block:: console |
627 | | -
|
628 | | - > mkdir test_env |
629 | | - > cd test_env |
630 | | - > python -m venv .venv |
631 | | - > .venv\Scripts\activate.bat |
632 | | - > python -m pip install dist/dataprep-0.1.0-cp313-cp313-win_amd64.whl |
633 | | - Processing ./dist/dataprep-0.1.0-cp313-cp313-win_amd64.whl |
634 | | - Collecting Cython (from dataprep==0.1.0) |
635 | | - Using cached Cython-3.0.11-cp313-cp313-win_amd64.whl.metadata (3.2 kB) |
636 | | - … |
637 | | - Successfully installed Cython-3.0.11 dataprep-0.1.0 numpy-2.1.2 pandas-2.2.3 python-dateutil-2.9.0.post0 pytz-2024.2 six-1.16.0 tzdata-2024.2 |
638 | | -
|
639 | 641 | You can then check the :term:`Wheel` file with: |
640 | 642 |
|
641 | 643 | .. code-block:: console |
642 | 644 |
|
643 | | - $ mkdir test_env |
644 | | - $ cd !$ |
645 | | - cd test_env |
646 | | - $ python3 -m venv .venv |
647 | | - $ . .venv/bin/activate |
648 | | - $ python -m pip install dist/dataprep-0.1.0-py3-none-any.whl |
649 | | - Processing ./dist/dataprep-0.1.0-py3-none-any.whl |
650 | | - Collecting pandas |
651 | | - Using cached pandas-1.3.4-cp39-cp39-macosx_10_9_x86_64.whl (11.6 MB) |
652 | | - … |
653 | | - Successfully installed dataprep-0.1.0 numpy-1.21.4 pandas-1.3.4 python-dateutil-2.8.2 pytz-2021.3 six-1.16.0 |
654 | | -
|
655 | | -Then you can check the wheel with: |
656 | | - |
657 | | -.. code-block:: console |
658 | | -
|
659 | | - $ python -m pip install check-wheel-contents |
660 | | - $ check-wheel-contents dist/*.whl |
661 | | - dist/dataprep-0.1.0-py3-none-any.whl: OK |
| 645 | + $ uv add --dev check-wheel-contents |
| 646 | + Resolved 17 packages in 8ms |
| 647 | + Built mypack @ file:///Users/veit/sandbox/mypack |
| 648 | + Prepared 1 package in 442ms |
| 649 | + Uninstalled 1 package in 0.89ms |
| 650 | + Installed 10 packages in 5ms |
| 651 | + + annotated-types==0.7.0 |
| 652 | + + attrs==24.2.0 |
| 653 | + + check-wheel-contents==0.6.0 |
| 654 | + + click==8.1.7 |
| 655 | + ~ mypack==0.1.0 (from file:///Users/veit/sandbox/mypack) |
| 656 | + + packaging==24.1 |
| 657 | + + pydantic==2.9.2 |
| 658 | + + pydantic-core==2.23.4 |
| 659 | + + typing-extensions==4.12.2 |
| 660 | + + wheel-filename==1.4.1 |
| 661 | + $ uv run check-wheel-contents dist/*.whl |
| 662 | + dist/dataprep-0.1.0-py3-none-any.whl: OK |
662 | 663 |
|
663 | 664 | Alternatively, you can also install the package in a new project, for example in |
664 | 665 | :samp:`myapp`: |
665 | 666 |
|
666 | 667 | .. code-block:: console |
667 | 668 |
|
668 | | - $ python -m pip install dist/dataprep-0.1.0-py3-none-any.whl |
669 | | - Processing ./dist/dataprep-0.1-py3-none-any.whl |
670 | | - Collecting pandas |
671 | | - … |
672 | | - Installing collected packages: numpy, pytz, six, python-dateutil, pandas, dataprep |
673 | | - Successfully installed dataprep-0.1 numpy-1.21.4 pandas-1.3.4 python-dateutil-2.8.2 pytz-2021.3 six-1.16.0 |
| 669 | + $ uv init --app myapp |
| 670 | + $ cd myapp |
| 671 | + $ uv add ../mypack/dist/mypack-0.1.0-py3-none-any.whl |
| 672 | + Resolved 8 packages in 130ms |
| 673 | + Installed 1 package in 3ms |
| 674 | + + mypack==0.1.0 (from file:///Users/veit/sandbox/mypack/dist/mypack-0.1.0-py3-none-any.whl) |
674 | 675 |
|
675 | | -You can then call Python and import your ``loaders`` module: |
| 676 | +You can then call ``mypack`` with ``uv run``: |
676 | 677 |
|
677 | | -.. code-block:: python |
| 678 | +.. code-block:: console |
| 679 | +
|
| 680 | + $ uv run mypack |
| 681 | + Hello from mypack! |
678 | 682 |
|
679 | | - from dataprep import loaders |
| 683 | +.. seealso:: |
| 684 | + * `Troubleshooting build failures |
| 685 | + <https://docs.astral.sh/uv/reference/troubleshooting/build-failures/>`_ |
680 | 686 |
|
681 | 687 | .. note:: |
682 | 688 | There are still many instructions that include a step to call |
|
0 commit comments