Pelican: Generate requirements.txt in site skeleton

Created on 12 Nov 2018  路  10Comments  路  Source: getpelican/pelican

I came back to pelican after over a year and had to look at the docs when setting up a python environment, it would be good if the site skeleton added a requirements.txt

Most helpful comment

After installing Pelican, run:

pip freeze > requirements.txt

Does that not more-or-less accomplish your goal? Or am I still missing something?

All 10 comments

Hey Stuart. Glad to have you back. That said, I'm confused.. The Quickstart docs make it pretty clear what's needed to install Pelican, along with Markdown support if needed. What exactly is it that you lacked?

Also, not that I think it's particularly relevant, but... https://github.com/getpelican/pelican/tree/master/requirements

Requirements for what...?

requirements.txt for running pelican for somebodies site.

So, just the same requirements as the docs, mine looks like this:

beautifulsoup4==4.6.3
fabric==1.14.0
feedparser==5.2.1
lxml==4.2.5
Markdown==3.0.1
pandoc==1.0.2
pelican==3.7.1

Obviously markdown and some of the others might not be known to start with (but maybe can be worked out during the question/answer part of setting up the site).

Since my free time is in chunks with long gaps, I like not having to think too much and having a requirements.txt auto-added would have helped.

I could probably have a look at adding something like this, but I'm not sure where to start.

After installing Pelican, run:

pip freeze > requirements.txt

Does that not more-or-less accomplish your goal? Or am I still missing something?

It definitely would do it, however for whatever reason I didn't do it at the time ... possibly, because my brain turns off a bit when doing a tutorial or quickstart.

Here is a PR that generates a requirements.txt in the project skeleton

https://github.com/getpelican/pelican/pull/2445~~

https://github.com/getpelican/pelican/pull/2446

I'd like to think its presence would have reminded me to run pip freeze after installing markdown, so I'm on the fence about adding that bit to the docs.

pelican-quickstart gives a good starting point and already assumes pelican is installed. However, having dependencies specified in the generated scaffolding, whether it's pyproject.toml or requirements.txt, could still be useful for workflows like git pulling a website to a new development machine and getting the whole thing working with a .venv/bin/activate && pip3 install -r requirements.txt invocation or the pyproject.toml equivalent. Python developers might reasonably expect that to work in a site generated by a Python site generator.

@LouisJackman do you think the requirements generated in the PR here https://github.com/getpelican/pelican/pull/2446 is OK ?

Problem I have is that, this all assumes you have all the required packages installed when you run pelican-quickstart. Later on you decided to use this plugin, that reader, etc which has their own requirements and quickly your requirements.txt gets outdated. Now, you have an invalid requirements.txt that just doesn't work, which is worse than not having it IMO.

@stuaxo, it looks reasonable but @avaris's point about the requirements.txt falling out of synchronisation with actual dependencies once plugins, readers and other features are added is a good one. An invalid requirements.txt is more misleading than no requirements.txt. One possible way around that is to make themes and other plugins trivial to install via pip, but that's a whole other issue.

Until then, just further documenting the use of pip to handle Pelican dependencies seems good enough. Personally, I use pip for Pelican plugins that are on PyPI and git submodules for those that aren't; I'd be interested to know how others manage this.

Thanks.

@stuaxo: Given the concerns that @avaris raised, as well as the fact that some folks might prefer the newer pyproject.toml format instead of requirements.txt files, I'm inclined not to include this in Pelican at this time. Thanks for your understanding.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kele14x picture kele14x  路  7Comments

begueradj picture begueradj  路  7Comments

manelclos picture manelclos  路  7Comments

kiljungsub picture kiljungsub  路  6Comments

Moini picture Moini  路  6Comments