Skip to content
This repository has been archived by the owner on Nov 24, 2024. It is now read-only.

Commit

Permalink
feat: migrate from poetry to uv
Browse files Browse the repository at this point in the history
Signed-off-by: Ludovic Ortega <[email protected]>
  • Loading branch information
M0NsTeRRR committed Oct 18, 2024
1 parent 940a720 commit 219357f
Show file tree
Hide file tree
Showing 34 changed files with 1,916 additions and 2,088 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers-contrib/features/poetry:2": {
"ghcr.io/va-h/devcontainers-features/uv:1": {
"version": "latest"
}
},
Expand Down
5 changes: 2 additions & 3 deletions .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash

# Setup poetry
poetry install --with=dev
poetry shell
# Setup uv
uv sync
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Python release
on:
push:
tags:
- '*'
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
permissions:
# this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"
- name: Install the project
run: uv sync --all-extras
- name: Publish package
run: |
sed -i -e "s/0.0.0/${GITHUB_REF#refs/*/}/" pyproject.toml
uv build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
25 changes: 0 additions & 25 deletions .github/workflows/releases.yml

This file was deleted.

41 changes: 12 additions & 29 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,22 @@ jobs:
strategy:
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install poetry
run: pipx install poetry

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'

- name: Install poetry dependencies
run: |
export PATH="$PATH:$HOME/.local/bin"
poetry install --with=dev
- name: Run ruff
run: |
export PATH="$PATH:$HOME/.local/bin"
source `poetry env info --path`/bin/activate
poetry run ruff format --check .
poetry run ruff check .
- name: Run test
run: |
export PATH="$PATH:$HOME/.local/bin"
source `poetry env info --path`/bin/activate
poetry run pytest
run: uv python install ${{ matrix.python-version }}
- name: Install the project
run: uv sync --all-extras
- name: Run ruff format
run: uv run ruff format --check .
- name: Run ruff check
run: uv run ruff check .
- name: Run tests
run: uv run pytest --cov
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
17 changes: 6 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,19 @@ pip install napalm-fsos-ssh
A devcontainer is available

## Standard
Install [Poetry](https://python-poetry.org/docs/master/#installing-with-the-official-installer)
Install [uv](https://docs.astral.sh/uv/getting-started/installation/)

Install and setup dependencies
```
poetry install
poetry shell
pre-commit install
```
Install and setup dependencies with `uv sync`

### Run unit test
```
poetry run pytest
uv run pytest --cov
```

### Run linter & formatter
### Run ruff
```
poetry run ruff format .
poetry run ruff check .
uv run ruff format .
uv run ruff check .
```

# Switch configuration
Expand Down
1,073 changes: 0 additions & 1,073 deletions poetry.lock

This file was deleted.

45 changes: 27 additions & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,37 +1,46 @@
[tool.poetry]
[project]
name = "napalm-fsos-ssh"
version = "0"
version = "0.0.0"
description = "Napalm driver for FSOS through SSH"
authors = ["Ludovic Ortega <[email protected]>"]
license = "CeCILL"
authors = [
{name = "Ludovic Ortega", email = "[email protected]"}
]
readme = "README.md"
homepage = "https://github.com/napalm-automation-community/napalm-fsos-ssh"
repository = "https://github.com/napalm-automation-community/napalm-fsos-ssh"
keywords = ["napalm", "fsos", "netmiko"]
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Operating System :: OS Independent",
"License :: OSI Approved :: CEA CNRS Inria Logiciel Libre License, version 2.1 (CeCILL-2.1)",
"Topic :: Utilities",
]
include = [
"LICENSE",
"LICENSE.fr",

requires-python = ">=3.9,<4.0.0"
dependencies = [
"napalm>=4.0,<5.1"
]

[tool.poetry.dependencies]
python = ">3.8,<3.13"
napalm = ">=4.0,<5.1"
[project.urls]
Homepage = "https://github.com/napalm-automation-community/napalm-fsos-ssh"
Repository = "https://github.com/napalm-automation-community/napalm-fsos-ssh"
Issues = "https://github.com/napalm-automation-community/napalm-fsos-ssh/issues"

[tool.poetry.group.dev.dependencies]
pytest = ">=7.4.4,<8.4.0"
ruff = ">=0.5.0,<0.7.0"
[project.optional-dependencies]
dev = [
"pytest~=8.3.3",
"ruff~=0.7.0",
]

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.metadata]
allow-direct-references = true

[tool.hatch.build.targets.wheel]
packages = ["src/napalm_fsos_ssh"]
File renamed without changes.
Loading

0 comments on commit 219357f

Please sign in to comment.