Skip to content
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

Directory structure reorganization #47

Closed
denilsonsa opened this issue Feb 1, 2024 · 1 comment
Closed

Directory structure reorganization #47

denilsonsa opened this issue Feb 1, 2024 · 1 comment

Comments

@denilsonsa
Copy link
Contributor

The current directory structure of this project is:

.
├── LICENSE
├── pyproject.toml
├── README.md
├── setup.py
├── src
│   ├── genRSS.py
│   └── util.py
└── test
    └── ...

Major issue: file pollution

When installing the package, this will happen:

venv/lib/python3.11/site-packages
├── eyed3/
├── filetype/
├── mutagen/
├── ...
├── genRSS.py
└── util.py

Both the genRSS.py and the util.py will be installed at the root of the python modules. This means it is possible to import util from anywhere:

$ ipython

In [1]: import util

In [2]: # ↑ That should have failed!

You can also check this behavior by inspecting the contents of the wheel file available from PyPI:

$ wget https://.../generss-0.3.0-py3-none-any.whl
$ unzip -l generss-0.3.0-py3-none-any.whl                                                   INT ✘ 
Archive:  generss-0.3.0-py3-none-any.whl
  Length      Date    Time    Name
---------  ---------- -----   ----
    10167  2023-09-13 21:15   genRSS.py
    19457  2023-09-13 19:33   util.py
     1074  2023-09-13 21:16   generss-0.3.0.dist-info/LICENSE
     3780  2023-09-13 21:16   generss-0.3.0.dist-info/METADATA
       92  2023-09-13 21:16   generss-0.3.0.dist-info/WHEEL
       39  2023-09-13 21:16   generss-0.3.0.dist-info/entry_points.txt
       12  2023-09-13 21:16   generss-0.3.0.dist-info/top_level.txt
      613  2023-09-13 21:16   generss-0.3.0.dist-info/RECORD
---------                     -------
    35234                     8 files

That's not good.

Expected structure (AKA solution)

I expected this structure:

venv/lib/python3.11/site-packages
├── ...
└── genRSS/
    ├── __main__.py
    └── util.py

Which means we have to move some files around the repository:

  • src/genRSS.pysrc/genRSS/__main__.py
  • src/util.pysrc/genRSS/util.py

And also setup Entry Points inside pyproject.toml.

See also:

Dependencies

We have this in pyproject.toml:

dependencies = ["mutagen==1.47.0", "eyed3==0.9.7"]

Why hard-coding the versions? Can't we just specify the minimum version instead? Or just leave out the version number, letting it auto-update the dependencies?

Minor cleanup: setup.py

setup.py is only needed for legacy build systems or legacy versions. It shouldn't be needed or used anymore. I suggest deleting it.

@amsehili
Copy link
Owner

amsehili commented Dec 1, 2024

Fixed by 295dfe0 and a8d7851, thanks.

@amsehili amsehili closed this as completed Dec 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants