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

Add __version__ and __file__ variable #5

Open
jpatacz opened this issue Mar 4, 2022 · 4 comments
Open

Add __version__ and __file__ variable #5

jpatacz opened this issue Mar 4, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@jpatacz
Copy link
Contributor

jpatacz commented Mar 4, 2022

version and file variable will add some more information about the package within the code.

@jpatacz jpatacz added the enhancement New feature or request label Mar 4, 2022
@jpatacz
Copy link
Contributor Author

jpatacz commented Mar 16, 2022

@flskillcorner do you think such version documentation would be good (class attribute):

from skillcorner.client import SkillcornerClient
SkillcornerClient.__version__
'1.0.2'
skc_client = SkillcornerClient('username', 'password')
skc_client.__version__
'1.0.2'

or would it be better to do it this way (package attribute):

import skillcorner
skillcorner.__version__
'1.0.2'

@flskillcorner
Copy link
Collaborator

@jpatacz
On public modules, I have essentially saw the second option (skillcorner.version), so I prefer we do the same thing

@jpatacz
Copy link
Contributor Author

jpatacz commented Mar 16, 2022

And what about file variable ?

@flskillcorner
Copy link
Collaborator

What I saw for file : each import of module should have a file attribute, but not object attached to module, neither instances
Example :
`In [65]: from django.core.serializers import xml_serializer

In [66]: xml_serializer.file
Out[66]: '/home/franck/envi/base37/lib/python3.7/site-packages/django/core/serializers/xml_serializer.py'

In [67]: from django.core.serializers.xml_serializer import settings

In [68]: settings.file

AttributeError Traceback (most recent call last)
in
----> 1 settings.file

~/envi/base37/lib/python3.7/site-packages/django/conf/init.py in getattr(self, name)
78 if self._wrapped is empty:
79 self._setup(name)
---> 80 val = getattr(self._wrapped, name)
81 self.dict[name] = val
82 return val

AttributeError: 'Settings' object has no attribute 'file'`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants