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

Use pip for package management #103

Open
nbdavies opened this issue Dec 4, 2018 · 2 comments
Open

Use pip for package management #103

nbdavies opened this issue Dec 4, 2018 · 2 comments

Comments

@nbdavies
Copy link

nbdavies commented Dec 4, 2018

What would it take to make this a viable pip package (and potentially hosted on PyPI)?

Making this a pip package could simplify installation, compiling the code, making it an executable, verifying/installing dependencies, and Python version compliance.

At the very least, I think making this a pip package would require a setup.py file. To manage this package's dependencies, that file would need some further customization.

@pts pts added the enhancement label Dec 4, 2018
@pts
Copy link
Owner

pts commented Dec 4, 2018

Thank you for bringing up this possible improvement!

It would be awesome to pick some low-hanging fruits to make pdfsizeopt (and its dependencies) easier to install and upgrade for its users. However, I can't see an obvious low-hanging fruit (small change bringing a big improvement). If you have ideas, please elaborate.

Please prepare a pull request to add a setup.py file. You may also want to add another .py file as the main entry point of the executable. As soon as the setup.py file is in the GitHub main branch, I'll upload pdfsizeopt to PyPI.

The Python package dependency list of pdfsizeopt is empty: it uses only standard Python modules (for Python 2.4, 2.5, 2.6 and 2.7).

However, pdfsizeopt has some external binary dependencies, such as Ghostscript (typically /usr/bin/gs). (I think that is impossible to model in a setup.py file.)

Making this a pip package could simplify installation,

I doubt it would, because it would make installing the external binary dependencies harder. Right now the installation instructions on https://github.com/pts/pdfsizeopt are easy to follow and unambiguous. The installation method starting with pip install pdfsizeopt quickly becomes complex and confusing:

  • Do we need sudo or not?
  • Which pip to use if there are multiple versions of Python installed to the system? (This is starting to become the norm.)
  • To which directory should the external binary dependencies be installed? With which command? Do we need sudo for that?
  • In the end, either the instructions are incorrect, or the user makes a mistake, and pdfsizeopt doesn't work for them. Terrible user experience for a first-time user, they will stop using pdfsizeopt immediately.

So even if pip install pdfsizeopt worked, I will still recommend new users to install as (now) instructed on https://github.com/pts/pdfsizeopt .

compiling the code,

Who is compiling which code, from which programming language to what? What are their pain points? How does a pip package help them?

making it an executable,

pdfsizeopt already has a multiplatform (Linux, macOS, Windows) binary release, distribution and upgrade mechanism, which I think is a good balance between user convenience and burden on the maintainer (me, @pts now). If you have an idea how pdfsizeopt should be doing it instead, please file another issue, and explain it there. I'm looking forward to your ideas.

verifying/installing dependencies,

pdfsizeopt works with these versions of Python: 2.4, 2.5, 2.6, 2.7. I can't see how pip would help installing and verifying the right version of Python. In addition to Python itself, pdfsizeopt has some binary dependencies, and pdfsizeopt is very picky on the version of some of those (for example, the latest stable release of Ghostscript doesn't work, pdfsizeopt needs 9.05 or 9.10). How would pip help here?

and Python version compliance.

How would pip help here?

@FredWahl
Copy link

I think it is an interesting idea. I also think there are ready made libraries that can do this. There's vcpkg for c++ projects and github itself could have code that does this. It's easier if you have a program with a user interface. It would be nice if you could do some research an figure out what options there are.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants