-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Allow namespaces to be set to python module #2000
Allow namespaces to be set to python module #2000
Conversation
@Tarrasch, thanks for your PR! By analyzing the history of the files in this pull request, we identified @jcrobak, @steenzout and @freider to be potential reviewers. |
1cbe481
to
9db6af3
Compare
Anyone wants to review? @erikbern @dlstadther |
lgtm but are namespaces widely used? idk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I don't use (nor fully understand) namespaces, I focused my review on docstrings and their clarity.
I've made note of some spelling and english grammar changes.
luigi/task.py
Outdated
``scope=__name__``. | ||
|
||
The ``scope`` keyword makes so this call is only affective for task classes | ||
with a matching [*]_ ``__module__``. The default value for ``scope`` is the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
English correction (if understand correctly):
The scope
keyword makes it so that this call is only effective for task classes with a matching [*]___module__
.
luigi/task.py
Outdated
|
||
.. code-block:: python | ||
|
||
class Task2(luigi.Task): | ||
task_namespace = 'namespace2' | ||
|
||
This explicit setting takes priority over whatever is set in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
over whatever is set in the
luigi/task.py
Outdated
reasons: | ||
|
||
* Two tasks with the same name will not have conflicting task families | ||
* It's more pythonic, as modules are pythons recommended way to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Python's
luigi/task.py
Outdated
* Two tasks with the same name will not have conflicting task families | ||
* It's more pythonic, as modules are pythons recommended way to | ||
do namespacing. | ||
* It's traceable, when you see the full name of a task, you can immedietly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's traceable. When you see the full name of a task, you can immediately
luigi/task.py
Outdated
* It's traceable, when you see the full name of a task, you can immedietly | ||
identify where it is defined. | ||
|
||
We recommend to call this function from your package's outermost |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We recommend calling this function...
@erikbern, that's a really good concern actually. I'm not sure either if people use namespaces. But here's some related facts and thoughts:
@dlstadther, thanks. I'll fix these lingual issues right away. :) |
This have been a problem I've thought about for years. And also consciously gradually refactored the code base in previous patches towards making this relatively short path. Coming up with the final syntax and implementation also took me a while. Initially I imagined there would be a [config] parameter one could set, or specify by command line. But it turned out to be quite troublesome: * It's not clear how much it should affect. Should it also affect the things luigi exports? * It's hard to transition into it. Imagining a company with independent teams, the `auto_namespace` function can be applied package by package, luigi-version by luigi-version to whoever chooses to apply this new convention. This solution came out to be pretty clean, and with readable tests and detailed and a bit opinionated documentation.
9db6af3
to
8550df4
Compare
sounds good! |
I've adressed all the errors in the latest commit :) (also, this is first time im pressing dismiss)
This have been a problem I've thought about for years. And also consciously gradually refactored the code base in previous patches towards making this relatively short path. Coming up with the final syntax and implementation also took me a while. Initially I imagined there would be a [config] parameter one could set, or specify by command line. But it turned out to be quite troublesome: * It's not clear how much it should affect. Should it also affect the things luigi exports? * It's hard to transition into it. Imagining a company with independent teams, the `auto_namespace` function can be applied package by package, luigi-version by luigi-version to whoever chooses to apply this new convention. This solution came out to be pretty clean, and with readable tests and detailed and a bit opinionated documentation.
This have been a problem I've thought about for years. And also
consciously gradually refactored the code base in previous patches
towards making this relatively short path.
Coming up with the final syntax and implementation also took me a while.
Initially I imagined there would be a [config] parameter one could set,
or specify by command line. But it turned out to be quite troublesome:
things luigi exports?
teams, the
auto_namespace
function can be applied package bypackage, luigi-version by luigi-version to whoever chooses to apply
this new convention.
This solution came out to be pretty clean, and with readable tests and
detailed and a bit opinionated documentation.
Have you tested this? If so, how?
I'm going for a week-long no computer vacation soon. After that I'll try running this in production.