Skip to content

Commit 04839a6

Browse files
committed
[migration] Use uv in GH workflows (build and publish)
- Updated project dockerfile
1 parent a8ea185 commit 04839a6

File tree

12 files changed

+289
-147
lines changed

12 files changed

+289
-147
lines changed

.dockerignore

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Python files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.so
6+
.Python
7+
env/
8+
venv/
9+
.venv/
10+
pip-log.txt
11+
pip-delete-this-directory.txt
12+
.tox/
13+
.coverage
14+
.coverage.*
15+
.cache
16+
nosetests.xml
17+
coverage.xml
18+
*.cover
19+
*.log
20+
.git
21+
.mypy_cache
22+
.pytest_cache
23+
.hypothesis
24+
25+
# IDE files
26+
.vscode/
27+
.idea/
28+
*.swp
29+
*.swo
30+
31+
# OS files
32+
.DS_Store
33+
.DS_Store?
34+
._*
35+
.Spotlight-V100
36+
.Trashes
37+
ehthumbs.db
38+
Thumbs.db
39+
40+
# Documentation
41+
docs/
42+
*.md
43+
*.rst
44+
45+
# Tests
46+
tests/
47+
test/
48+
49+
# CI/CD
50+
.github/
51+
.gitlab-ci.yml
52+
.travis.yml
53+
54+
# Package build
55+
build/
56+
dist/
57+
*.egg-info/
58+
59+
# Development
60+
.env
61+
.env.*
62+
requirements-dev.txt
63+
64+
# Temporary files
65+
tmp/
66+
temp/
67+
.tmp/

.github/workflows/pyatlan-pr.yaml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ jobs:
2222
with:
2323
python-version: ${{ matrix.python-version }}
2424

25+
- name: Install uv
26+
uses: astral-sh/setup-uv@v6
27+
2528
- uses: pypa/[email protected]
2629
with:
2730
# Since we used pytest for dev
@@ -56,22 +59,21 @@ jobs:
5659
with:
5760
python-version: ${{ matrix.python-version }}
5861

62+
- name: Install uv
63+
uses: astral-sh/setup-uv@v6
64+
5965
- name: Install dependencies
60-
run: |
61-
python -m pip install --no-cache-dir --upgrade pip setuptools
62-
if [ -f requirements.txt ]; then pip install --no-cache-dir -r requirements.txt; fi
63-
if [ -f requirements-dev.txt ]; then pip install --no-cache-dir -r requirements-dev.txt; fi
66+
run: uv sync --extra dev
6467

6568
- name: QA checks (ruff-format, ruff-lint, mypy)
66-
run: |
67-
./qa-checks
69+
run: uv run ./qa-checks
6870

6971
- name: Run unit tests
7072
env: # Test tenant environment variables
7173
ATLAN_API_KEY: ${{ secrets.ATLAN_API_KEY }}
7274
ATLAN_BASE_URL: ${{ secrets.ATLAN_BASE_URL }}
7375
# Run with `pytest-sugar` for enhancing the overall test report output
74-
run: pytest tests/unit --force-sugar
76+
run: uv run pytest tests/unit --force-sugar
7577

7678
- name: Prepare integration tests distribution
7779
id: distribute-integration-test-files
@@ -102,11 +104,11 @@ jobs:
102104
# https://github.com/actions/setup-python/issues/160"
103105
python-version: "3.9"
104106

107+
- name: Install uv
108+
uses: astral-sh/setup-uv@v6
109+
105110
- name: Install dependencies
106-
run: |
107-
python -m pip install --no-cache-dir --upgrade pip setuptools
108-
if [ -f requirements.txt ]; then pip install --no-cache-dir -r requirements.txt; fi
109-
if [ -f requirements-dev.txt ]; then pip install --no-cache-dir -r requirements-dev.txt; fi
111+
run: uv sync --extra dev
110112

111113
- name: Run integration tests
112114
env: # Test tenant environment variables
@@ -118,4 +120,4 @@ jobs:
118120
timeout_minutes: 10 # Maximum time per test job; otherwise, the job will fail
119121
# Run the integration test file using `pytest-timer` plugin
120122
# to display only the durations of the 10 slowest tests with `pytest-sugar`
121-
command: pytest ${{ matrix.test_file }} -p name_of_plugin --timer-top-n 10 --force-sugar
123+
command: uv run pytest ${{ matrix.test_file }} -p name_of_plugin --timer-top-n 10 --force-sugar

.github/workflows/pyatlan-publish.yaml

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,22 @@ jobs:
2828
uses: actions/setup-python@v5
2929
with:
3030
python-version: '3.9'
31+
- name: Install uv
32+
uses: astral-sh/setup-uv@v6
3133
- name: Install dependencies
32-
run: |
33-
python -m pip install --upgrade pip
34-
pip install build
34+
run: uv sync --extra dev
3535
- name: check tag
3636
id: check-tag
37-
run: python check_tag.py
38-
- name: Build package
39-
run: python -m build
40-
- name: Publish package
41-
uses: pypa/[email protected]
42-
with:
43-
user: __token__
44-
password: ${{ secrets.PYPI_API_TOKEN }}
37+
run: uv run python check_tag.py
38+
- name: Build and publish to PyPI
39+
env:
40+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
41+
run: |
42+
uv build
43+
uv publish
4544
- name: Build Lambda layer
4645
run: |
47-
pip install --target=python .
46+
uv pip install --target=python .
4847
- uses: actions/upload-artifact@v4
4948
with:
5049
name: lambda-layer
@@ -62,15 +61,7 @@ jobs:
6261
registry: ghcr.io
6362
username: ${{ github.actor }}
6463
password: ${{ secrets.GITHUB_TOKEN }}
65-
- name: Login to Docker Hub
66-
uses: docker/login-action@v3
67-
with:
68-
username: ${{ vars.DOCKERHUB_USERNAME }}
69-
password: ${{ secrets.DOCKERHUB_TOKEN }}
70-
- name: Copy logging.conf
71-
run: |
72-
mkdir -p ./containers/base
73-
cp ./pyatlan/logging.conf ./containers/base/
64+
7465
- name: Set image tag from file
7566
id: set-image-tag
7667
run: |
@@ -83,7 +74,9 @@ jobs:
8374
push: true
8475
tags: |
8576
ghcr.io/atlanhq/atlan-python:${{ env.IMAGE_TAG }}
86-
cedocker1/pyatlan:${{ env.IMAGE_TAG }}
87-
context: ./containers
88-
file: ./containers/Dockerfile
77+
ghcr.io/atlanhq/atlan-python:latest
78+
context: .
79+
file: ./Dockerfile
8980
build-args: VERSION=${{ env.IMAGE_TAG }}
81+
cache-from: type=gha
82+
cache-to: type=gha,mode=max

.github/workflows/pyatlan-test-cron.yaml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,14 @@ jobs:
2020
with:
2121
python-version: ${{ matrix.python-version }}
2222

23+
- name: Install uv
24+
uses: astral-sh/setup-uv@v6
25+
2326
- name: Install dependencies
24-
run: |
25-
python -m pip install --upgrade pip
26-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
27-
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
27+
run: uv sync --extra dev
2828

29-
- name: QA checks (black, flake8, mypy)
30-
run: |
31-
./qa-checks
29+
- name: QA checks (ruff-format, ruff-lint, mypy)
30+
run: uv run ./qa-checks
3231

3332
- name: Test with pytest
3433
env: # Or as an environment variable
@@ -37,5 +36,5 @@ jobs:
3736
# Run the integration test suite using the `pytest-timer` plugin
3837
# to display only the durations of the 25 slowest tests with `pytest-sugar`
3938
run: |
40-
pytest tests/unit
41-
pytest tests/integration -p name_of_plugin --timer-top-n 25
39+
uv run pytest tests/unit
40+
uv run pytest tests/integration -p name_of_plugin --timer-top-n 25

Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM python:3.11-slim
2+
3+
ARG VERSION
4+
5+
# Install uv for faster package management
6+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
7+
8+
# Install pyatlan from PyPI
9+
RUN --mount=type=cache,target=/root/.cache/uv \
10+
uv pip install --system --no-cache-dir pyatlan==${VERSION}
11+
12+
# Set working directory
13+
WORKDIR /app
14+
15+
CMD ["python"]

README.md

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,8 @@ To get started developing the SDK:
3939

4040
4. Install the required dependencies:
4141
```bash
42-
# Upgrade pip before installing dependencies
43-
python -m pip install --upgrade pip
44-
# Install required dependencies for development
45-
pip install -e . && pip install -r requirements-dev.txt
42+
# Install dependencies using uv
43+
uv sync --extra dev
4644
```
4745

4846
### Code Formatting
@@ -86,28 +84,73 @@ For running integration tests, you'll need to configure your environment:
8684
You can run all the QA checks using the following command:
8785
8886
```bash
89-
./qa-checks
87+
uv run ./qa-checks
9088
```
9189
9290
### Running Unit Tests
9391
You can run the SDK's unit tests **without needing access to an Atlan environment**:
9492
9593
```bash
96-
pytest tests/unit
94+
uv run pytest tests/unit
9795
```
9896
9997
### Running Integration Tests
10098
Once the environment is set up, you can run integration tests:
10199
102100
- All integration tests:
103101
```bash
104-
pytest tests/integration
102+
uv run pytest tests/integration
105103
```
106104
- Specific integration tests:
107105
```bash
108-
pytest tests/integration/<test_specific_feature>.py
106+
uv run pytest tests/integration/<test_specific_feature>.py
109107
```
110108
109+
## Docker
110+
111+
### Using Published Images
112+
113+
Pre-built Docker images are available from GitHub Container Registry:
114+
115+
```bash
116+
# Latest version
117+
docker pull ghcr.io/atlanhq/atlan-python:latest
118+
119+
# Specific version
120+
docker pull ghcr.io/atlanhq/atlan-python:7.1.1
121+
```
122+
123+
**Usage:**
124+
```bash
125+
# Interactive Python session
126+
docker run -it --rm ghcr.io/atlanhq/atlan-python:latest
127+
128+
# Run a Python script
129+
docker run -it --rm -v $(pwd):/app ghcr.io/atlanhq/atlan-python:latest python your_script.py
130+
131+
# With environment variables
132+
docker run -it --rm \
133+
-e ATLAN_API_KEY=your_api_key \
134+
-e ATLAN_BASE_URL=https://your-tenant.atlan.com \
135+
ghcr.io/atlanhq/atlan-python:latest
136+
```
137+
138+
### Building Locally
139+
140+
You can build the Docker image locally:
141+
142+
```bash
143+
# Build the image
144+
docker build -t pyatlan --build-arg VERSION=7.1.1 .
145+
146+
# Test the image
147+
docker run -it --rm pyatlan python -c "import pyatlan; print('PyAtlan loaded successfully!')"
148+
```
149+
150+
**Available images:**
151+
- **Latest**: `ghcr.io/atlanhq/atlan-python:latest`
152+
- **Versioned**: `ghcr.io/atlanhq/atlan-python:x.y.z`
153+
111154
### Running the SDK Model Generator
112155
113156
If you've pushed new typedefs to Atlan and want to generate SDK asset models to manage them via the SDK, this section covers how to run the SDK generator.

containers/.dockerignore

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Python files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.so
6+
.Python
7+
env/
8+
venv/
9+
.venv/
10+
pip-log.txt
11+
pip-delete-this-directory.txt
12+
.tox/
13+
.coverage
14+
.coverage.*
15+
.cache
16+
nosetests.xml
17+
coverage.xml
18+
*.cover
19+
*.log
20+
.git
21+
.mypy_cache
22+
.pytest_cache
23+
.hypothesis
24+
25+
# IDE files
26+
.vscode/
27+
.idea/
28+
*.swp
29+
*.swo
30+
31+
# OS files
32+
.DS_Store
33+
.DS_Store?
34+
._*
35+
.Spotlight-V100
36+
.Trashes
37+
ehthumbs.db
38+
Thumbs.db
39+
40+
# Documentation
41+
docs/
42+
*.md
43+
*.rst
44+
45+
# Tests
46+
tests/
47+
test/
48+
49+
# CI/CD
50+
.github/
51+
.gitlab-ci.yml
52+
.travis.yml
53+
54+
# Package build
55+
build/
56+
dist/
57+
*.egg-info/
58+
59+
# Development
60+
.env
61+
.env.*
62+
requirements-dev.txt
63+
64+
# Temporary files
65+
tmp/
66+
temp/
67+
.tmp/

0 commit comments

Comments
 (0)