Skip to content

Package with setuptools to be installable with pip.#2

Open
paulguy wants to merge 1 commit into
AkBKukU:mainfrom
paulguy:packaging
Open

Package with setuptools to be installable with pip.#2
paulguy wants to merge 1 commit into
AkBKukU:mainfrom
paulguy:packaging

Conversation

@paulguy
Copy link
Copy Markdown

@paulguy paulguy commented May 4, 2025

This should allow to install at least to a venv. A dummy discrip.py was added to the root that just imports the original discrip.py and runs main() so the project works the same way as before where the script can be executed from the directory standalone.

I'm not super familiar with this and not super confident it's entirely correct but it works for me. Also, the metadata is pretty barebones and maybe you'll want to review it and suggest changes/additions before merging it in.

Also, I don't know if it can be installed "systemwide" as it seems to consider the subdirectories as separate "packages" which might install globally but with very common names like config and handler. I've only tested installing to a venv.

Comment thread pyproject.toml Outdated
"python-libdiscid",
"musicbrainzngs",
"unidecode",
"ffmpeg"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be ffmpeg-python, according to the API reference.

Comment thread discrip.py Outdated
@@ -1,213 +1,6 @@
#!/usr/bin/env python3
#!/usr/bin/env python
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should keep python3 as Ubuntu 24.04 does not recognize python. All other files in this repo use python3.

@paulguy
Copy link
Copy Markdown
Author

paulguy commented May 7, 2025

I made the changes, and also added the correct license to the classifiers. Seems to install and run from a fresh venv.

@paulguy
Copy link
Copy Markdown
Author

paulguy commented May 9, 2025

Bleh, I always hate git even though it's probably the best VCS. The requested changes are actually pushed now.

Comment thread pyproject.toml Outdated
"python-libdiscid",
"musicbrainzngs",
"unidecode",
"ffmpeg-python"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noticed you also need the greaseweazle package, which is not published to PyPI:

Suggested change
"ffmpeg-python"
"ffmpeg-python",
"greaseweazle @ git+https://github.com/keirf/greaseweazle.git@master"

For reference:

(.venv) ~/d/pyDiscRip (pr/2)> rg import_module
handler/media/floppy.py
69:        mod = importlib.import_module('greaseweazle.tools.read')

handler/data/flux.py
65:        mod = importlib.import_module('greaseweazle.tools.convert')
(.venv) ~/d/pyDiscRip (pr/2)>

Comment thread pyproject.toml Outdated

[project]
name = "pyDiscRip"
version = "1.0"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should use the same version used in code:

musicbrainzngs.set_useragent("AkBKukU: pyDiscRip", "0.1", "akbkuku@akbkuku.com")

Suggested change
version = "1.0"
version = "0.1"

Comment thread pyproject.toml
"unidecode",
"ffmpeg-python"
]

Copy link
Copy Markdown

@vetleledaal vetleledaal May 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not exactly sure where it fits, but I think it would be beneficial to list out external dependencies. I found the Requires-External directive in the docs, but it does not seem to be widely used at all. As the docs say it also does not do anything with those fields.

More practically it might fit in the readme (for simplicity, these can be combined):

sudo apt-get update

# Compile time dependencies
sudo apt-get install --no-install-recommends \
    build-essential \
    libdiscid-dev

# Runtime dependenices
sudo apt-get install --no-install-recommends \
    bchunk \
    cdrdao \
    ffmpeg \
    gddrescue \
    mtools \
    7zip
  • bchunk provides: bchunk
  • cdrdao provides: cdrdao, toc2cddb, toc2cue
  • ffmpeg provides: ffmpeg, ffplay, ffprobe, qt-faststart
  • gddrescue provides: ddrescue, ddrescuelog
  • mtools provides: lz, mattrib, mbadblocks, mcat, mcd, mcheck, mcomp, mcopy, mdel, mdeltree, mdir, mdu, mformat, minfo, mkmanifest, mlabel, mmd, mmount, mmove, mpartition, mrd, mren, mshortname, mshowfat, mtools, mtoolstest, mtype, mxtar, mzip, tgz, uz
  • 7zip provides: 7z, 7za, 7zr, p7zip

This should allow to install at least to a venv.  A dummy discrip.py was
added to the root that just imports the original discrip.py and runs
main() so the project works the same way as before where the script can
be executed from the directory standalone.
@paulguy
Copy link
Copy Markdown
Author

paulguy commented May 9, 2025

Made the changes. The version there was just part of a template and yeah i wasn't going to find that haha. I'm not experienced with this so there's probably more wrong with it.

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

Successfully merging this pull request may close these issues.

2 participants