Skip to content

feat: add CLI flag and environment variable to enable legacy API tokens #7388

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

Closed

Conversation

benglewis
Copy link
Contributor

@benglewis benglewis commented Apr 16, 2025

Add CLI flag and environment variable to enable legacy API token authentication.

  • Add --enable-legacy-api-token flag to label_studio/core/argparser.py.
  • Add LABEL_STUDIO_ENABLE_LEGACY_API_TOKEN environment variable to label_studio/core/settings/base.py.
  • Update docs/source/guide/start.md to include the new flag and environment variable.
  • Modify label_studio/server.py to enable legacy API tokens if the flag or environment variable is set.

For more details, open the Copilot Workspace session.

Add CLI flag and environment variable to enable legacy API token authentication.

* Add `--enable-legacy-api-token` flag to `label_studio/core/argparser.py`.
* Add `LABEL_STUDIO_ENABLE_LEGACY_API_TOKEN` environment variable to `label_studio/core/settings/base.py`.
* Update `docs/source/guide/start.md` to include the new flag and environment variable.
* Modify `label_studio/server.py` to enable legacy API tokens if the flag or environment variable is set.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/HumanSignal/label-studio?shareId=XXXX-XXXX-XXXX-XXXX).
Copy link

netlify bot commented Apr 16, 2025

👷 Deploy request for label-studio-docs-new-theme pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit c95c4cc

Copy link

netlify bot commented Apr 16, 2025

👷 Deploy request for heartex-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit c95c4cc

Copy link

sentry-io bot commented Apr 16, 2025

🔍 Existing Issues For Review

Your pull request is modifying functions with the following pre-existing issues:

📄 File: label_studio/server.py

Function Unhandled Issue
_create_user AttributeError: 'Namespace' object has no attribute 'quiet_mode' label_studio.server...
Event Count: 53

Did you find this useful? React with a 👍 or 👎

@github-actions github-actions bot added the feat label Apr 16, 2025
Copy link

netlify bot commented Apr 16, 2025

Deploy Preview for label-studio-storybook ready!

Name Link
🔨 Latest commit c95c4cc
🔍 Latest deploy log https://app.netlify.com/sites/label-studio-storybook/deploys/68060b79c205e60008989539
😎 Deploy Preview https://deploy-preview-7388--label-studio-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@benglewis
Copy link
Contributor Author

Fixes #7355

…acy API token support

* **Argument Parser**
  - Add `--enable-legacy-api-token` flag to the argument parser in `label_studio/core/argparser.py`

* **Settings**
  - Add `LABEL_STUDIO_ENABLE_LEGACY_API_TOKEN` environment variable in `label_studio/core/settings/base.py`
  - Set default value to `False`

* **Documentation**
  - Update `docs/source/guide/start.md` to include `--enable-legacy-api-token` and `LABEL_STUDIO_ENABLE_LEGACY_API_TOKEN`

* **Organization Functions**
  - Update `label_studio/organizations/functions.py` to set `legacy_api_tokens_enabled` based on the flag or environment variable

* **Server Initialization**
  - Pass `enable_legacy_api_token` input argument to `create_organization` in `label_studio/server.py`
@benglewis
Copy link
Contributor Author

@pakelley Please feel free to make any edits you like if you want to change anything - since I am Out-of-Office for the next couple days

@pakelley pakelley enabled auto-merge (squash) April 17, 2025 17:35
auto-merge was automatically disabled April 21, 2025 09:10

Head branch was pushed to by a user without write access

@benglewis
Copy link
Contributor Author

@pakelley I fixed merge conflicts merging with main, but I see that this now requires you to re-add the Pull Request to the auto-merge queue

@pakelley
Copy link
Contributor

@benglewis I'm still seeing this in the tests:

Run pipx install "poetry==${POETRY_VERSION}"
Unable to parse package spec: poetry==

Mind checking again that this is set? For what it's worth, we're cutting a new release tomorrow and I'd love to get this in before the cut 🙂

@benglewis
Copy link
Contributor Author

@pakelley I believe that in this repository, the GitHub Actions workflows are not designed to work for people who are not HumanSignal employees. Instead, I saw that with my co-worker ( @ddishi ) what @bmartel did with his code was to create a parallel Pull Request (#7000) with the same code which he synchronized and used that to check the GitHub Actions workflows. Hopefully this makes it possible to merge this 🙏

@pakelley
Copy link
Contributor

I see, thanks for your patience here @benglewis ! I've created #7413 . I'll figure out how we can either make this process easier or at least add it to CONTRIBUTING.md for now.

@benglewis
Copy link
Contributor Author

@pakelley Great. Thank you 🙌 . I see that you merged the parallel PR - is it possible to merge this PR too?

@pakelley
Copy link
Contributor

@benglewis I'm closing this one since the commits from this PR were all merged as part of #7413

@pakelley pakelley closed this Apr 23, 2025
@micaelakaplan
Copy link
Contributor

Hi @benglewis ! Could you email me regarding this PR? [email protected] thanks!

@benglewis benglewis deleted the add-legacy-token-flag branch May 5, 2025 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants