Bug 257369 - [NEW PORT] www/py-fastapi-users: Ready-to-use and customizable users management for FastAPI
Summary: [NEW PORT] www/py-fastapi-users: Ready-to-use and customizable users manageme...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Hiroki Tagato
URL:
Keywords: feature
Depends on: 254038 257370 260879 260880 261190
Blocks: 257868 260845
  Show dependency treegraph
 
Reported: 2021-07-24 00:21 UTC by Goran Mekić
Modified: 2022-01-29 06:55 UTC (History)
5 users (show)

See Also:
meka: maintainer-feedback+


Attachments
fastapi-users.diff (3.70 KB, patch)
2021-07-24 00:21 UTC, Goran Mekić
no flags Details | Diff
fastapi-users.diff (3.75 KB, patch)
2021-07-26 09:15 UTC, Goran Mekić
no flags Details | Diff
fastapi-users.diff (3.82 KB, patch)
2021-07-26 10:44 UTC, Goran Mekić
no flags Details | Diff
fastapi-users.diff (4.52 KB, patch)
2021-07-26 11:01 UTC, Goran Mekić
no flags Details | Diff
fastapi-users.diff (4.43 KB, patch)
2021-12-31 11:04 UTC, Goran Mekić
meka: maintainer-approval+
Details | Diff
fastapi-users.diff (4.47 KB, patch)
2022-01-01 12:42 UTC, Goran Mekić
meka: maintainer-approval+
Details | Diff
fastapi-users.diff (4.45 KB, patch)
2022-01-24 18:22 UTC, Goran Mekić
meka: maintainer-approval+
Details | Diff
fastapi-users.diff (6.30 KB, patch)
2022-01-25 09:20 UTC, Goran Mekić
meka: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Goran Mekić 2021-07-24 00:21:25 UTC
Created attachment 226646 [details]
fastapi-users.diff

QA:

  * portlint: OK (looks fine.)
  * testport: OK (poudriere: 13.0, amd64 tested)
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2021-07-24 02:04:47 UTC
Great job Goran. Review items:

All *_DEPENDS need to match upstream version specs [1], in this case including the max versions, unless they are patched (patched deps must be tested/confirmed to work with test suites)

Painful, but necessary. Please encourage upstreams to distribute (sdist) dependencies of the form >=, so they can develop against, test and fix issues with later versions as early as possible (ideally before users do and are impacted)

requires = [
    "fastapi >=0.65.2,<0.67.0",
    "passlib[bcrypt] ==1.7.4",
    "email-validator >=1.1.0,<1.2",
    "pyjwt ==2.1.0",
    "python-multipart ==0.0.5",
    "makefun >=1.9.2,<1.12",
    "typing-extensions >=3.7.4.3; python_version < '3.8'",
    "Deprecated >=1.2.10,<2.0.0"
]

[tool.flit.metadata.requires-extra]
sqlalchemy = [
    "sqlalchemy >=1.3.13,<1.4",
    "databases >=0.3.0,<0.5",
]
mongodb = [
    "motor >=2.2.0,<3.0.0",
]
tortoise-orm = [
    "tortoise-orm >=0.16.0,<0.18.0"
]
ormar = [
    "ormar >=0.9.5,<0.11.0"
]
oauth = [
    "httpx-oauth >=0.3,<0.4"
]

[1] https://wiki.freebsd.org/Python/PortsPolicy#Dependencies
Comment 2 Goran Mekić 2021-07-24 02:12:20 UTC
How do I specify min and max? I tried with this:
${PYTHON_PKGNAMEPREFIX}makefun>=1.11.2,<1.12:devel/py-makefun@${PY_FLAVOR}

No luck.
Comment 3 Kubilay Kocak freebsd_committer freebsd_triage 2021-07-26 06:53:41 UTC
(In reply to Goran Mekić from comment #2)

As far as I know both >x,<y and x<y 'work', but there 'may' (still?) be caveats with the first (comma) one, even though its the better syntax.

What symptoms do you see with the former?
Comment 4 Goran Mekić 2021-07-26 09:15:08 UTC
Created attachment 226710 [details]
fastapi-users.diff

It works now. No idea what was wrong but I probably made some typo (or I should blame LSD in the water pipes :o). Anyway, here's the revised patch.
Comment 5 Goran Mekić 2021-07-26 10:44:34 UTC
Created attachment 226713 [details]
fastapi-users.diff

Added transient dependency and figured out what was wrong with min,max versions. Max can only have <max, not <=max.
Comment 6 Goran Mekić 2021-07-26 11:01:02 UTC
Created attachment 226715 [details]
fastapi-users.diff

Added optional and transitional dependencies.
Comment 7 Kubilay Kocak freebsd_committer freebsd_triage 2021-07-28 02:21:36 UTC
Python doesn't need to block / be assignee on new ports
Comment 8 Kubilay Kocak freebsd_committer freebsd_triage 2021-07-28 02:22:01 UTC
Not sure why i merge-quarterly'd (?) this
Comment 9 Yasuhiro Kimura freebsd_committer freebsd_triage 2021-11-01 04:07:44 UTC
Take.
Comment 10 Yasuhiro Kimura freebsd_committer freebsd_triage 2021-11-01 04:21:03 UTC
I overlooked bug #254038 isn't ready to land yet. So return assignee to original one.
Comment 11 Hiroki Tagato freebsd_committer freebsd_triage 2021-12-26 03:18:17 UTC
There appears a more recent version (8.1.3) available. Would you care to update the patch to the latest version?
Comment 12 Goran Mekić 2021-12-31 11:04:26 UTC
Created attachment 230587 [details]
fastapi-users.diff

Although there are newer releases than this one, this is the last release with setup.py. As more and more Python packages are using poetry (https://pypi.org/project/poetry/) I'm guessing we, as FreeBSD community, will have to adopt to it soon(ish), at which point I'll update this port.
Comment 13 Hiroki Tagato freebsd_committer freebsd_triage 2022-01-01 05:29:37 UTC
Two small comments:
- The source archive includes the license file? If so, please set LICENSE_FILE.
- WWW in pkg-descr redirects to https://github.com/fastapi-users/fastapi-users, which seems now a canonical one.

Could you update the patch accordingly?
Comment 14 Goran Mekić 2022-01-01 12:42:15 UTC
Created attachment 230603 [details]
fastapi-users.diff

Thank you for the feedback, it really means a lot to a novice porter willing to learn!
Comment 15 Hiroki Tagato freebsd_committer freebsd_triage 2022-01-02 03:24:53 UTC
According to the output from portlint:

WARN: Makefile: no port directory /usr/ports/devel/py-makefun found, even though it is listed in RUN_DEPENDS.
WARN: Makefile: no port directory /usr/ports/devel/py-asgi-lifespan found, even though it is listed in TEST_DEPENDS.
WARN: Makefile: no port directory /usr/ports/www/py-httpx-oauth found, even though it is listed in TEST_DEPENDS.

Those are missing in the ports tree. Maybe those ports need to be added before committing this port?
Comment 16 Goran Mekić 2022-01-24 18:22:41 UTC
Created attachment 231282 [details]
fastapi-users.diff

As noted in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=257334#c5 I got no response from devel/py-asgi-lifespan team on github. As tests are already disabled for this port I made a comment for the future when asgi-lifespan is in shape.
Comment 17 Goran Mekić 2022-01-25 09:20:36 UTC
Created attachment 231304 [details]
fastapi-users.diff

I sent a PR to upstream to generate setup.py. In the mean time setup.py is generated by "flit build --setup-py" and extracted from there in the form of patch.
Comment 18 Hiroki Tagato freebsd_committer freebsd_triage 2022-01-26 08:11:37 UTC
Build of one of the dependencies (databases/py-ormar) fails with the following error:

=======================<phase: run-depends    >============================
===>   py38-ormar-0.10.23 depends on package: py38-databases>=0.3.2,<0.5.4 - not found
===>   Installing existing package /packages/All/py38-databases-0.5.5.pkg
[r130amd64-tests-job-01] Installing py38-databases-0.5.5...
[r130amd64-tests-job-01] `-- Installing py38-aiosqlite-0.17.0...
[r130amd64-tests-job-01] |   `-- Installing py38-sqlite3-3.8.12_7...
[r130amd64-tests-job-01] |   `-- Extracting py38-sqlite3-3.8.12_7: ........ done
[r130amd64-tests-job-01] `-- Extracting py38-aiosqlite-0.17.0: .......... done
[r130amd64-tests-job-01] `-- Installing py38-sqlalchemy14-1.4.31...
[r130amd64-tests-job-01] |   `-- Installing py38-greenlet-1.1.2...
[r130amd64-tests-job-01] |   `-- Extracting py38-greenlet-1.1.2: .......... done
[r130amd64-tests-job-01] `-- Extracting py38-sqlalchemy14-1.4.31: .......... done
[r130amd64-tests-job-01] Extracting py38-databases-0.5.5: .......... done
===>   py38-ormar-0.10.23 depends on package: py38-databases>=0.3.2,<0.5.4 - not found
*** Error code 1

Stop.
make: stopped in /usr/ports/databases/py-ormar

Could you review the version range specification?
Comment 19 Goran Mekić 2022-01-26 08:39:18 UTC
I forgot a dependent PR, sorry.
Comment 20 commit-hook freebsd_committer freebsd_triage 2022-01-29 06:55:21 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=5397c5e80dab3825d0edaa31746adcea47aa361a

commit 5397c5e80dab3825d0edaa31746adcea47aa361a
Author:     Goran Mekić <meka@tilda.center>
AuthorDate: 2022-01-29 06:52:38 +0000
Commit:     Hiroki Tagato <tagattie@FreeBSD.org>
CommitDate: 2022-01-29 06:54:40 +0000

    www/py-fastapi-users: add port: Ready-to-use and customizable users management for FastAPI

    Add quickly a registration and authentication system to your FastAPI project.
    FastAPI Users is designed to be as customizable and adaptable as possible.
    Features:
      * Extensible base user model
      * Ready-to-use register, login, reset password and verify e-mail routes
      * Ready-to-use social OAuth2 login flow
      * Dependency callables to inject current user in route
      * Pluggable password validation
      * Customizable database backend
        * SQLAlchemy async backend included thanks to encode/databases
        * MongoDB async backend included thanks to mongodb/motor
        * Tortoise ORM backend included
        * ormar backend included
      * Multiple customizable authentication backends
        * JWT authentication backend included
        * Cookie authentication backend included
      * Full OpenAPI schema support, even with several authentication backends

    WWW: https://github.com/fastapi-users/fastapi-users

    PR:             257369
    Reported by:    Goran Mekić <meka@tilda.center> (new maintainer)
    Reviewed by:    koobs

 www/Makefile                                    |  1 +
 www/py-fastapi-users/Makefile (new)             | 61 +++++++++++++++++++++++++
 www/py-fastapi-users/distinfo (new)             |  3 ++
 www/py-fastapi-users/files/patch-setup.py (new) | 52 +++++++++++++++++++++
 www/py-fastapi-users/pkg-descr (new)            | 19 ++++++++
 5 files changed, 136 insertions(+)
Comment 21 Hiroki Tagato freebsd_committer freebsd_triage 2022-01-29 06:55:47 UTC
Committed, thanks!