Skip to content

Commit 86bba2d

Browse files
authored
Eric/cus 9 support cli updates (#14)
* Added typing, bumped version to v2, supports CLI v2
1 parent 7f00f40 commit 86bba2d

27 files changed

+1335
-829
lines changed

.github/workflows/pr-preview.yml

+5-9
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,12 @@ jobs:
2323
PREVIEW_VERSION="${BASE_VERSION}.dev${{ github.event.pull_request.number }}${{ github.event.pull_request.commits }}"
2424
echo "VERSION=${PREVIEW_VERSION}" >> $GITHUB_ENV
2525
26-
# Update version in __init__.py
27-
echo "__version__ = \"${PREVIEW_VERSION}\"" > socketdev/__init__.py.tmp
28-
cat socketdev/__init__.py | grep -v "__version__" >> socketdev/__init__.py.tmp
29-
mv socketdev/__init__.py.tmp socketdev/__init__.py
26+
# Update version in version.py instead of __init__.py
27+
echo "__version__ = \"${PREVIEW_VERSION}\"" > socketdev/version.py
3028
3129
# Verify the change
32-
echo "Updated version in __init__.py:"
33-
cat socketdev/__init__.py | grep "__version__"
30+
echo "Updated version in version.py:"
31+
cat socketdev/version.py
3432
3533
- name: Check if version exists on Test PyPI
3634
id: version_check
@@ -55,9 +53,7 @@ jobs:
5553
if: always()
5654
run: |
5755
BASE_VERSION=$(echo $VERSION | cut -d'.' -f1-3)
58-
echo "__version__ = \"${BASE_VERSION}\"" > socketdev/__init__.py.tmp
59-
cat socketdev/__init__.py | grep -v "__version__" >> socketdev/__init__.py.tmp
60-
mv socketdev/__init__.py.tmp socketdev/__init__.py
56+
echo "__version__ = \"${BASE_VERSION}\"" > socketdev/version.py
6157
6258
- name: Publish to Test PyPI
6359
if: steps.version_check.outputs.exists != 'true'

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Get Version
1717
id: version
1818
run: |
19-
RAW_VERSION=$(python -c "from socketdev import __version__; print(__version__)")
19+
RAW_VERSION=$(python -c "from socketdev.version import __version__; print(__version__)")
2020
echo "VERSION=$RAW_VERSION" >> $GITHUB_ENV
2121
if [ "v$RAW_VERSION" != "${{ github.ref_name }}" ]; then
2222
echo "Error: Git tag (${{ github.ref_name }}) does not match package version (v$RAW_VERSION)"

.github/workflows/version-check.yml

+10-3
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,20 @@ jobs:
1919
id: version_check
2020
run: |
2121
# Get version from current PR
22-
PR_VERSION=$(grep -o '__version__ = "[^"]*"' socketdev/__init__.py | cut -d'"' -f2)
22+
PR_VERSION=$(grep -o '__version__ = "[^"]*"' socketdev/version.py | cut -d'"' -f2)
2323
echo "Debug PR version: $PR_VERSION"
2424
echo "PR_VERSION=${PR_VERSION}" >> $GITHUB_ENV
2525
26-
# Get version from main branch
26+
# Get version from main branch - try both locations
2727
git checkout origin/main
28-
MAIN_VERSION=$(grep -o '__version__ = "[^"]*"' socketdev/__init__.py | cut -d'"' -f2)
28+
if [ -f socketdev/version.py ]; then
29+
MAIN_VERSION=$(grep -o '__version__ = "[^"]*"' socketdev/version.py | cut -d'"' -f2)
30+
else
31+
# Fall back to old location in __init__.py
32+
# Use more specific grep to avoid matching the imported version
33+
MAIN_VERSION=$(grep -o '^__version__ = "[^"]*"' socketdev/__init__.py | cut -d'"' -f2)
34+
fi
35+
2936
echo "Debug main version: $MAIN_VERSION"
3037
echo "MAIN_VERSION=${MAIN_VERSION}" >> $GITHUB_ENV
3138

.python-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.12.7

Pipfile

-15
This file was deleted.

Pipfile.lock

-472
This file was deleted.

pyproject.toml

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
[build-system]
2-
requires = ["setuptools >= 61.0"]
2+
requires = [
3+
"setuptools >= 61.0",
4+
"requests"
5+
]
36
build-backend = "setuptools.build_meta"
47

58
[project]
69
name = "socket-sdk-python"
710
dynamic = ["version"]
811
requires-python = ">= 3.9"
912
dependencies = [
10-
'requests'
13+
'requests',
14+
'typing-extensions>=4.12.2'
1115
]
1216
readme = "README.rst"
1317
license = {file = "LICENSE"}
@@ -34,6 +38,9 @@ classifiers = [
3438
[project.optional-dependencies]
3539
dev = [
3640
"ruff>=0.3.0",
41+
"twine",
42+
"wheel",
43+
"build",
3744
]
3845

3946
[project.urls]
@@ -57,10 +64,11 @@ include = [
5764
"socketdev.sbom",
5865
"socketdev.settings",
5966
"socketdev.tools",
67+
"socketdev.utils",
6068
]
6169

6270
[tool.setuptools.dynamic]
63-
version = {attr = "socketdev.__version__"}
71+
version = {attr = "socketdev.version.__version__"}
6472

6573
[tool.ruff]
6674
# Exclude a variety of commonly ignored directories.

requirements-dev.lock

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# generated by rye
2+
# use `rye lock` or `rye sync` to update this lockfile
3+
#
4+
# last locked with the following flags:
5+
# pre: false
6+
# features: []
7+
# all-features: true
8+
# with-sources: false
9+
# generate-hashes: false
10+
# universal: false
11+
12+
-e file:.
13+
build==1.2.2.post1
14+
# via socket-sdk-python
15+
certifi==2024.12.14
16+
# via requests
17+
charset-normalizer==3.4.1
18+
# via requests
19+
docutils==0.21.2
20+
# via readme-renderer
21+
idna==3.10
22+
# via requests
23+
jaraco-classes==3.4.0
24+
# via keyring
25+
jaraco-context==6.0.1
26+
# via keyring
27+
jaraco-functools==4.1.0
28+
# via keyring
29+
keyring==25.6.0
30+
# via twine
31+
markdown-it-py==3.0.0
32+
# via rich
33+
mdurl==0.1.2
34+
# via markdown-it-py
35+
more-itertools==10.6.0
36+
# via jaraco-classes
37+
# via jaraco-functools
38+
nh3==0.2.20
39+
# via readme-renderer
40+
packaging==24.2
41+
# via build
42+
# via twine
43+
pkginfo==1.12.0
44+
# via twine
45+
pygments==2.19.1
46+
# via readme-renderer
47+
# via rich
48+
pyproject-hooks==1.2.0
49+
# via build
50+
readme-renderer==44.0
51+
# via twine
52+
requests==2.32.3
53+
# via requests-toolbelt
54+
# via socket-sdk-python
55+
# via twine
56+
requests-toolbelt==1.0.0
57+
# via twine
58+
rfc3986==2.0.0
59+
# via twine
60+
rich==13.9.4
61+
# via twine
62+
ruff==0.9.1
63+
# via socket-sdk-python
64+
twine==6.0.1
65+
# via socket-sdk-python
66+
typing-extensions==4.12.2
67+
# via socket-sdk-python
68+
urllib3==2.3.0
69+
# via requests
70+
# via twine
71+
wheel==0.45.1
72+
# via socket-sdk-python

requirements.lock

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# generated by rye
2+
# use `rye lock` or `rye sync` to update this lockfile
3+
#
4+
# last locked with the following flags:
5+
# pre: false
6+
# features: []
7+
# all-features: true
8+
# with-sources: false
9+
# generate-hashes: false
10+
# universal: false
11+
12+
-e file:.
13+
build==1.2.2.post1
14+
# via socket-sdk-python
15+
certifi==2024.12.14
16+
# via requests
17+
charset-normalizer==3.4.1
18+
# via requests
19+
docutils==0.21.2
20+
# via readme-renderer
21+
idna==3.10
22+
# via requests
23+
jaraco-classes==3.4.0
24+
# via keyring
25+
jaraco-context==6.0.1
26+
# via keyring
27+
jaraco-functools==4.1.0
28+
# via keyring
29+
keyring==25.6.0
30+
# via twine
31+
markdown-it-py==3.0.0
32+
# via rich
33+
mdurl==0.1.2
34+
# via markdown-it-py
35+
more-itertools==10.6.0
36+
# via jaraco-classes
37+
# via jaraco-functools
38+
nh3==0.2.20
39+
# via readme-renderer
40+
packaging==24.2
41+
# via build
42+
# via twine
43+
pkginfo==1.12.0
44+
# via twine
45+
pygments==2.19.1
46+
# via readme-renderer
47+
# via rich
48+
pyproject-hooks==1.2.0
49+
# via build
50+
readme-renderer==44.0
51+
# via twine
52+
requests==2.32.3
53+
# via requests-toolbelt
54+
# via socket-sdk-python
55+
# via twine
56+
requests-toolbelt==1.0.0
57+
# via twine
58+
rfc3986==2.0.0
59+
# via twine
60+
rich==13.9.4
61+
# via twine
62+
ruff==0.9.1
63+
# via socket-sdk-python
64+
twine==6.0.1
65+
# via socket-sdk-python
66+
typing-extensions==4.12.2
67+
# via socket-sdk-python
68+
urllib3==2.3.0
69+
# via requests
70+
# via twine
71+
wheel==0.45.1
72+
# via socket-sdk-python

scripts/build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
VERSION=$(grep -o "__version__.*" socketdev/__init__.py | awk '{print $3}' | sed 's/"//g' | sed "s/'//g" | tr -d '\r')
3+
VERSION=$(grep -o "__version__.*" socketdev/version.py | awk '{print $3}' | sed 's/"//g' | sed "s/'//g" | tr -d '\r')
44
ENABLE_PYPI_BUILD=$1
55

66
if [ -z $ENABLE_PYPI_BUILD ]; then

0 commit comments

Comments
 (0)