flasky icon indicating copy to clipboard operation
flasky copied to clipboard

Package used for Flasky API does not include a version number in its name

Open bkline opened this issue 3 years ago • 8 comments

In chapter 14 of Flask Web Development, 2nd ed., we read

Note how the package used for the API includes a version number in its name.

However the name of the package is api without any version number.

bkline avatar Apr 12 '21 15:04 bkline

Yes. This is a change that was made in the repository after publication. While it is okay to use the version number in the package name in most cases it isn't necessary because the version can still be applied in the URL as a prefix, as you can see here: https://github.com/miguelgrinberg/flasky/blob/master/app/init.py#L43.

miguelgrinberg avatar Apr 12 '21 16:04 miguelgrinberg

Ah, in that case I would suggest adding a README.md to the api directory, explaining what you just wrote. A comment in the package's __init__.py wouldn't be a waste of time either. This way, you can dispel confusion which would arise for other readers. You might also want to have the publisher fix the electronic version of the book.

bkline avatar Apr 12 '21 17:04 bkline

As I continue reading along in the chapter, I can't help wondering: how did the paths for the chapter's code examples get fixed (to remove the number) if that decision wasn't made until after publication?

bkline avatar Apr 12 '21 20:04 bkline

I don't have a copy of the book at hand right now to check. Do you have the 1st or 2nd edition? The first edition used the api_1_0 name (code is here). In the second edition the name changed to api. If there is a reference to api_1_0 in the text of the second edition, then that is an error.

miguelgrinberg avatar Apr 13 '21 08:04 miguelgrinberg

I have the second edition. This repository matches that edition, so it wouldn't do me much good if I had the first edition. 😉

If there is a reference to api_1_0 in the text of the second edition, then that is an error.

There aren't any. That's why I wrote

... how did the paths for the chapter's code examples get fixed (to remove the number) if that decision wasn't made until after publication?

It's looking more and more as if the decision to change the name of the package, removing the numbers, was made before publication of the second edition, not after. And the sentence I'm reporting in this issue:

Note how the package used for the API includes a version number in its name.

... was actually held over by mistake from the first edition. You're confirming that in your previous comment, it seems:

In the second edition the name changed to api.

I will say that it is very rare these to get to the 14th chapter of a software development book before finding something which didn't make sense. Somewhat reminiscent of the early days of O'Reilly, when their editors were really good. 👍

bkline avatar Apr 13 '21 10:04 bkline

Okay, sorry, I think now we are finally on the same page about this. You are correct, that sentence is the only problem, and it is an inadvertent carry over from the 1st edition that needed to be removed. I'll make a correction on the manuscript so that it is fixed the next time the book is printed and or the e-book re-rendered.

miguelgrinberg avatar Apr 13 '21 13:04 miguelgrinberg

Hello,

I have gone through the book with my students and we have made Flasky web app, with minimal changes (e.g. using Bootstrap-Flask package instead of Flask-Bootstrap, pyjwt instead of itsdangerous) to make it work with the newest versions of all the packages used in the project. I can confirm that everything works.

I would like to ask whether there are any plans on the printed 3rd edition of the book? I am about to buy the printed 2nd edition, so I am asking that perhaps I should wait for the 3rd, if it's coming in the near future.

This question was also mentioned in this issue: https://github.com/miguelgrinberg/flasky/issues/440, and as I understand Flask did not yet change in a considerable way.

Thank you for the answer:)

00riddle00 avatar Nov 05 '22 15:11 00riddle00

@00riddle00 If it was up to me, there would already be a 3rd edition out, updated with all latest versions of Flask and all other dependencies. But I do not make this call. The list of changes/updates is fairly small, so the publisher does not consider it worthwhile to create a 3rd edition.

miguelgrinberg avatar Nov 05 '22 18:11 miguelgrinberg