Latelly, I've been worked on a Python Package, for learning purposes. I called this package Logmaster and, as it suggests, is a logging library. When I install the package (pip install logmaster
), Only the dist-infos (in this case logmaster-1.0.1.dist-infos) are downloaded, not the actual source code.
Project structure:
Logmaster
├── LICENSE
├── README.md
├── src
│ ├── __init__.py
│ └── logger.py
├── pyproject.toml
└── setup.cfg
I tried to decompress the source code of the build (logmaster-0.1.0) to see if it was included, which it was, and to modify the content of the __init__.py
file from from .logger import *
to from . import *
, and it didn't worked.
All the code is on github
Package on PyPi
A simpler solution, use a setup.py. (I changed the directory structure slightly):
$ git clone https://github.com/W1L7dev/Logmaster.git
$ cd Logmaster/
$ mv src/ logmaster/
$ echo "" > logmaster/__init__.py
$ rm pyproject.toml
$ rm setup.cfg
$ cat setup.py
from setuptools import setup
setup(
name='logmaster',
version='0.1.0',
description='A simple logging library for Python',
url='https://github.com/W1L7dev/logmaster',
author='W1L7dev',
author_email='[email protected]',
license='MIT',
packages=['logmaster'],
install_requires=[],
classifiers=[
'Programming Language :: Python :: 3.6',
],
)
With this it works as expected:
$ pip install -e .
Successfully installed logmaster-0.1.0
$ python
>>> from logmaster.logger import Logger
>>> Logger
<class 'logmaster.logger.Logger'>
>>> exit()
$ python3 -m build
Successfully built logmaster-0.1.0.tar.gz and logmaster-0.1.0-py3-none-any.whl
$ ls dist/
logmaster-0.1.0-py3-none-any.whl logmaster-0.1.0.tar.gz