Skip to content

Commit

Permalink
Switching from Rye to uv for the workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
MisterBourbaki committed Sep 6, 2024
1 parent 8de6b21 commit 96ef706
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 569 deletions.
30 changes: 13 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,16 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Setup Rye
uses: eifinger/setup-rye@v2
id: setup-rye
- name: Use UV instead of pip
run: rye config --set-bool behavior.use-uv=true
- name: Build a binary wheel and a source tarball with rye
run: rye build
- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/
- uses: actions/checkout@v4
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v1
with:
version: 0.4.5
enable-cache: true
- name: Build with uv
run: uv build
- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/
22 changes: 9 additions & 13 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,19 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
# poetry-version: ["1.8.2"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v4
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install the latest version of rye
uses: eifinger/setup-rye@v2
- name: Use UV instead of pip
run: rye config --set-bool behavior.use-uv=true
- name: Install dependencies
run: |
rye sync --no-lock
version: 0.4.5
enable-cache: true
- name: Install the project
run: uv sync -p ${{ matrix.python-version }} --all-extras --dev
- name: Run the lint
run: rye run ruff check pybiscus/
run: uv run ruff check .
- name: Run the format
run: rye run ruff format pybiscus/
run: uv run ruff format .
4 changes: 4 additions & 0 deletions docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
* Refacto of container part.
* Improve and change the documentation.

## [Unreleased]

* Switching from Rye to uv for the workflow.

## [Version 0.8.0]

* Refacto:
Expand Down
20 changes: 18 additions & 2 deletions pybiscus/flower/server_fabric.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ class ConfigServer(BaseModel):


class Server:
"""The base Server of Pybiscus."""

def __init__(
self,
root_dir: Path,
Expand All @@ -87,7 +89,7 @@ def __init__(
data: LightningDataModule,
weights_path: Optional[Path],
):
"""Launch a Flower Server.
"""Initialize a Flower Server.
This is a Typer command to launch a Flower Server, using the configuration given by config.
Apart from the config parameter, other parameters are optional and, if given, override the associated parameter given by the parameter config.
Expand Down Expand Up @@ -163,6 +165,20 @@ def launch(
client_configs: list[str],
save_on_train_end: bool,
):
"""Launch the server.
Parameters
----------
server_adress : str
the IP adress on which to run the server.
num_rounds : int
number of rounds of Federated Learning.
client_configs : list[str]
A list of Paths to the configuration files of the client.
Only useful on pseudo-local training, as all files need to be on the same machine
save_on_train_end : bool
Whether to save the weights of the model (on the server side) at the end of the training.
"""
fl.server.start_server(
server_address=server_adress,
config=fl.server.ServerConfig(num_rounds=num_rounds),
Expand All @@ -181,7 +197,7 @@ def launch(
_conf = OmegaConf.load(client_conf)
with open(
self.fabric.logger.log_dir
+ f"/config_client_{_conf['config_client']['cid']}_launch.yml",
+ f"/config_client_{_conf['client']['init']['cid']}_launch.yml",
"w",
) as file:
OmegaConf.save(config=_conf, f=file)
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pybiscus_client = "pybiscus.commands.app_client:client_cli"
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.rye]
[tool.uv]
managed = true
dev-dependencies = [
"pytest>=8.2.0",
Expand All @@ -45,7 +45,7 @@ dev-dependencies = [
"mkdocs>=1.6.0",
"mkdocstrings[python]>=0.25.1",
"mkdocs-material>=9.5.23",
"ipython>=8.24.0",
"ipython",
]

[tool.hatch.metadata]
Expand Down
Loading

0 comments on commit 96ef706

Please sign in to comment.