64 lines
1.6 KiB
Markdown
64 lines
1.6 KiB
Markdown
# apify-shared
|
|
|
|
Shared utility package for use with Apify actors.
|
|
|
|
## Setup
|
|
|
|
```bash
|
|
uv sync
|
|
```
|
|
|
|
## Project structure
|
|
|
|
```
|
|
src/apify_shared/ # library source code
|
|
pyproject.toml # package metadata and dependencies
|
|
uv.lock # pinned dependency versions
|
|
.python-version # pinned Python version (3.12)
|
|
```
|
|
|
|
Add new modules under `src/apify_shared/` and re-export from `__init__.py` to expose them as part of the public API.
|
|
|
|
## Managing dependencies
|
|
|
|
```bash
|
|
uv add httpx # add a runtime dependency
|
|
uv add --dev pytest # add a dev-only dependency
|
|
uv remove httpx # remove a dependency
|
|
|
|
uv lock --upgrade # upgrade all dependencies to latest
|
|
uv lock --upgrade-package httpx # upgrade a single package
|
|
uv sync # install/update local venv from lock file
|
|
```
|
|
|
|
## Using as a dependency in another project
|
|
|
|
### From Gitea (recommended)
|
|
|
|
In the consuming project's `pyproject.toml`:
|
|
|
|
```toml
|
|
[project]
|
|
dependencies = ["apify-shared"]
|
|
|
|
[tool.uv.sources]
|
|
apify-shared = { git = "https://git.virteklabs.com/virtek-labs/apify-shared" }
|
|
```
|
|
|
|
Pin to a specific tag, branch, or commit:
|
|
|
|
```toml
|
|
apify-shared = { git = "https://git.virteklabs.com/virtek-labs/apify-shared", tag = "v0.1.0" }
|
|
apify-shared = { git = "https://git.virteklabs.com/virtek-labs/apify-shared", branch = "main" }
|
|
apify-shared = { git = "https://git.virteklabs.com/virtek-labs/apify-shared", rev = "abc123" }
|
|
```
|
|
|
|
### From a local path (development)
|
|
|
|
```toml
|
|
[tool.uv.sources]
|
|
apify-shared = { path = "../apify-shared", editable = true }
|
|
```
|
|
|
|
Then run `uv sync` in the consuming project.
|