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

Support api-key and password as parameter when using users.create_default task #2516

Merged

Conversation

jfcalvo
Copy link
Member

@jfcalvo jfcalvo commented Mar 10, 2023

This PR includes the following changes:

  • Adds --api-key and --password parameters to argilla.tasks.users.create_default.
  • Now argilla.tasks.users.create_default checks if there is a user using default username before creating it and showing a message in such case (but not raising an error).

…iables to be used when creating default user
@jfcalvo jfcalvo requested a review from frascuchon March 10, 2023 12:36
@codecov
Copy link

codecov bot commented Mar 10, 2023

Codecov Report

Patch coverage: 91.97% and project coverage change: +0.83 🎉

Comparison is base (8c05058) 92.74% compared to head (f6ba8af) 93.58%.

Additional details and impacted files
@@                         Coverage Diff                         @@
##           feat/add-basic-database-support    #2516      +/-   ##
===================================================================
+ Coverage                            92.74%   93.58%   +0.83%     
===================================================================
  Files                                  167      163       -4     
  Lines                                 8271     8195      -76     
===================================================================
- Hits                                  7671     7669       -2     
+ Misses                                 600      526      -74     
Flag Coverage Δ
pytest 93.58% <91.97%> (+0.83%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/argilla/client/api.py 95.34% <ø> (ø)
src/argilla/client/sdk/text_classification/api.py 100.00% <ø> (+12.90%) ⬆️
src/argilla/server/apis/v0/handlers/text2text.py 97.72% <ø> (+21.53%) ⬆️
...lla/server/apis/v0/handlers/text_classification.py 100.00% <ø> (+13.59%) ⬆️
...la/server/apis/v0/handlers/token_classification.py 100.00% <ø> (+20.28%) ⬆️
...rc/argilla/server/daos/backend/mappings/helpers.py 97.22% <ø> (ø)
src/argilla/tasks/users/migrate.py 100.00% <ø> (ø)
src/argilla/client/apis/datasets.py 92.62% <78.57%> (-4.58%) ⬇️
src/argilla/client/client.py 93.07% <84.61%> (+6.25%) ⬆️
src/argilla/server/daos/backend/generic_elastic.py 86.18% <87.50%> (+0.39%) ⬆️
... and 18 more

... and 5 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -30,17 +31,17 @@ def create_default(quiet: bool):
first_name="",
username=DEFAULT_USERNAME,
role=UserRole.admin,
api_key=DEFAULT_API_KEY,
password_hash=accounts.hash_password(DEFAULT_PASSWORD),
api_key=settings.api_key,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If these settings are used only for the argilla task, I would prefer using a click.option instead, and calling the tasks:

python -m argilla.tasks.users.create_default --password $MY_PASS --api-key $MY_API_KEY

For me, it's a bit weird having app env vars used only on this task.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree but then users.create_default is useless because we already have users.create (and it will have the possibility of setting the api key, that is necessary for the team user of the QuickStart docker image).

Copy link
Member

@frascuchon frascuchon Mar 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I Agree. Also, in docs we can just say:

"Create the default user by typing:

argilla users create --username argilla --password 1234 --api-key argilla.apiKey --role admin

EDIT

Indeed is not possible since the password constraints. And I would like to keep this constraints for the common user creation command

@jfcalvo jfcalvo changed the title Support ARGILLA_API_KEY and ARGILLA_PASSWORD when creating default user Support api-key and password as parameter when using users.create_default task Mar 13, 2023
@jfcalvo jfcalvo merged commit 084de8f into feat/add-basic-database-support Mar 13, 2023
@jfcalvo jfcalvo deleted the allow-api-key-and-password-as-env-vars branch March 13, 2023 17:13
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.

2 participants