I’ve been learning Python recently, and one of the central themes of my projects has been the need to query Microsofts Graph API. To that end, I’m trying to create a dead simple module I can refactor in one place and import/update in my other projects.
And I seem to have it working, my question is the nomenclature.
Firstly, I’m not publishing to Pypa (or where ever pip gets its packaging from), but instead have posted to GitHub. Not big deal, I can install by running:
pip install git+https://github.com/lucasjkr/lucasjkr-test
My question comes with how to actually use the module.
I can import the function directly by doing:
from lucasjkr.simple_bearer_token import bearer_token token = bearer_token("a", "b", "c", "d")
That seems a lot more onerous to call than any other module I’ve seen. I’m probably doing something wrong, but before spending too much time looking, I wanted to ask if this is just an artifact of installing from Github?
ultimately I just want to be simpler like most the other python packages I see:
import lucasjkr token = lucasjkr.bearer_token('a', 'b', 'c', 'd')
or
import lucasjkr token = lucasjkr.simple_bearer_token('a', 'b', 'c', 'd')
What part am I missing that not only do I need to import the package directory, but also the exact file and function as well?
submitted by /u/lucasjkr
[link] [comments]
r/learnpython I’ve been learning Python recently, and one of the central themes of my projects has been the need to query Microsofts Graph API. To that end, I’m trying to create a dead simple module I can refactor in one place and import/update in my other projects. And I seem to have it working, my question is the nomenclature. Firstly, I’m not publishing to Pypa (or where ever pip gets its packaging from), but instead have posted to GitHub. Not big deal, I can install by running: pip install git+https://github.com/lucasjkr/lucasjkr-test My question comes with how to actually use the module. I can import the function directly by doing: from lucasjkr.simple_bearer_token import bearer_token token = bearer_token(“a”, “b”, “c”, “d”) That seems a lot more onerous to call than any other module I’ve seen. I’m probably doing something wrong, but before spending too much time looking, I wanted to ask if this is just an artifact of installing from Github? ultimately I just want to be simpler like most the other python packages I see: import lucasjkr token = lucasjkr.bearer_token(‘a’, ‘b’, ‘c’, ‘d’) or import lucasjkr token = lucasjkr.simple_bearer_token(‘a’, ‘b’, ‘c’, ‘d’) What part am I missing that not only do I need to import the package directory, but also the exact file and function as well? submitted by /u/lucasjkr [link] [comments]
I’ve been learning Python recently, and one of the central themes of my projects has been the need to query Microsofts Graph API. To that end, I’m trying to create a dead simple module I can refactor in one place and import/update in my other projects.
And I seem to have it working, my question is the nomenclature.
Firstly, I’m not publishing to Pypa (or where ever pip gets its packaging from), but instead have posted to GitHub. Not big deal, I can install by running:
pip install git+https://github.com/lucasjkr/lucasjkr-test
My question comes with how to actually use the module.
I can import the function directly by doing:
from lucasjkr.simple_bearer_token import bearer_token token = bearer_token("a", "b", "c", "d")
That seems a lot more onerous to call than any other module I’ve seen. I’m probably doing something wrong, but before spending too much time looking, I wanted to ask if this is just an artifact of installing from Github?
ultimately I just want to be simpler like most the other python packages I see:
import lucasjkr token = lucasjkr.bearer_token('a', 'b', 'c', 'd')
or
import lucasjkr token = lucasjkr.simple_bearer_token('a', 'b', 'c', 'd')
What part am I missing that not only do I need to import the package directory, but also the exact file and function as well?
submitted by /u/lucasjkr
[link] [comments]