[Python] I can't install Python package the way I should

Discussão em 'Python' iniciado por Stack, Julho 8, 2025.

  1. Stack

    Stack Membro Participativo

    This is a homework task that I am able to complete, but not with the command the task says I should use.

    Task


    • Create a distributive package of the script from Task 1


    • Add setup.py


    • Tool name is snapshot (name="snapshot")


    • Add README.md with description how to install and use the tool https://docs.gitlab.com/ee/user/markdown.html


    • Note, you haven’t put any distributions to PR (*.whl, *.tar.gz, *.rpm and so on), only the project.

    To verify the package I should run:

    $ cd ..
    $ pip install -U ./snapshot
    $ snapshot -i 1


    I am only able to install it using the .whl file and it works as expected, the course didn't teach anything about making packages. I also don't get the last note in the tasks since I obviously won't be able to upload it to PyPI. The program itself works fine and I did everything as told, but obviously this way I fail the tests.

    The current project tree is

    .
    ├── build
    │ ├── bdist.linux-x86_64
    │ └── lib
    │ └── snapshot
    │ ├── __init__.py
    │ └── snapshot.py
    ├── dist
    │ ├── snapshot-0.1-py3-none-any.whl
    │ └── snapshot-0.1.tar.gz
    ├── README.md
    ├── requirements.txt
    ├── setup.py
    ├── snapshot
    │ ├── __init__.py
    │ └── snapshot.py
    ├── snapshot.egg-info
    │ ├── dependency_links.txt
    │ ├── entry_points.txt
    │ ├── PKG-INFO
    │ ├── SOURCES.txt
    │ └── top_level.txt
    ├── snapshot.json
    └── tox.ini


    The __init__.py is

    from .snapshot import main


    And the setup.py is

    from setuptools import setup, find_packages

    setup(
    name='snapshot',
    version='0.1',
    description='creates system snapshots',
    py_modules=['argparse', 'psutil', 'time', 'json', 'os'],
    packages=find_packages(),
    entry_points={
    "console_scripts": [
    "snapshot = snapshot.snapshot:main"
    ]
    }
    )

    Continue reading...

Compartilhe esta Página