41 Commits

Author SHA1 Message Date
Andrei Strongin c18932245f Add support for profile create --file, add documentation (#10896)
<!-- Raise an issue to propose your change
(https://github.com/cvat-ai/cvat/issues).
It helps to avoid duplication of efforts from multiple independent
contributors.
Discuss your ideas with maintainers to be sure that changes will be
approved and merged.
Read the [Contribution guide](https://docs.cvat.ai/docs/contributing/).
-->

<!-- Provide a general summary of your changes in the Title above -->

### Motivation and context
This PR adds file-based profile creation:

- `cvat-cli profile create --file <path>`
- Supports plain-text PAT files
- Supports JSON envelopes with `token`, optional `server`, and optional
`name`
- Explicit `--name` and `--server-host` override envelope values
- A complete JSON envelope can create a profile without extra CLI
arguments

It also includes:

- Tests for plain-file import, JSON import, and precedence rules
- CLI/SDK/profile documentation updates
- A changelog entry for `--file`

### How has this been tested?
<!-- Please describe in detail how you tested your changes.
Include details of your testing environment, and the tests you ran to
see how your change affects other areas of the code, etc. -->

### Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply.
If an item isn't applicable for some reason, then ~~explicitly
strikethrough~~ the whole
line. If you don't do that, GitHub will show incorrect progress for the
pull request.
If you're unsure about any of these, don't hesitate to ask. We're here
to help! -->
- [x] I submit my changes into the `develop` branch
- [x] I have created a changelog fragment <!-- see top comment in
CHANGELOG.md -->
- [x] I have updated the documentation accordingly
- [x] I have added tests to cover my changes
- [x] I have linked related issues (see [GitHub docs](

https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword))

### License

- [x] I submit _my code changes_ under the same [MIT License](
https://github.com/cvat-ai/cvat/blob/develop/LICENSE) that covers the
project.
  Feel free to contact the maintainers if that's a concern.

---------

Co-authored-by: Maxim Zhiltsov <maxim@cvat.ai>
2026-08-03 14:44:57 +04:00
Andrei Strongin 69cdda3e75 CLI profile group (#10875)
<!-- Raise an issue to propose your change
(https://github.com/cvat-ai/cvat/issues).
It helps to avoid duplication of efforts from multiple independent
contributors.
Discuss your ideas with maintainers to be sure that changes will be
approved and merged.
Read the [Contribution guide](https://docs.cvat.ai/docs/contributing/).
-->

<!-- Provide a general summary of your changes in the Title above -->

### Motivation and context
This branch completes the CLI workflow for persistent authentication
profiles. Users can save a CVAT server URL and Personal Access Token
under a named profile, then reuse it with `--profile` instead of
repeatedly passing credentials on the command line.

It adds `cvat-cli profile` commands to:

- List saved profiles, including the active default.
- Create a profile from a PAT, optionally deriving its name from the
server.
- Set, print, or clear the default profile.
- Delete profiles safely.

The implementation builds on the auth/config resolution already present
in `develop`. It uses the SDK’s `AuthStore.put_profile` API, preserves
copy-on-write store updates, and applies the same server-port validation
used by normal CLI client creation.

URL normalization was also moved into shared SDK utilities so both
`Client` and profile creation use one implementation for default HTTPS
schemes, trailing-slash removal, and invalid-scheme validation.

### How has this been tested?
<!-- Please describe in detail how you tested your changes.
Include details of your testing environment, and the tests you ran to
see how your change affects other areas of the code, etc. -->

### Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply.
If an item isn't applicable for some reason, then ~~explicitly
strikethrough~~ the whole
line. If you don't do that, GitHub will show incorrect progress for the
pull request.
If you're unsure about any of these, don't hesitate to ask. We're here
to help! -->
- [x] I submit my changes into the `develop` branch
- [x] I have created a changelog fragment <!-- see top comment in
CHANGELOG.md -->
- [ ] I have updated the documentation accordingly
- [x] I have added tests to cover my changes
- [x] I have linked related issues (see [GitHub docs](

https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword))

### License

- [x] I submit _my code changes_ under the same [MIT License](
https://github.com/cvat-ai/cvat/blob/develop/LICENSE) that covers the
project.
  Feel free to contact the maintainers if that's a concern.

---------

Co-authored-by: Maxim Zhiltsov <maxim@cvat.ai>
2026-07-23 01:12:59 +04:00
Andrei Strongin 59f88379ab CLI dispatch refactor + config group (#10845)
<!-- Raise an issue to propose your change
(https://github.com/cvat-ai/cvat/issues).
It helps to avoid duplication of efforts from multiple independent
contributors.
Discuss your ideas with maintainers to be sure that changes will be
approved and merged.
Read the [Contribution guide](https://docs.cvat.ai/docs/contributing/).
-->

<!-- Provide a general summary of your changes in the Title above -->

### Motivation and context
This branch continues the persistent authentication work for the CVAT
SDK and CLI. It makes saved auth profiles usable from CLI workflows, so
users do not need to repeatedly pass `--server-host`, `--server-port`,
and `--auth` for every command.
The changes centralize CLI auth resolution around the SDK auth helpers,
add support for profile/default-server based connection selection, and
introduce `cvat-cli config default-server` for managing the fallback
server used outside profile-based flows. The branch also adds dispatch
support for CLI commands that do not need an authenticated client, plus
tests and changelog coverage for the new config command and auth
behavior.
### How has this been tested?
Automated and manual tests

### Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply.
If an item isn't applicable for some reason, then ~~explicitly
strikethrough~~ the whole
line. If you don't do that, GitHub will show incorrect progress for the
pull request.
If you're unsure about any of these, don't hesitate to ask. We're here
to help! -->
- [x] I submit my changes into the `develop` branch
- [x] I have created a changelog fragment <!-- see top comment in
CHANGELOG.md -->
- [ ] I have updated the documentation accordingly
- [x] I have added tests to cover my changes
- [x] I have linked related issues (see [GitHub docs](

https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword))

### License

- [x] I submit _my code changes_ under the same [MIT License](
https://github.com/cvat-ai/cvat/blob/develop/LICENSE) that covers the
project.
  Feel free to contact the maintainers if that's a concern.

---------

Co-authored-by: Maxim Zhiltsov <maxim@cvat.ai>
2026-07-20 00:38:28 +04:00
Andrei Strongin 6db56e5d2e SDK resolution, arg parser, client builders, exports (#10824)
<!-- Raise an issue to propose your change
(https://github.com/cvat-ai/cvat/issues).
It helps to avoid duplication of efforts from multiple independent
contributors.
Discuss your ideas with maintainers to be sure that changes will be
approved and merged.
Read the [Contribution guide](https://docs.cvat.ai/docs/contributing/).
-->

<!-- Provide a general summary of your changes in the Title above -->

### Motivation and context
<!-- Why is this change required? What problem does it solve? If it
fixes an open
issue, please link to the issue here. Describe your changes in detail,
add
screenshots. -->

### How has this been tested?
<!-- Please describe in detail how you tested your changes.
Include details of your testing environment, and the tests you ran to
see how your change affects other areas of the code, etc. -->

### Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply.
If an item isn't applicable for some reason, then ~~explicitly
strikethrough~~ the whole
line. If you don't do that, GitHub will show incorrect progress for the
pull request.
If you're unsure about any of these, don't hesitate to ask. We're here
to help! -->
- [x] I submit my changes into the `develop` branch
- [x] I have created a changelog fragment <!-- see top comment in
CHANGELOG.md -->
- [ ] I have updated the documentation accordingly
- [x] I have added tests to cover my changes
- [x] I have linked related issues (see [GitHub docs](

https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword))

### License

- [x] I submit _my code changes_ under the same [MIT License](
https://github.com/cvat-ai/cvat/blob/develop/LICENSE) that covers the
project.
  Feel free to contact the maintainers if that's a concern.

---------

Co-authored-by: Maxim Zhiltsov <maxim@cvat.ai>
2026-07-10 15:30:32 +04:00
Roman Donchenko 7811d62e3f SDK: Remove server scheme autodetection (#10673)
This has been deprecated in #9384. For maximum compatibility, keep
supporting schemaless URLs, but always assume HTTPS instead of
autodetecting.
2026-07-01 14:59:47 +03:00
Andrei Strongin c4a79cefef Simplify native agent task cache limiter after chunk cache removal (#10714) 2026-06-05 13:09:27 +03:00
Andrei Strongin c5e968b652 Fix test 2026-05-21 16:15:58 +04:00
Andrei Strongin 215d65ac2e Make sure 100% test coverage 2026-05-20 18:26:11 +04:00
Andrei Strongin 9753f49980 Merge branch 'develop' into feature/add-export-import-datasets-for-project-cli
# Conflicts:
#	cvat-cli/src/cvat_cli/_internal/command_base.py
#	cvat-cli/src/cvat_cli/_internal/commands_projects.py
#	cvat-cli/src/cvat_cli/_internal/commands_tasks.py
#	site/content/en/docs/api_sdk/cli/_index.md
#	tests/python/cli/test_cli_projects.py
2026-05-20 17:06:22 +04:00
Andrei Strongin f50dfefb12 Add 'backup' and 'create-from-backup' methods into CLI for Project entity (#10618) 2026-05-20 14:45:37 +03:00
Andrei Strongin 3c7e52d9b0 Fix requested changes 2026-05-20 15:39:11 +04:00
Andrei Strongin 523878c233 Add 'export-dataset' and 'import-dataset' for Project entity in CVAT CLI 2026-05-20 00:38:02 +04:00
Roman Donchenko 754d746fc2 Remove redundant "labels" parameters in tests (#10487)
Task labels used to be mandatory, but now (see #9822) they are not. This
means that a lot of these parameters are no longer necessary and just
create clutter.
2026-04-17 12:21:26 +03:00
Roman Donchenko fdc3a24b83 tests: use PEP 604 syntax for optionals/unions (#10090)
This is a continuation of #10060.

I also added a couple of `TypeAlias` annotations where appropriate, and
changed the import style in `test_users.py` to be more consistent with
other files.
2025-12-09 13:51:52 +02:00
Maxim Zhiltsov cf9ce57616 Support api access token auth in cli and sdk (#9563) 2025-10-22 14:29:34 +03:00
Maxim Zhiltsov 920100ef15 Exporting with server filename in sdk/cli (#9732) 2025-08-27 19:45:17 +03:00
Roman Donchenko 4ec01c4003 Implement agent support for real-time notifications (#9191) 2025-04-02 17:09:13 +03:00
Maxim Zhiltsov 2ca90b05fe Prohibit wildcard import in pylint (#8893) 2025-01-30 17:01:08 +03:00
Boris Sekachev 5a99e73efd Drop years from license headers associated to CVAT.ai Corporation (#8968) 2025-01-21 09:31:41 +02:00
Roman Donchenko 73458b3f38 CLI: make the output of create commands machine-readable (#8833)
The underlying SDK functions already emit human-friendly log messages
with the ID of the created resource. Instead of printing largely the
same message twice, we can just print the ID. That way, the CLI can be
more easily integrated into other software.
2024-12-17 14:49:39 +02:00
Roman Donchenko 3f44834251 Make the CLI hierarchical (#8787)
Currently, the CLI has one level of subcommands, and all subcommands
work on tasks. This leaves no room for subcommands that work on other
CVAT resources.

This change redesigns the CLI interface by adding another level of
subcommand hierarchy. Instead of running `cvat-cli <action>`, the user
will now run `cvat-cli <resource> <action>`. Previously available
commands are left available as deprecated aliases.

As a proof of concept, this PR adds some basic project actions.

I have also used this opportunity to correct some of the task action
names, specifically `export`, `import`, `dump` and `upload`. These names
don't correspond to either SDK function names, API endpoints, or UI
labels corresponding to these actions. In the new subcommand hierarchy,
I renamed those commands to `backup`, `create-from-backup`,
`export-dataset` and `import-dataset`, which are more consistent with
how other CVAT components call these actions.

I rewrote the introduction and usage sections of the cli README and
reference in order to reduce clutter and remove the need to
resynchronize the help output after every interface change.
2024-12-11 15:20:47 +02:00
Kirill Lakhov ebe3dd6f99 Fixed sonar cloud issues (#8779) 2024-12-05 18:24:01 +02:00
Andrey Zhavoronkov 9091be814d Prepare chunks in a worker process (#8618)
<!-- Raise an issue to propose your change
(https://github.com/cvat-ai/cvat/issues).
It helps to avoid duplication of efforts from multiple independent
contributors.
Discuss your ideas with maintainers to be sure that changes will be
approved and merged.
Read the [Contribution guide](https://docs.cvat.ai/docs/contributing/).
-->

<!-- Provide a general summary of your changes in the Title above -->
Added:

- Prepare chunks in rq workers instead of application server process
- Increase TTL for cached preview images

### Motivation and context
<!-- Why is this change required? What problem does it solve? If it
fixes an open
issue, please link to the issue here. Describe your changes in detail,
add
screenshots. -->

### How has this been tested?
<!-- Please describe in detail how you tested your changes.
Include details of your testing environment, and the tests you ran to
see how your change affects other areas of the code, etc. -->

### Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply.
If an item isn't applicable for some reason, then ~~explicitly
strikethrough~~ the whole
line. If you don't do that, GitHub will show incorrect progress for the
pull request.
If you're unsure about any of these, don't hesitate to ask. We're here
to help! -->
- [x] I submit my changes into the `develop` branch
- [x] I have created a changelog fragment <!-- see top comment in
CHANGELOG.md -->
- [ ] I have updated the documentation accordingly
- [ ] I have added tests to cover my changes
- [ ] I have linked related issues (see [GitHub docs](

https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword))
- [ ] I have increased versions of npm packages if it is necessary

([cvat-canvas](https://github.com/cvat-ai/cvat/tree/develop/cvat-canvas#versioning),

[cvat-core](https://github.com/cvat-ai/cvat/tree/develop/cvat-core#versioning),

[cvat-data](https://github.com/cvat-ai/cvat/tree/develop/cvat-data#versioning)
and

[cvat-ui](https://github.com/cvat-ai/cvat/tree/develop/cvat-ui#versioning))

### License

- [x] I submit _my code changes_ under the same [MIT License](
https://github.com/cvat-ai/cvat/blob/develop/LICENSE) that covers the
project.
  Feel free to contact the maintainers if that's a concern.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Introduced new debugging configurations for various RQ workers,
enhancing debugging capabilities.
- Added a new service for processing chunks in Docker and Kubernetes
configurations.
- Enhanced error handling in data retrieval methods to manage timeout
scenarios effectively.

- **Bug Fixes**
- Improved robustness of job-related functionalities with enhanced test
coverage and validation checks.

- **Documentation**
- Updated API documentation settings and configurations for better
clarity and usability.

- **Tests**
- Expanded test suite with new test cases and parameterization for
comprehensive validation of task and cloud storage functionalities.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-11-28 17:32:50 +03:00
Roman Donchenko 3265e1f464 SDK/CLI: improve mask support in the auto-annotation functionality (#8724)
While it is already possible to output mask shapes from AA functions,
which the driver _will_ accept, it's not convenient to do so. Improve
the practicalities of it in several ways:

* Add `mask` and `polygon` helpers to the interface module.

* Add a helper function to encode masks into the format CVAT expects.

* Add a built-in torchvision-based instance segmentation function.

* Add an equivalent of the `conv_mask_to_poly` parameter for Nuclio
functions.

Add another extra for the `masks` module, because NumPy is a fairly
beefy dependency that most SDK users probably will not need (and
conversely, I don't think we can implement `encode_mask` efficiently
without using NumPy).
2024-11-25 14:53:05 +02:00
Roman Donchenko 3eec9fef2d SDK/CLI: Add ability to call auto-annotation functions with a custom threshold (#8688)
My main motivation is to support a future feature, but I think this is a
good thing in its own right.

While it's already possible to create an AA function that lets you
customize the threshold (by adding a creation parameter), confidence
scoring is very common in detection models, so it makes sense to make
this easier to support, both for the implementer of the function, and
for its user.
2024-11-14 18:23:01 +02:00
Roman Donchenko a56e94b00d tests: remove imports that were deprecated in Python 3.9 (#8643)
And also `abstractstaticmethod`, which was deprecated in 3.3.

This is a continuation of #8626.
2024-11-06 15:51:53 +02:00
Roman Donchenko 23e1e0a853 Fix return type annotations for functions used with @contextmanager (#8617)
Some of them are annotated with an `Iterator` return type. However...

It just occurred to me that `@contextmanager` cannot work with a
function that returns a plain iterator, since it relies on the generator
class's `throw` method. `contextmanager` is defined in typeshed as
accepting an iterator-returning function, but that appears to be a bug:
<https://github.com/python/typeshed/issues/2772>.

Change all such annotations to a `Generator` type instead.

Some annotations are also broken in other ways; fix them too.
2024-10-30 15:31:54 +02:00
Roman Donchenko 9ecafb6029 Make the --insecure CLI option test less hacky (#8601)
Test it by starting an HTTPS server (that forwards all requests to CVAT)
and attempting to access that server via the CLI. This allows us to test
that the option actually works end-to-end, and avoids dependencies on
CLI internals.

The new test requires `main` to catch the exception that is raised in
the case of a certificate error, so implement that.
2024-10-30 12:31:57 +02:00
Roman Donchenko 6c57c0389a Update documentation and repo links after transfer to the cvat-ai organization (#7722) 2024-04-05 14:12:59 +03:00
Roman Donchenko b0b8e492eb SDK: Add predefined functions based on torchvision (#6649)
These serve as a replacement for YOLOv8n that was removed in #6632.

To support these functions, I also add an ability to define
parameterized functions for use with the CLI.
2023-08-11 14:21:57 +03:00
Roman Donchenko 1c0a49fc80 Add auto-annotation support to SDK and CLI (#6483)
Introduce a `cvat-sdk auto-annotate` command that downloads data for a task,
then runs a function on the local computer on that data, and uploads
resulting annotations back to the task.

To support this functionality, add a new SDK module,
`cvat_sdk.auto_annotation`, that contains an interface that the
functions must follow, and a driver that applies a function to a task.

This will let users easily annotate their tasks with custom DL models.
2023-08-02 20:30:05 +03:00
Roman Donchenko 1bc77671e3 generate_image_file: don't hardcode the file format (#6538)
It doesn't make much sense to encode the image as JPEG if the given file
name is "image.png". Instead, let PIL select the format based on the
requested file name.
2023-07-23 22:59:28 +03:00
Roman Donchenko 871756d3c3 Add organization support to the CLI (#6317)
This is the CLI equivalent of #5718.
2023-06-15 13:43:12 +03:00
Maxim Zhiltsov 8df8872a85 Fix predefined sorting for task data (#5083)
Fixes #5061, #4179

- Added a way to declare custom file ordering for the local task data
uploads via TUS protocol
- Added an option to use a manifest to support the `predefined` sorting
method
- This file is required for the `predefined` sorting mode with image
archives
- Fixed file ordering when tasks are created from SDK or CLI in the
`predefined` sorting mode
- Added more tests for task data uploading API

The uploading protocol is implemented:

The user specifies `sorting_method=predefined` if the task creation
request. Then the data is uploaded.

1. Client files uploading
1.1. The files are uploaded as separate files (using the TUS protocol)
or grouped files (using the `Upload-Multiple` requests).
1.2. The `Upload-Finish` request comes (or its unlabeled legacy
equivalent). The new optional field can be supplied: `upload_file_order`
- a list of strings. It allows to override the input file order, if
necessary, and is only valid with the `predefined` sorting method
specified.
1.2.1. If the field is empty or missing, the client files in the data
requests are considered ordered.
1.2.2. If the field is not empty, a list containing the file list in the
required order is expected in the `upload_file_order` field.
1.2.2.1. If there are `client_files` in the request, the files are
sorted
1.2.2.2. If file lists mismatch, an explanatory error is raised.

2. Data processing
2.1. At this point, all `*_files` are considered ordered as requested.
2.2. Require a metafile for zip uploads with predefined sorting. The
file is expected to accompany the uploaded zip file, not to be inside of
the archive.
2.3. If there is a metafile in the input data, files are ordered after
the metafile.
2.3.1. If the data is extracted from cloud, only the specified subset of
the files is kept in the manifest.
2.3.2. If the upload data doesn't exist in the metafile, an error is
raised.
2.3.3. A `job_file_mapping` has higher priority than metafile, if
specified.

Co-authored-by: Roman Donchenko <roman@cvat.ai>
2023-06-08 15:32:14 +03:00
Roman Donchenko 0a032b3236 Migrate to using pathlib in most of the SDK (#5435)
For user-facing functions, keep accepting `str` paths to maintain
compatibility and flexibility, but add support for arbitrary path-like
objects. For internal functions (in `downloading.py` and
`uploading.py`), don't bother and require `pathlib.Path`.

The only code that isn't converted is build-time code (e.g. `setup.py`)
and code that came from openapi-generator.
2022-12-08 17:01:49 +02:00
Roman Donchenko 481630e719 Migrate tests/python to from os.path to pathlib (#5426)
`pathlib` improves code readability and type safety. It is already used
in some of the tests; convert all remaining `os.path` usage to `pathlib`
equivalents.
2022-12-05 21:43:09 +02:00
Kirill Sizov ce09f28512 Fix SDK tests: login once per class (#5123) 2022-10-18 13:00:31 +03:00
Maxim Zhiltsov 2e15025434 Check server version in SDK (#4935) 2022-09-30 21:55:33 +03:00
Maxim Zhiltsov 68375ec23e Add SDK docs (#4928)
- Added auth docs in API schema and SDK ApiClient/Config (fixes #1517)
- Added SDK docs with API, SDK and CLI docs
- Added `develop` branch in the docs
- Allowed unauthorized access to `api/docs`, `api/swagger`, `api/schema` endpoints
- Added `--insecure` env var to control host checks in CLI
- Refactored `build_docs.py` (backported https://github.com/openvinotoolkit/datumaro/pull/589)
- Extracted requirements file for site
2022-09-15 19:54:19 +03:00
Maxim Zhiltsov 53697ecac5 SDK layer 2 - cover RC1 usecases (#4813) 2022-08-26 21:29:38 +03:00
Maxim Zhiltsov 5f58a0f7be Add 2nd layer of SDK (#19) 2022-08-16 11:52:15 +03:00