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

feat: configure with pyproject #82

Merged
merged 17 commits into from
Nov 6, 2023
Merged

Conversation

julesbertrand
Copy link
Collaborator

@julesbertrand julesbertrand commented Oct 24, 2023

Description

Add possibility to set default values for all cli options and some parameters such as log level or pipelines path using pyproject.toml file:

[tool.vertex_deployer]
pipelines_root_path = "example/vertex/pipelines"
config_root_path = "example/vertex/configs"
log_level = "DEBUG"

[tool.vertex_deployer.list]
with_configs = true

[tool.vertex_deployer.deploy]
enable_cache = true

Add a command to display set parameters from the cli:

$ vertex-deployer config --all
'*' means the value was set in config file

* pipelines_root_path=example/vertex/pipelines
* config_root_path=example/vertex/configs
* log_level=DEBUG
deploy
  env_file=None
  compile=True
  upload=False
  run=False
  schedule=False
  cron=None
  delete_last_schedule=False
  tags=['latest']
  config_filepath=None
  config_name=None
  enable_caching=False
  experiment_name=None
  local_package_path=vertex/pipelines/compiled_pipelines
check
  all=False
  config_filepath=None
  raise_error=False
list
  * with_configs=True
create
  config_type=json

Related Issue

#35

Type of Change

  • 🚀 New feature (non-breaking change which adds functionality)
  • 🔧 Bug fix (non-breaking change which fixes an issue)
  • 🥂 Improvement (non-breaking change which improves an existing feature)
  • 🔐 Security fix
  • 📚 Examples / docs / tutorials / dependencies update
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I've read the CONTRIBUTING.md guide.
  • I've updated the code style using make format-code.
  • I've written tests for all new methods and classes that I created.
  • I've written the docstring in Google format for all the methods and classes that I used.
  • If my change requires a change to docs, I have updated the documentation accordingly.

@julesbertrand julesbertrand linked an issue Oct 24, 2023 that may be closed by this pull request
@github-actions
Copy link

PR Analysis

  • 🎯 Main theme: Adding configuration options for CLI commands using pyproject.toml
  • 📝 PR summary: This PR introduces the ability to configure default values for CLI options and parameters such as log level or pipelines path using a pyproject.toml file. It also includes a new config command to display the current configuration in the terminal.
  • 📌 Type of PR: Enhancement
  • 🧪 Relevant tests added: No
  • ⏱️ Estimated effort to review [1-5]: 3, because the PR involves changes in multiple files and introduces new features. However, the code is well-structured and easy to understand.
  • 🔒 Security concerns: No security concerns found

PR Feedback

  • 💡 General suggestions: The PR is well-structured and the code is clean. However, it would be beneficial to add tests to verify the new functionality and ensure it works as expected. Additionally, it would be helpful to add error handling for cases where the pyproject.toml file is not found or is incorrectly formatted.

  • 🤖 Code feedback:

    • relevant file: deployer/cli.py
      suggestion: Consider adding a check to ensure that the pyproject.toml file exists and is correctly formatted before attempting to load the configuration. This could help prevent errors and make the code more robust. [important]
      relevant line: deployer_config = load_configuration()

    • relevant file: deployer/configuration.py
      suggestion: It would be beneficial to add a check in the load_configuration function to ensure that the pyproject.toml file exists before attempting to parse it. If the file does not exist, the function could return a default configuration or raise an error. [important]
      relevant line: path_pyproject_toml = find_pyproject_toml(path_project_root)

    • relevant file: deployer/configuration.py
      suggestion: Consider adding a check in the parse_pyproject_toml function to ensure that the pyproject.toml file is correctly formatted before attempting to parse it. If the file is incorrectly formatted, the function could raise an error. [important]
      relevant line: pyproject_toml = toml.load(path_pyproject_toml)

How to use

To invoke the PR-Agent, add a comment using one of the following commands:
/review [-i]: Request a review of your Pull Request. For an incremental review, which only considers changes since the last review, include the '-i' option.
/describe: Modify the PR title and description based on the contents of the PR.
/improve [--extended]: Suggest improvements to the code in the PR. Extended mode employs several calls, and provides a more thorough feedback.
/ask <QUESTION>: Pose a question about the PR.
/update_changelog: Update the changelog based on the PR's contents.

To edit any configuration parameter from configuration.toml, add --config_path=new_value
For example: /review --pr_reviewer.extra_instructions="focus on the file: ..."
To list the possible configuration parameters, use the /config command.

@julesbertrand julesbertrand force-pushed the feat/configure-with-pyproject branch from c13f66d to 0a2cd0e Compare October 24, 2023 14:23
@TomDarmon
Copy link

Trop cool, hâte que ça soit merge pour qu'on puisse l'utiliser sur sco

@julesbertrand julesbertrand marked this pull request as ready for review November 6, 2023 08:19
@julesbertrand julesbertrand force-pushed the feat/configure-with-pyproject branch from 786b644 to 8737684 Compare November 6, 2023 09:43
@julesbertrand julesbertrand merged commit 56d69f4 into develop Nov 6, 2023
7 checks passed
@julesbertrand julesbertrand deleted the feat/configure-with-pyproject branch November 6, 2023 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow to configure paths and config type through pyproject.toml
2 participants