Skip to main content

intro

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

ex:
	cmd> icrop 2 
	ouput: 4

we can get the output by two ways:

  • command line

      icrop  2
    
  • call python moudle

    python -m icrop 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 icrop/__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 icrop/__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 icrop/__main__.py does not work?

because top-level package is icrop 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

Metadata

Release files for icrop 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for icrop 0.0.1
File Interpreter ABI Platform Actions
icrop-0.0.1-py2.py3-none-any.whl Python 3, Python 2 none any Details for icrop-0.0.1-py2.py3-none-any.whl

Release files / icrop-0.0.1-py2.py3-none-any.whl

Download URL icrop-0.0.1-py2.py3-none-any.whl
Size 5.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
e72938932037ca7a8fe951a8494ea262370f610d8c6f7ed96a1d2256e11a1ef0
BLAKE2b-256 checksum
How to use checksums
2f111b8a6419930fc60d385d711dced8fd076cc90c4ab60f785c7979877ccf82
Upload date
Uploaded using Trusted Publishing?
What is 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.1

Security for icrop 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page