-
Orthogonality in Software Engineering (https://pragprog.com/titles/tpp20/the-pragmatic-programmer-20th-anniversary-edition/):
- 1st Department works on the Flask Application, Mobile Application
- 2nd Department (Data Science) works on the Recommender Algorithms
- The web developers are not interested in which algorithm is used
- The Data Scientist are not interested in how their method is used
- The two teams only share the common interface, which is the function
recommend_nmf(query, ratings, model, k=10)
-
Increase visibility and usability of your work
- everyone is able to download and use the package with
pip
! - even simple code (just a single function) can be put into a python package!
- everyone is able to download and use the package with
-
How to structure python code: functions -> classes -> modules (a single .py script) -> package (a folder with modules) -> library (several folders)
-
Where are packages located on your computer?
import pandas as pd pd.__file__
./project-name
|- README.md
|- LICENSE.txt
|- .gitignore
|- requirements.txt
|- package-name
|- __init__.py
|- other_module.py
|- setup.py
pip install ./project-name
or if you are allready inside the project folder
pip install ./
pip install git+https://github.com/<github-username>/<project-name>
add the following argument to your setup.py
:
install_requires=[
'pandas',
'scikit-learn'
]
add the following argument to your setup.py
:
package_data= {
'<package-name>': ['data/*.csv', 'trained_models/*.pickle']
}
import pandas as pd
import os
package_dir = os.path.dirname(__file__)
df = pd.read_csv(package_dir + '/data/my_data.csv')
- Register an account on https://test.pypi.org/
- Build and upload your package:
pip install --upgrade build
pip install --upgrade twine
python -m build
twine upload --repository testpypi dist/*