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

rename the http folder to a better name, than python #24

Closed
wants to merge 1 commit into from

Conversation

matzew
Copy link
Contributor

@matzew matzew commented Dec 18, 2024

Changes

  • as per title

/kind

Fixes #

Release Note


Docs


Copy link

knative-prow bot commented Dec 18, 2024

@matzew: The label(s) kind/<kind> cannot be applied, because the repository doesn't have them.

In response to this:

Changes

  • as per title

/kind

Fixes #

Release Note


Docs


Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link

knative-prow bot commented Dec 18, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: matzew

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Dec 18, 2024
Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>
@matzew matzew force-pushed the rename_folder_to_http branch from 86640ba to 3b6eb20 Compare December 18, 2024 16:50
@lkingland
Copy link
Contributor

lkingland commented Dec 19, 2024

I don't think this will quite work as intended.

I might be wrong, but this package is already published on PyPI as "func-python" (and imported as "func_python". By changing this, we might need to duplicate, or at least complicate, all our configuration or process to publish two separate packages; one for each of "http" and "cloudevents".

Furthermore, it is my understanding the "Pythonic" idiom is to use files as modules, rather than directories (which is idiomatic in Go). Thus in Python one would expect an http.py and a cloudevent.py to implement the HTTP and CloudEvent modules, respectively.

This alignment 1:1 from published package name to import name is the reason the current codebase does not require "packages" be explicitly defined in the pyproject.toml.

I am fairly sure the current file hierarchy and package names are correct, and that the simplest option moving forward is to simply add "cloudevents.py" file right beside "http.py". This would be imported as from func_python.cloudevents import serve.

I am happy to entertain proof otherwise, because I am not a Python packaging expert!

Comment on lines +5 to +8
packages = [
{ include = "func_http", from = "src" },
]

Copy link
Contributor

Choose a reason for hiding this comment

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

The reason the folder is named func_python is such that it matches the package name as published on PyPI func-python. Hence the reason there's no need for an explicit packages section in the pyproject.toml

@@ -4,7 +4,7 @@
import signal
import threading
import time
from func_python.http import serve
from func_http.http import serve
Copy link
Contributor

Choose a reason for hiding this comment

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

With an http.py and a cloudevents.py file in the func_python directory, the two imports would be:
from func_python.http import serve for HTTP middleware and
from func_python.cloudevents import serve for CloudEVent middleware
That seems correct to me

@matzew
Copy link
Contributor Author

matzew commented Dec 19, 2024

/close

thanks for the insights. Agree not needed

@knative-prow knative-prow bot closed this Dec 19, 2024
Copy link

knative-prow bot commented Dec 19, 2024

@matzew: Closed this PR.

In response to this:

/close

thanks for the insights. Agree not needed

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@@ -1,6 +1,6 @@
import argparse
import logging
from func_python.http import serve
from func_http.http import serve
Copy link
Contributor Author

Choose a reason for hiding this comment

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

looking now at this I see that func_http.http is a bit unfortunate as well 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants