Skip to content

Commit f808583

Browse files
authored
Migrate from socket-sdk-python to socketdev>=3.0.0 and switch to uv (#113)
* Migrate from socket-sdk-python to socketdev>=3.0.0 and switch to uv - Update pyproject.toml to use socketdev>=3.0.0,<4.0.0 instead of socket-sdk-python - Replace pip-tools with uv for dependency management - Update Makefile to use uv commands (uv pip compile, uv pip sync, etc.) - Update Dockerfile to install socketdev instead of socket-sdk-python - Update deployment scripts to reference socketdev - Update README to reflect uv usage - Regenerate all requirements files with uv - Add requirements-test.txt file - Update SOCKET_SDK_PATH references to point to ../socketdev - Version bump to 2.2.3 * Switch to uv.lock for dependency management - Replace requirements.txt files with uv.lock - Update Makefile to use 'uv sync' instead of pip-compile workflow - Simplify dependency management with 'uv lock' and 'uv sync --all-extras' - Update test and lint commands to use 'uv run' - Remove old requirements.txt, requirements-dev.txt, requirements-test.txt files - Update README documentation to reflect uv.lock workflow - Version bump to 2.2.4
1 parent a2d97ab commit f808583

File tree

11 files changed

+1424
-333
lines changed

11 files changed

+1424
-333
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ RUN for i in $(seq 1 10); do \
1818
sleep 30; \
1919
done && \
2020
if [ ! -z "$SDK_VERSION" ]; then \
21-
pip install --index-url ${PIP_INDEX_URL} --extra-index-url ${PIP_EXTRA_INDEX_URL} socket-sdk-python==${SDK_VERSION}; \
21+
pip install --index-url ${PIP_INDEX_URL} --extra-index-url ${PIP_EXTRA_INDEX_URL} socketdev==${SDK_VERSION}; \
2222
fi

Makefile

Lines changed: 22 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
.PHONY: setup compile-deps sync-deps clean test lint init-tools local-dev first-time-setup update-deps dev-setup sync-all first-time-local-setup
1+
.PHONY: setup sync clean test lint update-lock local-dev first-time-setup dev-setup sync-all first-time-local-setup
22

33
# Environment variable for local SDK path (optional)
4-
SOCKET_SDK_PATH ?= ../socket-sdk-python
4+
SOCKET_SDK_PATH ?= ../socketdev
55

66
# Environment variable to control local development mode
77
USE_LOCAL_SDK ?= false
@@ -16,44 +16,37 @@ first-time-local-setup:
1616
$(MAKE) clean
1717
$(MAKE) USE_LOCAL_SDK=true dev-setup
1818

19-
# Update dependencies after changing pyproject.toml
20-
update-deps: compile-deps sync-deps
19+
# Update lock file after changing pyproject.toml
20+
update-lock:
21+
uv lock
2122

2223
# Setup for local development
2324
dev-setup: clean local-dev setup
2425

2526
# Sync all dependencies after pulling changes
26-
sync-all: sync-deps
27+
sync-all: sync
2728

2829
# === Implementation targets ===
2930

30-
# Creates virtual environment and installs pip-tools
31-
init-tools:
32-
python -m venv .venv
33-
. .venv/bin/activate && pip install pip-tools
34-
3531
# Installs dependencies needed for local development
36-
# Currently: socket-sdk-python from test PyPI or local path
37-
local-dev: init-tools
32+
# Currently: socketdev from test PyPI or local path
33+
local-dev:
3834
ifeq ($(USE_LOCAL_SDK),true)
39-
. .venv/bin/activate && pip install -e $(SOCKET_SDK_PATH)
35+
uv add --editable $(SOCKET_SDK_PATH)
4036
endif
4137

42-
# Creates/updates requirements.txt files with locked versions based on pyproject.toml
43-
compile-deps: local-dev
44-
. .venv/bin/activate && pip-compile --output-file=requirements.txt pyproject.toml
45-
. .venv/bin/activate && pip-compile --extra=dev --output-file=requirements-dev.txt pyproject.toml
46-
. .venv/bin/activate && pip-compile --extra=test --output-file=requirements-test.txt pyproject.toml
47-
48-
# Creates virtual environment and installs dependencies from pyproject.toml
49-
setup: compile-deps
50-
. .venv/bin/activate && pip install -e ".[dev,test]"
38+
# Creates virtual environment and installs dependencies from uv.lock
39+
setup: update-lock
40+
uv sync --all-extras
41+
ifeq ($(USE_LOCAL_SDK),true)
42+
uv add --editable $(SOCKET_SDK_PATH)
43+
endif
5144

52-
# Installs exact versions from requirements.txt into your virtual environment
53-
sync-deps:
54-
. .venv/bin/activate && pip-sync requirements.txt requirements-dev.txt requirements-test.txt
45+
# Installs exact versions from uv.lock into your virtual environment
46+
sync:
47+
uv sync --all-extras
5548
ifeq ($(USE_LOCAL_SDK),true)
56-
. .venv/bin/activate && pip install -e $(SOCKET_SDK_PATH)
49+
uv add --editable $(SOCKET_SDK_PATH)
5750
endif
5851

5952
# Removes virtual environment and cache files
@@ -62,8 +55,8 @@ clean:
6255
find . -type d -name "__pycache__" -exec rm -rf {} +
6356

6457
test:
65-
pytest
58+
uv run pytest
6659

6760
lint:
68-
ruff check .
69-
ruff format --check .
61+
uv run ruff check .
62+
uv run ruff format --check .

README.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,9 @@ make first-time-setup
371371
2. Local Development Setup (for SDK development):
372372
```bash
373373
pyenv local 3.11 # Ensure correct Python version
374-
SOCKET_SDK_PATH=~/path/to/socket-sdk-python make first-time-local-setup
374+
SOCKET_SDK_PATH=~/path/to/socketdev make first-time-local-setup
375375
```
376-
The default SDK path is `../socket-sdk-python` if not specified.
376+
The default SDK path is `../socketdev` if not specified.
377377
378378
#### Ongoing Development Tasks
379379
@@ -392,25 +392,23 @@ make sync-all
392392
High-level workflows:
393393
- `make first-time-setup`: Complete setup using PyPI packages
394394
- `make first-time-local-setup`: Complete setup for local SDK development
395-
- `make update-deps`: Update requirements.txt files and sync dependencies
395+
- `make update-lock`: Update uv.lock file after changing pyproject.toml
396396
- `make sync-all`: Sync dependencies after pulling changes
397397
- `make dev-setup`: Setup for local development (included in first-time-local-setup)
398398
399399
Implementation targets:
400-
- `make init-tools`: Creates virtual environment and installs pip-tools
401400
- `make local-dev`: Installs dependencies needed for local development
402-
- `make compile-deps`: Generates requirements.txt files with locked versions
403-
- `make setup`: Creates virtual environment and installs dependencies
404-
- `make sync-deps`: Installs exact versions from requirements.txt
401+
- `make setup`: Creates virtual environment and installs dependencies from uv.lock
402+
- `make sync`: Installs exact versions from uv.lock
405403
- `make clean`: Removes virtual environment and cache files
406-
- `make test`: Runs pytest suite
407-
- `make lint`: Runs ruff for code formatting and linting
404+
- `make test`: Runs pytest suite using uv run
405+
- `make lint`: Runs ruff for code formatting and linting using uv run
408406
409407
### Environment Variables
410408
411409
#### Core Configuration
412410
- `SOCKET_SECURITY_API_KEY`: Socket Security API token (alternative to --api-token parameter)
413-
- `SOCKET_SDK_PATH`: Path to local socket-sdk-python repository (default: ../socket-sdk-python)
411+
- `SOCKET_SDK_PATH`: Path to local socketdev repository (default: ../socketdev)
414412
415413
#### GitLab Integration
416414
- `GITLAB_TOKEN`: GitLab API token for GitLab integration (supports both Bearer and PRIVATE-TOKEN authentication)

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
66

77
[project]
88
name = "socketsecurity"
9-
version = "2.2.2"
9+
version = "2.2.4"
1010
requires-python = ">= 3.10"
1111
license = {"file" = "LICENSE"}
1212
dependencies = [
@@ -16,7 +16,7 @@ dependencies = [
1616
'GitPython',
1717
'packaging',
1818
'python-dotenv',
19-
'socket-sdk-python>=2.1.8,<3'
19+
'socketdev>=3.0.0,<4.0.0'
2020
]
2121
readme = "README.md"
2222
description = "Socket Security CLI for CI/CD"
@@ -45,7 +45,7 @@ test = [
4545
dev = [
4646
"ruff>=0.3.0",
4747
"twine", # for building
48-
"pip-tools>=7.4.0", # for pip-compile
48+
"uv>=0.1.0", # for dependency management
4949
"pre-commit",
5050
"hatch"
5151
]

requirements-dev.lock

Lines changed: 0 additions & 73 deletions
This file was deleted.

requirements-dev.txt

Lines changed: 0 additions & 73 deletions
This file was deleted.

requirements.lock

Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
 (0)