conan-io / conan-io/docs

[bug] conan.tools.scm.Version cannot be used from conan.tools import

Open
#2,706 4 comments 0 reactions 1 assignee Claimed by @memsharded View on GitHub
type: question
Dominant language
C++
Stars
125
Forks
382
Avg merge
22h 39m
Merged PRs (30d)
21

Description

Happens at least in conan 1.51.3 / 1.51.2 / 1.51.1 / 1.50.2 / 1.50.1 / 1.50.0

```
(conan) λ python
Python 3.10.2 (tags/v3.10.2:a58ebcc, Jan 17 2022, 14:12:15) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from conan import tools
>>> tools.scm.Version("1.2.1")
Traceback (most recent call last):
File "", line 1, in
AttributeError: module 'conan.tools' has no attribute 'scm'
```

The workaround is easy as importing like this works fine:
```
from conan.tools import scm
>>> scm.Version("1.2.1")
1.2.1
>>> from conan.tools.scm import Version
>>> Version("1.2.1")
1.2.1
```

However the `tools.scm.Version` should be possible for anyone to use it

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.