Tech C**P
15 subscribers
161 photos
9 videos
59 files
304 links
مدرس و برنامه نویس پایتون و لینوکس @alirezastack
Download Telegram
To install your python module you need a setup.py file inside of your project. The content of the setup.py can be something like below:
setup(name=PROJECT_NAME,
version=PROJECT_VERSION,
description=PROJECT_DESCRIPTION,
long_description=PROJECT_LONG_DESCRIPTION,
author='Ali',
author_email='info@ali.com',
url='http://www.ali.com/',
license='SOMETHING',
entry_points=PROJECT_ENTRY_POINTS,
classifiers=[],
keywords='',
packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
include_package_data=True,
namespace_packages=[],
install_requires=['LIST', 'OF', 'REQUIREMENTS'],
zip_safe=False,
test_suite='nose.collector')

Now if you want to install it on your machine as a package just:
python setup.py install

If you want to upload it into your python repository:
python setup.py sdist upload -r my_repo

NOTE: you should be in the root of your project before running the previous command.

my_repo server should be declared inside of ~/.pypirc:
[distutils]
index-servers =
my_repo

[my_repo]
repository: http://pypi.repo.my_host.com:5000
username: username
password: password

If you want to install something from your repository via pip you have to provide the extra-index-url argument:
--extra-index-url http://username:password@pypi.repo.my_host.com:5000 --trusted-host pypi.repo.my_host.com

NOTE: you can put inside of an ENV variable in OS to access it better and in more readable way.

#python #setuppy #setup #package #pypi #private_repo #pypirc #pip #install
Naming conventions and recipes related to packaging

Private (including closed-source) projects use a namespace

For internal/customer projects, use your company name as the namespace.

This rule applies to closed-source projectsi (local PyPi server).

As an example, if you are creating a "climbing" project for the "Python Sport" company: use "pythonsport.climbing" name, even if it is closed source.

NOTE: The above descriptions are derived from python PEP-423.

#python #package #packaging #pypi #pep423 #conflict