Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change to uv #19

Merged
merged 12 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions .github/workflows/release_new_tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,17 @@ jobs:
name: Publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python 3.7
uses: actions/setup-python@v4
- uses: actions/checkout@v4
- name: Setup Python 3.13
uses: actions/setup-python@v5
with:
python-version: 3.7
- name: Install poetry
run: |
curl -sSL https://install.python-poetry.org/ | python -
sudo ln -s $HOME/.poetry/bin/poetry /usr/local/bin/poetry
poetry config virtualenvs.path ~/.poetry/environments
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Build & Publish
run: |
poetry build
poetry publish -u $PYPI_USERNAME -p $PYPI_PASSWORD
uv build
uv publish -u $PYPI_USERNAME -p $PYPI_PASSWORD
env:
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
59 changes: 20 additions & 39 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,41 @@
name: Test Code Changes
on:
pull_request:
branches: [main]
branches:
- main
jobs:
test-django:
name: Python Test Suite
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, "3.10", "3.11-dev"]
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
D3PLOY_DEBUG: true
D3PLOY_DEBUG: yes
D3PLOY_TEST_BUCKET: d3ploy-tests-${{ matrix.python-version }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install poetry
run: |
curl -sSL https://install.python-poetry.org/ | python -
sudo ln -s $HOME/.poetry/bin/poetry /usr/local/bin/poetry
poetry config virtualenvs.path ~/.poetry/environments
- name: Cache Python packages
uses: actions/cache@v1
id: poetry-cache
env:
cache-name: cache-poetry-packages
with:
path: ~/.poetry/environments
key: ${{ runner.os }}-python-${{ matrix.python-version }}-build-${{ env.cache-name }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-python-${{ matrix.python-version }}-build-${{ env.cache-name }}-
${{ runner.os }}-python-${{ matrix.python-version }}-build-
${{ runner.os }}-python-${{ matrix.python-version }}-
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Install Python dependencies
run: |
poetry install
if: steps.poetry-cache.outputs.cache-hit != 'true'
- name: Run Black Tests
run: poetry run black --check .
- name: Run Flake8 Tests
run: poetry run flake8
- name: Run isort Tests
run: poetry run isort --recursive --check-only .
uv sync
- name: Run ruff tests
run: uv run ruff check d3ploy
- name: Run Python Unit Tests
run: |
poetry run coverage erase
poetry run coverage run --source='d3ploy' tests/test.py "$@"
poetry run coverage html
poetry run coverage report --fail-under=100 --skip-covered
- name: Store Python coverage results
uses: actions/upload-artifact@v1
with:
name: python-coverage
path: htmlcov
uv run coverage erase
uv run coverage run --source='d3ploy' tests/test.py "$@"
uv run coverage html
uv run coverage report --fail-under=100 --skip-covered
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,3 @@ dmypy.json

.DS_Store
*.ignore
Pipfile.lock

18 changes: 5 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
repos:
- repo: https://github.com/ambv/black
rev: 21.5b1
hooks:
- id: black
language_version: python3.8
- repo: https://gitlab.com/pycqa/flake8
rev: "3.9.2"
hooks:
- id: flake8
- repo: https://github.com/timothycrosley/isort
rev: "5.8.0"
hooks:
- id: isort
- hooks:
- id: ruff
- id: ruff-format
repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.3
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Easily deploy to S3 with multiple environment support. Version 4 supports Python

To install, run `pip install d3ploy`.
To use, run `d3ploy`. Additional arguments may be specified. Run `d3ploy --help` for more information.
_If you're using the excellent [uv](https://docs.astral.sh/uv) you can run `uvx d3ploy` without needing to install d3ploy._

## Authentication

Expand Down
18 changes: 14 additions & 4 deletions d3ploy/d3ploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,24 @@ def bail(*args, **kwargs): # pragma: no cover


def check_for_updates(
check_file_path: typing.Optional[
typing.Union[pathlib.Path, str]
] = "~/.d3ploy-update-check",
check_file_path: typing.Optional[typing.Union[pathlib.Path, str]] = None,
this_version: str = VERSION,
) -> bool:
if check_file_path is None:
xdg_config_home = os.environ.get("XDG_CONFIG_HOME")
if xdg_config_home:
check_file_path = (
pathlib.Path(xdg_config_home) / "d3ploy" / "last_check.txt"
)
else:
check_file_path = pathlib.Path("~/.config/d3ploy/last_check.txt")
check_file_path = check_file_path.expanduser()
if not check_file_path.exists():
check_file_path.parent.mkdir(parents=True, exist_ok=True)
check_file_path.touch()
update_available = None
try:
from pkg_resources import parse_version
from packaging.version import parse as parse_version
except ImportError: # pragma: no cover
return None
PYPI_URL = "https://pypi.org/pypi/d3ploy/json"
Expand Down
Loading