-
Notifications
You must be signed in to change notification settings - Fork 276
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
build: main() not required any more #635
build: main() not required any more #635
Conversation
b026cfe
to
6347b7c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the removal of __main__.py
, is it still possible to run python -m yamllint
?
I think it should work, >>> import importlib.metadata as metadata
>>>
>>> metadata.entry_points(name='yamllint')
[EntryPoint(name='yamllint', value='yamllint.cli:run', group='console_scripts')]
>>> Needs more work though, to get coverage tests to work. |
Since adding "yamllint.cli:run", we don't need a main() function.
6347b7c
to
0dda5bf
Compare
Actually $ pip install yamllint
Defaulting to user installation because normal site-packages is not writeable
Collecting yamllint
Using cached yamllint-1.33.0-py3-none-any.whl.metadata (4.2 kB)
Requirement already satisfied: pathspec>=0.5.3 in /usr/lib/python3/dist-packages (from yamllint) (0.9.0)
Requirement already satisfied: pyyaml in ./.local/lib/python3.11/site-packages (from yamllint) (6.0.1)
Using cached yamllint-1.33.0-py3-none-any.whl (65 kB)
Installing collected packages: yamllint
Successfully installed yamllint-1.33.0
$
$ yamllint --version
yamllint 1.33.0
$
$ python -m yamllint --version
/usr/bin/python: No module named yamllint
$ |
On my system, The documentation seems to agree with that:
Can you double-check? |
I am installing yamllint from PyPI: $
$ pip install yamllint --user --verbose
Using pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.11)
Collecting yamllint
Downloading yamllint-1.33.0-py3-none-any.whl (65 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 65.4/65.4 KB 2.0 MB/s eta 0:00:00
Requirement already satisfied: pyyaml in /usr/lib/python3/dist-packages (from yamllint) (5.4.1)
Requirement already satisfied: pathspec>=0.5.3 in /usr/lib/python3/dist-packages (from yamllint) (0.9.0)
Installing collected packages: yamllint
changing mode of /home/username/.local/bin/yamllint to 775
Successfully installed yamllint-1.33.0
$
$ yamllint --version
yamllint 1.33.0
$
$ python -m yamllint --version
/usr/bin/python: No module named yamllint
$ Have I done something wrong? |
Something is wrong after all: $ which python
/usr/bin/python
$
$ ls -l /usr/bin/python
lrwxrwxrwx 1 root root 7 Oct 11 2021 /usr/bin/python -> python3
$
$ ls -l /usr/bin/python3
lrwxrwxrwx 1 root root 10 Aug 18 2022 /usr/bin/python3 -> python3.10
$
$ python --version
Python 3.10.12
$
$ which pip
/home/username/.local/bin/pip
$
$ /home/username/.local/bin/pip --version
pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.11)
$ This version of $ ls -ld /home/username/.local/lib/python3.10/site-packages/yaml*
ls: cannot access '/home/username/.local/lib/python3.10/site-packages/yaml*': No such file or directory
$
$ ls -ld /home/username/.local/lib/python3.11/site-packages/yaml*
drwxrwxr-x 5 username username 4096 Jan 12 08:41 /home/username/.local/lib/python3.11/site-packages/yamllint
drwxrwxr-x 2 username username 4096 Jan 12 08:41 /home/username/.local/lib/python3.11/site-packages/yamllint-1.33.0.dist-info
$ Let me retry after cleaning up. |
It works now:
|
Since adding
"yamllint.cli:run"
, we don't need amain()
function.