Skip to main content

this is a description

Project description

intro

suppose you want to make a comand line tool called bestpractice. it accept integer as numbers ouput carrots we need to feed

ex:
	cmd> bestpractice 2 
	ouput: 4

we can get the output by two ways:

  • command line

      bestpractice  2
    
  • call python moudle

    python -m bestpractice 2
    

best practice schema

env

Generated by make env

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

test

run make test

run

make run will run in module mode make main will run in normal mode

You can see that main.py and bestpractice/__main__.py are the same content file.

why do we need main.py ? It is eay to make an entry in IDE , like intellij.

Could I just use __main__.py to run like this?

python bestpractice/__main__.py

You cound not.

That is because the top-level package problem.

Ex:

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 bestpractice/__main__.py does not work?

because top-level package is bestpractice now.

logging

Always use logging for log print,dont use printlogging config is controlled bylogging.yml, which can control every module level call setup_logging` in main file (ra)

make module

update readmeput moudle in the folder parallel with logx folder.

  • logx
  • your_module

packing module or cmd

local

for quick test purpose

  • install: pip install .
  • uninstall: pip uninstall <module_name>

make install make uninstall

upload to test or prod PYPI server

upload to test server:

make upload-to-test 

upload to prod server:

make upload-to-prod

test and coverage

pure test

make test

test with coverage

make coverage

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

bestpractice-0.0.1-py2.py3-none-any.whl (5.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file bestpractice-0.0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: bestpractice-0.0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.4.2 requests/2.23.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.2

File hashes

Hashes for bestpractice-0.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 69fe62b7f271da00b15c84558fbe6cf4f1bdbe499f60572fe1b566c444f1b0bb
MD5 1e1ec2616a79052665dc7320bdcac367
BLAKE2b-256 426af052df1c95a07d0daedf51ea82013286b1200d4706f6c8722e6cd3e07977

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page