Python Paketleri Geliştirme
James Fulton
Climate informatics researcher
Bu setup.py, Python 2.7’den itibaren tüm sürümlere izin verir.
from setuptools import setup, find_packages
setup(
...
python_requires='>=2.7',
)
Bu Python sürümlerini test etmek için şunları yapmalısınız:
pytest çalıştırınBu setup.py, Python 2.7’den itibaren tüm sürümlere izin verir.
from setuptools import setup, find_packages
setup(
...
python_requires='>=2.7',
)
Bu Python sürümlerini test etmek için:
tox çalıştırınYapılandırma dosyası - tox.ini
mysklearn/
|-- mysklearn
| |-- ...
|-- tests
| |-- ...
|-- setup.py
|-- LICENSE
|-- MANIFEST.in
|-- tox.ini <--- yapılandırma dosyası
Yapılandırma dosyası - tox.ini
[tox]envlist = py27, py35, py36, py37[testenv]deps = pytestcommands = pytestecho "run more commands" ...
[...] yazılır.envliste pyXY ekleyin.commands parametresi toxun çalıştıracağı terminal komutlarını listeler.commands listesi ls, cd, echo gibi terminalden çalışacak her komut olabilir.tox
mysklearn/ <-- buraya gidin
|-- mysklearn
| |-- ...
|-- tests
| |-- ...
|-- setup.py
|-- LICENSE
|-- MANIFEST.in
|-- tox.ini
py27 create: /mypackages/mysklearn/.tox/py27
py27 installdeps: pytest
py27 inst: /mypackages/mysklearn/.tox/.tmp/package/1/mysklearn-0.1.0.zip
py27 installed: mysklearn==0.1.0,numpy==1.16.6,pandas==0.24.2,pytest==4.6.11,...
py27 run-test-pre: PYTHONHASHSEED='2837498672'
...
py27 run-test: commands[0] | pytest
======================== test session starts ========================
platform linux2 -- Python 2.7.17, ...
rootdir: /home/workspace/mypackages/mysklearn
collected 6 items
tests/preprocessing/test_normalize.py ... [ 50%]
tests/preprocessing/test_standardize.py ... [100%]
========================= 6 passed in 0.23s =========================
...
__________________________ summary __________________________
py27: commands succeeded
py35: commands succeeded
py36: commands succeeded
py37: commands succeeded
...
__________________________ summary __________________________
py27: commands succeeded
py35: commands succeeded
py36: commands succeeded
ERROR: py37: commands failed
Python Paketleri Geliştirme