### Setup Una Workspace and Sync Dependencies Source: https://una.rdrn.me/quickstart Sets up the Una workspace by generating a project structure with example libraries and applications, and then synchronizes project dependencies. ```shell uv run una create workspace uv sync ``` -------------------------------- ### Install uv Tool Source: https://una.rdrn.me/quickstart Installs the 'uv' tool, a dependency manager for Python projects, using a curl command. This is the first step in setting up the Una environment. ```shell curl -LsSf https://astral.sh/uv/install.sh | sh ``` -------------------------------- ### Build Application Wheel with Una Source: https://una.rdrn.me/quickstart Builds the application's wheel file using 'uvx' and 'pyproject-build', specifying 'uv' as the installer and outputting to the 'dist' directory. The `--wheel` parameter is mandatory. ```shell uvx --from build pyproject-build --installer=uv \ --outdir=dist --wheel apps/printer ``` -------------------------------- ### Create Dockerfile for Una Application Source: https://una.rdrn.me/quickstart A simple Dockerfile that copies the built wheel files from the 'dist' directory and installs them using pip. This prepares the application for containerization. ```dockerfile FROM python COPY dist dist RUN pip install dist/*.whl ``` -------------------------------- ### View Project Dependencies (Tree) Source: https://una.rdrn.me/quickstart Displays the file and directory structure of the project using the 'tree' command. This helps in understanding the generated project layout. ```shell tree ``` -------------------------------- ### Sync Project Dependencies with Una Source: https://una.rdrn.me/quickstart Ensures all imports are correctly added to `project.dependencies` and `tool.uv.sources` in each pyproject.toml file. This command is crucial for maintaining dependency consistency. ```shell uv run una sync ``` -------------------------------- ### View Last Lines of pyproject.toml Source: https://una.rdrn.me/quickstart Shows the last few lines of the 'pyproject.toml' file for the 'apps/printer' directory using the 'tail' command. This is useful for inspecting changes made during dependency synchronization. ```shell tail apps/printer/pyproject.toml ``` -------------------------------- ### Initialize Una Workspace Source: https://una.rdrn.me/quickstart Initializes a new Una project workspace and adds a development dependency. This command creates the necessary project structure and configuration files. ```shell uv init unarepo cd unarepo uv add --dev una ``` -------------------------------- ### Install Built Package in Dockerfile Source: https://una.rdrn.me/packages This Dockerfile snippet shows how to install a built Python package from a `.whl` file. It copies the distribution files into the image and then uses `pip` to install the package, ensuring all dependencies are correctly set up in the container environment. ```dockerfile FROM python COPY dist dist RUN pip install dist/*.whl ``` -------------------------------- ### Build Package with uvx CLI Source: https://una.rdrn.me/packages This command uses the `uvx` tool to build a Python package. The `--from build` flag indicates the build process, `pyproject-build` specifies the build system, and `--installer uv` configures the installer to be uv. ```bash uvx --from build pyproject-build --installer uv ``` -------------------------------- ### Build and Run Docker Container Source: https://una.rdrn.me/quickstart Builds a Docker image tagged 'unarepo-printer' and then runs a container from it, executing a Python command to run the application. This demonstrates deploying and running the Una application in a container. ```shell docker build --tag unarepo-printer . docker run --rm -it unarepo-printer \ python -c 'from unarepo.printer import run; run()' ``` -------------------------------- ### View Distribution Contents Source: https://una.rdrn.me/quickstart Lists the contents of the 'dist' directory using the 'ls' command. This command is used to verify that the application wheel file has been successfully built and placed in the distribution directory. ```shell ls dist/ ``` -------------------------------- ### Configure Pyright for Type Checking Source: https://una.rdrn.me/types-tests Configure Pyright for type checking by adding the provided TOML snippet to each package's `pyproject.toml` file. This specifies the virtual environment path, name, Python version, and enables strict type checking for all Python files. After configuration, run `uv run pyright` in the project root. ```toml [tool.pyright] venvPath = "../.." venv = ".venv" pythonVersion = "3.11" strict = ["**/*.py"] ``` -------------------------------- ### Define Workspace Members in pyproject.toml Source: https://una.rdrn.me/packages This snippet shows how to configure the `pyproject.toml` file to specify workspace members for uv. The `members` array defines glob patterns for directories that should be included as part of the workspace, allowing for flexible project structure organization. ```toml # /pyproject.toml [tool.uv] dev-dependencies = [] [tool.uv.workspace] members = ["apps/*", "libs/*"] # this could also be something like below # if you don't want to separate apps and libs # members = ["packages/*"] ``` -------------------------------- ### Configure Pytest for Running Tests Source: https://una.rdrn.me/types-tests Configure Pytest by adding the provided TOML snippet to the root `pyproject.toml` file. This sets the Python path and test paths to include all subdirectories within 'apps' and 'libs', enabling Pytest to discover and run tests effectively. The `addopts` field can be used for additional command-line options. ```toml [tool.pytest.ini_options] pythonpath = [ "apps/*", "libs/*" ] testpaths = [ "apps/*", "libs/*", ] addopts = "" ``` -------------------------------- ### Declare Internal Dependency in App pyproject.toml Source: https://una.rdrn.me/packages This snippet demonstrates how to declare an internal dependency in an application's `pyproject.toml`. By specifying the dependency in the `[project].dependencies` and configuring the `[tool.uv.sources]` with `workspace = true`, Una and uv can locate and manage local packages within the workspace. ```toml # /apps/server/pyproject.toml [project] dependencies = ["greeter"] [tool.uv.sources] greeter = { workspace = true } [build-system] requires = ["hatchling", "hatch-una"] build-backend = "hatchling.build" [tool.hatch.build.hooks.una-build] [tool.hatch.metadata.hooks.una-meta] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.