📦 Package the GitLab API Wrapper Project Using Astral's uv
This issue tracks the work required to properly package our in-house GitLab API wrapper as a Python project using Astral's uv for modern dependency management and reproducible environments.
🎯 Goals:
- Package the project into a proper Python module
- Use
uvto handle virtual environment creation, dependency resolution, and lockfile management - Enable easy local development, distribution, and CI/CD integration
✅ Tasks:
1. Project Structure
Ensure the codebase follows a standard layout:
gitlab_api_wrapper/
├── src/
│ └── gitlab_wrapper/ # Main package
├── tests/ # Unit tests
├── pyproject.toml # Build config
└── README.md
2. Add pyproject.toml
Configure the project for packaging with PEP 621. Include metadata, dependencies, and build system.
[project]
name = "gitlab-api-wrapper"
version = "0.1.0"
description = "In-house GitLab API wrapper"
authors = [{name = "Your Org", email = "[email protected]"}]
dependencies = [
"python-gitlab",
# other deps
]
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
3. Initialize uv
- Run
uv initto generate theuvvirtual environment and lockfile - Ensure
.gitignoreincludes.venv/anduv.lock
uv init
uv pip install -e .
uv pip install pytest # or other dev/test tools
uv venv .venv
4. Testing and Linting
- Add basic
pytestsetup - DO formatting and linting with
ruff
5. CI/CD Compatibility
- Update GitLab CI jobs to use
uvfor setting up environment (if applicable) - Replace existing
piporvenvsteps in.gitlab-ci.ymlwithuv
📝 Notes:
-
uvis significantly faster and more deterministic thanpip + venv, with lockfile support and zero external dependencies - This will make the project easier to install and maintain for both internal developers and automation
📌 References:
Edited by Ranjith Raj