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 Python environment management tool to uv #423

Merged
merged 1 commit into from
Jan 29, 2025
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
3 changes: 0 additions & 3 deletions src/playbooks/roles/python/files/bashrc

This file was deleted.

This file was deleted.

43 changes: 2 additions & 41 deletions src/playbooks/roles/python/molecule/default/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,47 +13,8 @@
that:
- result.stdout == "molecule"
- name: test command existence
ansible.builtin.command: bash -c ". ~/.bashrc.d/pyenv.bashrc && type {{ item }}"
ansible.builtin.command: bash -cl "type {{ item }}"
register: result
changed_when: False
with_items:
- aws
- cpplint
- glances
- poetry
- pyenv
- name: test global python version
block:
- name: determine global python version
ansible.builtin.command: bash -c ". ~/.bashrc.d/pyenv.bashrc && python --version | sed 's|^Python ||g'"
register: result
changed_when: False
- name: assert global python version
assert:
that:
- result.stdout == "3.13.1"
fail_msg: "actual version is {{ result.stdout }}"
- name: test poetry version
block:
- name: determine poetry version
ansible.builtin.command: bash -c ". ~/.bashrc.d/pyenv.bashrc && poetry --version | sed 's|Poetry (version \([0-9\.]*\))|\1|g'"
register: result
changed_when: False
- name: assert poetry version
assert:
that:
- result.stdout is version('1.1.0', '>=')
- result.stdout is version('2.0.0', '<')
fail_msg: "actual version is {{ result.stdout }}"
- name: test AWS CLI version
block:
- name: determine AWS CLI version
ansible.builtin.command: bash -c ". ~/.bashrc.d/pyenv.bashrc && aws --version | sed 's| |\n|g' | grep 'aws-cli' | sed 's|.*/||g'"
register: result
changed_when: False
- name: assert AWS CLI version
assert:
that:
- result.stdout is version('1.0.0', '>=')
- result.stdout is version('2.0.0', '<')
fail_msg: "actual version is {{ result.stdout }}"
- uv
5 changes: 0 additions & 5 deletions src/playbooks/roles/python/tasks/awscli.yml

This file was deleted.

6 changes: 0 additions & 6 deletions src/playbooks/roles/python/tasks/cpplint.yml

This file was deleted.

5 changes: 0 additions & 5 deletions src/playbooks/roles/python/tasks/glances.yml

This file was deleted.

50 changes: 28 additions & 22 deletions src/playbooks/roles/python/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
---
- name: Apply dependent roles
ansible.builtin.include_role:
name: "{{ item }}"
with_items:
- dependencies/bashrc_dir
- name: Check whether already installed uv
ansible.builtin.command: bash -cl "type uv"
register: checked_result
changed_when: False
failed_when: checked_result.rc not in [0, 1]

- name: Include task pyenv
ansible.builtin.import_tasks: pyenv.yml

- name: Include task version
ansible.builtin.import_tasks: version.yml

- name: Include task poetry
ansible.builtin.import_tasks: poetry.yml

- name: Include task awscli
ansible.builtin.import_tasks: awscli.yml

- name: Include task cpplint
ansible.builtin.import_tasks: cpplint.yml

- name: Include task glances
ansible.builtin.import_tasks: glances.yml
- name: Install uv
when: checked_result.rc == 1
block:
- name: Install requirements
become: yes
ansible.builtin.apt:
name:
- curl
- name: Create temporary working directory
ansible.builtin.tempfile:
state: directory
register: tmpdir
- name: Download uv-installer
ansible.builtin.get_url:
url: https://astral.sh/uv/install.sh
dest: "{{ tmpdir.path }}/uv-installer"
- name: Execute uv-installer
# noqa no-changed-when
ansible.builtin.command: "bash {{ tmpdir.path }}/uv-installer"
- name: Remove temporary working directory
ansible.builtin.file:
path: "{{ tmpdir.path }}"
state: absent
11 changes: 0 additions & 11 deletions src/playbooks/roles/python/tasks/poetry.yml

This file was deleted.

41 changes: 0 additions & 41 deletions src/playbooks/roles/python/tasks/pyenv.yml

This file was deleted.

41 changes: 0 additions & 41 deletions src/playbooks/roles/python/tasks/version.yml

This file was deleted.

2 changes: 0 additions & 2 deletions src/playbooks/roles/python/vars/main.yml

This file was deleted.