this is a description
suppose you want to make a comand line tool called lan. it accept integer as numbers ouput carrots we need to feed
ex: cmd> lan 2 ouput: 4
we can get the output by two ways:
call python moudle
python -m lan 2
best practice schema
This is first step you need to do in any python project
- it will create a virtual env
- auto source it
- install requirements for the start up
make run will run in module mode
make main will run in normal mode
You can see that
lan/__main__.py are the same content file.
why do we need
It is eay to make an entry in IDE , like intellij.
Could I just use
__main__.py to run like this?
You cound not.
That is because the top-level package problem.
python main.py top-level package is the same as main.py python src/func/main.py top-level package is the same as main.py, aka func top-level package is the folder where you run this command from
So , why
lan/__main__.py does not work?
because top-level package is lan now.
Always use logging for log print,don
logging config is controlled bylogging.yml
, which can control every module level callsetup_logging` in main file (ra)
update readmeput moudle in the folder parallel with logx folder.
packing module or cmd
for quick test purpose
pip install .
pip uninstall <module_name>
make install make uninstall
upload to test or prod PYPI server
upload to test server:
upload to prod server:
test and coverage
test with coverage
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size lan-0.0.2-py2.py3-none-any.whl (5.1 kB)||File type Wheel||Python version py2.py3||Upload date||Hashes View|