• <xmp id="om0om">
  • <table id="om0om"><noscript id="om0om"></noscript></table>
  • Tox? ?? ??? ???? ???? ????? ??

    Reading Time: 6 minutes

    ?? ???? Python?? ???? ????? ????? ?? ????? tox? ?????. ??? ? ??? ??? ????? ???? ??? ??? ??? ? ?? ?? ??? ??? ??? ????. ?? ??, tox? “? ???? ????(it works on my machine)”? ??? ?? ??? ?????? ???. ???? ??? ?? ? ?? ??? ????:

    • ??? ??? ??? ??? ?? ???? ??? ? ????.
    • ?? ??? ??? ? ????.
    • ?? ??? ???? ??? ? ????.

    ??, ?? ??? ?? ?? ??? ??? Windows, macOS ? Linux OS?? ??? ? ??? ????. ? ??????? tox? ?? ??? ?? ???? ??? ???? ???? ??? ??? ???????. ?? ???? ?? ??? ?? tox? ??? ??? ? ??? ???????.

    tox? ??????

    tox ???? ?? ? ??? ?? ??? ??????, tox? ??? ?? ??? ???? Python ???? ????? ? ??? ???? ???? ? ???? ???? ??? ? ????.

    ??? ??? “tox? Python?? ???? ????? ????? ?? ??? ???. ?? Python ?????? ???, ??? ? ??? ????? ?????? ? ? ??? ?????.”?? ?????. ??? “tox? ???? ?? ?? ?? ? ??? ??? ?????.”?? ???? ????. ?? ??? ?? ? ?? ????? ??? ???? ?? ??? ???? ? tox? ???? ?? ?????.

    ??? tox? ?? ?????? ????? ?? ??? ???? ?? ??? ???? ?? ????. tox ??? ??? ?? ??? ?? ??? ????.

    # content of: tox.ini , put in same dir as setup.py
    [tox]
    envlist = py27,py36
    
    [testenv]
    # install pytest in the virtualenv where commands will be executed
    deps = pytest
    commands =
        # NOTE: you can run any command line tool here - not just tests
        pytest

    ? ??? Pytest? ???? ?????, ???? “????? ??? ?? ??? ??? ???? ??? ? ????.”?? ???? ????.

    tox? ??? ??????

    tox ???? ??? ?? ???? ????? ?????? ?? ????(?? 1). ? ?????? ?????? ??? ??? ??? ??? ??? tox? ?? ??? ?????.

    1. tox.ini ??? ??? Python ??? ???? ?? ??? ?????.
    2. tox.ini ??? deps ?? ??? ??? ???? ?? ??? ?????. ?? ????? SDIST? ??? ?? ?????(?? ??).
    3. ??? ?? ???? ??? ?????. ??? ?? ?? ??? ?????.
    4. ? ??? ??? ????? ?????.
    ?? 1. tox? ???? ?????. ??: tox ??

    ????. tox? ??? ? ?? ??? ???? ???? ??? ???? ?? ??? tox? ??? ???? ????? ????? ?? ?? ? ?????.

    ??? ??? ??????. ?? ?? tox? ???? ??? ?????.

    tox? ??

    ? ????? ?? ??? ???? ???? ??? ?????? ????? ? tox? ???? ?? ? ?? ? ?? ??? ?????.

    ?? ???

    ??? ?? ?? ??? ??? ?? ??? tox? ?????. ??? ?????? ?? ??? ???? tox? ???? ????? ?? ???. ?? ?? ??? ?? ???????. ???? ??? ????? ???? ??? ??? ????. ??? ?? ??? tox.ini ???? ?????.

    ??? ?? ??

    tox? ??? CI(??? ??) ????? ?? ?? ??? ??? ??? ??? ?? ???? ???. ?, tox ?? ??? CI ????? ? ?????. ?? ???? ???? ??? ???????.

    ??? ?? ?? ??

    ? ??? ?? tox? ??? ?? ??? ?????. ??? ??? ??? ??? ???? ?????. ?? ?? ??????? ???? ???? ? ??? ???? ?? ? ?? ?? ?? ??? ??? ? ????.

    ?? ?? ?? ???? ??? ?? ?? ? ??? ???? ?? ??? ???? ???? ????. ??? ?? ??? ?? ??? tox ??? ?? ???? ?? ?????. ? ??? tox? ??? ? -r ???? ???? ???(py -m tox -r).

    ??? tox ?? ?? ??

    tox? ?? ??? ?? ?? kurtispykes/tox_example GitHub ??????? ??? ? ?? ??? ??? ??????. ?? ?? tox? ???? ??? ?????.

    ├── __init__.py
    ├── .gitignore
    ├── LICENSE
    ├── README.md
    ├── string_reversal.py
    ├── test_string_reversal.py
    ├── tox.ini

    tox ???? ???? ?? ? ?? ?? ? ??? ???? ?? ??? ????:

    tox.ini
    setup.cfg
    pyproject.toml

    ? ????? tox.ini? ???? tox? ?????. ??? ??? ????:

    [tox]
    envlist = my_env
    skipsdist = true
    
    [testenv]
    deps = pytest
    commands = pytest

    INI ?? ??? ??? .ini ???? ???? ?? ??? “?? [section] ??? ???? ??? ?? ???(= or : by default)? ??? ?/? ???? ??? ???? ????”? ???? ????.

    tox?? ?? ??? ??? tox ???? ?????. ??? ? ????? [tox] ??? ?????. ? ??? tox ??? ?? ?? ??? ?????. ? ???? ??? ??? Python? ???? ???? ????? tox? ??? ? ????.

    [tox] ???? ? ?? ??? ???? ????:

    1. envlist – ????? py -m tox? ??? ? ?? ??? ???? tox? ????. ? ????, envlist? ??? my_env???. ?? ?? ?? ??? ??? ?? ??? ?? ??? ???? ???? ?? ???? ?? ???? ???? ?? ??? ?? ??? ?????.
    2. skipsdistsetup.py ?? pyproject.toml? ?? ?? skipsdist ???? true? ?????. ???? ??? ??? ?????.

    ?????? ??(py27, py37)? ???? ?? ??? Python? ?? ???? ???? ?? ????. ???? ?????? Python ??? ??? ??? ???? ??? ??, ??? ??? ??? ?????.

    [testenv] ? [testenv:NAME] ??? tox? ??? ??? ???? ? ????, ??? NAME? ?? ??? ?????. [testenv] (??? ????? ?)? ??? ??? ???? ????? ?? ? ?? ??? ???? ?????.

    ? ???? ?? ??? ????? ??? ?? ? ??? ?????:

    1. deps – ??? ???? ? ??? ??????.
    2. commands – ?? ??? ??? ??? ???? ?????.

    ?? ??? ??????? ??? ???? ????? ??? ??? ??? ? ????. ? ??? ?? ??? ??? ???? ????? ? ???? ??? ??? string_reversal.py???.

    # The contents of string_reversal.py
    def reverse_string(text):
        reverse_text = text[::-1]
        return reverse_text

    ??? ???? ????? ?????? ?? test_string_reversal.py ????? ?????:

    # The contents of test_string_reversal.py
    from string_reversal import reverse_string
    
    def test_calculate_age():
        # Given
        text = "Hello World!"
    
        # When
        reversed = reverse_string(text)
    
        # Then
        assert reversed == "!dlroW olleH"

    ?? ??? tox.ini ??? ??? ??? ?????? tox? ???? ????. ????? ?? ??? ???? tox? ?????:

    py -m to

    ??? ?? 2? ??? ?? ???? ???.

    ?? 2. ???? ?? ??? ??

    ? ????? Pytest? ????? ?? ?????? ???? ??? ???? ? ????. ??? ??? ???? ??? ? ????.

    ?? ?? ??? ???

    tox? ??? ????? ??? ?? ????. ?? ??, ?? ???? ??? ?? ??(ML) ??? ???? ?? ?? ?? ??? ??? ? ????. ?? ??? kurtispykes/fraud-detection-project GitHub ??????? ??? ? ????. ML ?? ???? ??? ??? ??? ????:

    ├── fraud_detection_model # Contains the code required to build the model
    ├── requirements
    │   ├── requirements.txt
    │   ├── test_requirements.txt
    ├── tests # Contains the unit tests for the model
    ├── LICENSE
    ├── MANIFEST.in
    ├── mypy.ini
    ├── publish_model.sh
    ├── pyproject.toml 
    ├── setup.py
    ├── tox.ini

    ML ?? ???? ????? ? ?? ???? ??????. ??? ???? ? ? ????? requirements.txt ??? ???? ???.

    ? ????? tox ?? ???? tox? ??? ? ?? ?? ??? ???? ????. ??? ?? ??? ?? ??? ??? ??? ?????? ??? ??? Gemfury ?????? ???? ??? ?????. ?? ??? ?? ??? ???? ? ??? ??? ? ? ??? ?????. tox.ini ??? ?? ??? ??? ????.

    # Part of the tox.ini file; click on the GitHub link to view the entire file
    [tox]
    envlist = test_package, typechecks, stylechecks, lint
    skipsdist = True
    
    [testenv]
    install_command = pip install {opts} {packages}
    
    passenv =
    	KAGGLE_USERNAME
    	KAGGLE_KEY
    	GEMFURY_PUSH_URL
    
    [testenv:test_package]
    deps =
    	-rrequirements/test_requirements.txt
    
    setenv =
    	PYTHONPATH=.
    	PYTHONHASHSEED=0
    
    commands=
    	python fraud_detection_model/train_pipeline.py
    	pytest \
    	-s \
    	-vv \
    	{posargs:tests/}
    
    [testenv:train]
    envdir = {toxworkdir}/test_package
    deps =
    	{[testenv:test_package]deps}
    
    setenv =
    	{[testenv:test_package]setenv}
    
    commands=
    	python fraud_detection_model/train_pipeline.py
    
    [testenv:fetch_data]
    envdir = {toxworkdir}/test_package
    
    setenv = {[testenv:test_package]setenv}
    
    commands =
    	# fetch
    	kaggle competitions download -c ieee-fraud-detection  -p ./fraud_detection_model/data/interim
    	# unzip
    	unzip ./fraud_detection_model/data/interim/ieee-fraud-detection.zip -d ./fraud_detection_model/data/interim
    
    [testenv:publish_model]
    envdir = {toxworkdir}/test_package
    deps =
    	{[testenv:test_package]deps}
    
    setenv =
    	{[testenv:test_package]setenv}
    
    commands=
    	python fraud_detection_model/train_pipeline.py
    	./publish_model.sh .

    setup.py ??? ??????? ?? tox ???? skipsdist ??? ??? ? ????. ? ?? ???? ?? ??? ??? ????? ??? ?? ??? ???? ? ??? tox? ???? ??? ?????.

    ??? envlist(in the [tox] header)? test_package, typechecks, stylechecks, lint? ???? ?? ? ? ????. ????? py -m tox? ???? ??? ? ??? ???? ? ??? ??? ?????.

    ????? ??? ?? ??? ????? ?? ??? ??????: ?????? ?? ??. ??, ?? ?????? ????? ?? ??? ???? ?? ??? tox? ???? ?? ????.

    py -m tox -e NAME

    NAME? tox? ????? ??? ??? ?????.

    ???? ???? tox ?? ? ?? ??

    ??? CI ???? tox? ?? ? ?????. ML ?? ????? ??? ??? ?? CircleCI? ?????. Circle CI ?? ??? ?? ?? ??? ?? ???? ?? tox? ?????. ??? ??? GitHub? CircleCI ?? ??? ?????.

    ??

    ? ?????? ????? ???? ????? ????? ? ??? ??? tox? ???? ??? ?? ??????. ??? ????? tox? ???? ?? ?????? ?? ??? ???? ???? ??? ????. ???? ?? ?????? ????? ?? ??? ???? ?? ??? tox? ???? ?? ????.

    3? 20??? 24??? ??? NVIDIA GTC 2023? ??? ???? ??? ????? ??? ???? ??? ??? ????? ??? ?????.

    ? ???? ??? SDK? ???? ?? ???, ?? ???, ?? ??, ??, ?? ??, ???? NVIDIA ??? ???? ??? ??? ??? ??? ? ????. ?? ??? ???? NVIDIA? ?? ????? ???? ? ??? ??? ??? ?????? ???? ??? ??? ???.

    Discuss (0)
    +1

    Tags

    ?? ???

    人人超碰97caoporen国产