How to submit a package to PyPI under a different user than my ~/.pypirc - setuptools

As far as I can tell from the docs, unlike with say git and .gitignore files, setuptools will only look in your $HOME directory for a .pypirc file.
Mostly I am submitting as 'myself', but now I want to submit a specific project via my employer's dev team account.
setup.py register --help doesn't seem to indicate any way to supply a username/password other than the one from my ~/.pypirc
There's the setup.cfg file which could appear in my project root, but it seems that only allows to specify args accepted by the command, so same as above.
Same for .pydistutils.cfg (?)
Surely I can't be the only one - what's the usual way to do this?

I found a workaround, which is to use https://pypi.python.org/pypi/twine
After installing twine I was able to create a project-specific .pypirc file in the project root, containing the company username/password.
Before using twine you have to generate the package using setup.py though, so the procedure is (from your project root):
$ python setup.py sdist
$ twine register --config-file=./.pypirc dist/*
$ twine upload --config-file=./.pypirc dist/*

Related

How to define rule file in debian packaging of a project which have a make file to build from source?

I'm new to stackoverflow so correct me if I made any mistake in providing the details.
So I'm trying to make a deb file for Apache-Age, and going by the documentation, if we try to install AGE from source then we can simply do it by :
make install
I have setup the basic directory structure by dh_make and have made the control file with proper dependencies, then comes the rule file.
So I went through 2 different extensions of postgreSQL :
postgresql-q3c
Postgis
And tried to replicate the same for apache-age, and tried to build by following commands
dpkg-buildpackage -rfakeroot -b
dpkg-buildpackage -nc -i
the build was giving some errors and warning but a deb file was generated.
The deb file installed properly but age-extension was not installed in PostgreSQL.
It's probably because the age was not building properly from source using make command as specified in the rule file.
Is there any good resource or how to make rule file ?
I tried following this answer, but got stuck here.
I found a PDF but didn't understand the build process.
This might be a naive way but it works for me:
Clone the repo and cd to it
Run the dh_make_pgxs command to make the debian build directory structure.
The you need to make changes to pgversion, control/control.in, changelog, copyright and rule files.
If you are just trying to use the make file to build the package then the rule file can be as simple as:
#!/usr/bin/make -f
%:
dh $#
Then simply run the build command as before.

Simplest way to prepare a private repo for pip install

I have a private repository that I want to be able to install using pip, like this:
pip install git+https://USER_NAME:APP_PASSWORD#GIT_URL/PATH_TO_YOUR_REPO.git
I tried it, but I got the error message that my repo does not contain a setup.py. I get the idea that I have not created a package. Let's suppose we have a repo with nothing but one python file in it that we want to import (with the command above). I want to take this repo from that state, to one where I can use the above pip install. Let us suppose the one file is called my_python.py What is the bare minimum that I need to add to do that? I have already added the setup.py and it contains the following:
from setuptools import setup
setup(
name='CoreTools',
version='1.0',
description='Core Tools for our software',
author='Guy',
author_email='guy#guy.com',
packages=['CoreTools'], #same as name
install_requires=['wheel', 'bar', 'greek'], #external packages as dependencies
)
I guess I need an __init__.py file. I have discovered that I need a package folder called "CoreTools". I am guessing that the files that I want to use should go in that folder? That means that if I am maintaining this package, I need to edit the files in that folder and commit them there.
I am using PyCharm and it gives the option to create a package and so I tried this. I creates a new folder with an __init__.py in it. Where does setup.py go? Does it go in the main folder or in the new package folder with __init__.py?

Some beginner questions about Centreon

I am new to Centreon and I have a few questions I need to figure out. I have these services:
I just want to know how can I have these services like this.
2nd question
on Github, I find that the plugin is end with .pm not .pl, which is I wonder why, and how to use the plugin on Github, because I already put it in on a folder on Centreon and restart it on the poller, but I do not see the plugin I downloaded.
3rd question
For interfaces:
--plugin=os::linux::snmp::plugin --mode=interfaces --add-status --add-traffic
For services (if it's windows):
--plugin=os::windows::snmp::plugin
Is this just command or I have to modify it on a plugin ?
You must have create a new host and link to this host an host template. This host template is linked to services and this why you have services created. Do not hesitate to check this documentation
To use our centreon plugin you have two different way to do:
Clone our GitHub repository Here, and manage your script file by file use the centreon_plugins.pl to call the .pm file through the --plugin option, through the following command line you can download the repo:
git clone https://github.com/centreon/centreon-plugins.git
Use the Centreon RPM packages, who they correspond to the GitHub script, but all build per kind of devices (one .pl script per devices). You can install them with the following command line:
yum install --nogpgcheck centreon-plugins\*
By default all nagios plugins are stored in "/usr/lib64/nagios/plugins/" and the centreon plugins are stored in "/usr/lib/centreon/plugins/"
'--plugin' option is related to a command and it just indicate the plugin that will be used, you don't need to modify any plugin just the command unless you want to change something inside the plugin.

Installing 3rd party packages in kickstart on redhat

I have been trying to work out how to add my own packages as part of a kickstart install (specifically mondo packages) but using the %packages directive as opposed to rpm commands in the post scripts. I tried adding them to the packages file with my %include statement in the kickstart file, and copied the RPM's to the RH linux/Packages directory, however these packages don't get installed. I read something about comps.xml but dont have that file in the RHEL distribution, or know what the procedure is.
Essentially I have a package list which I include like this:
# cat packages.txt
openssh-clients
openssh-server
afio-2.5-1.rhel6.x86_64.rpm
buffer-1.19-4.rhel6.x86_64.rpm
mindi-2.1.7-1.rhel6.x86_64.rpm
mindi-busybox-1.18.5-3.rhel6.x86_64.rpm
mondo-3.0.4-1.rhel6.x86_64.rpm
All the rpms from afio down are custom ones not part of the RH installation.
Could someone tell me how this can be done?
thanks
All kickstart files should have a section near the top where they define available repos. An example repo line would look like this:
repo --name=a-base --baseurl=http://mirror.centos.org/centos/6/os/$basearch
This tells the kickstart system that there is a usable rpm repo at the given url
In order to add your own rpms you need to create a custom repo and point your kickstart files to it by adding a new repo line. Then you can list the core rpm package names in your %packages directive and they will be picked up.
So for you it would be something like:
...
repo --name=a-base --baseurl=http://my.domain.org/customrepo/path/here
%packages
openssh-clients
openssh-server
afio
buffer
mindi
mindi-busybox
mondo
...

Does not make sense that I have to have files before import

How do I import an external package from scratch?
I've written a library package in Go and testing to distribute through github. I am following http://golang.org/doc/code.html and using mac but getting error message
cmd I put is following.
$ mkdir $HOME/go
$ export GOPATH=$HOME/go
$ export PATH=$PATH:$GOPATH/bin
$ mkdir -p $GOPATH/src/github.com/user
$ mkdir $GOPATH/src/github.com/user/project
Then I put
$ go get github.com/user/project
Still errors with go install
can't load package: package github.com/golingorg/goling: no Go source files in /Users/user_name/go/src/github.com/user/project
I do not understand why we need files to import an external package in Go. External package means that I get something and create files from the external package.
My question is how I import an external package from scratch. Most of documents just say something like
go get github.com/yasushi-saito/fifo_queue
this gives me "$GOPATH not set."
I am getting frustrated setting up the environment for "go get" to work, as a beginner. Thanks a lot in advance.
Summary
How do I import an external package from scratch?
Go is a static type language thus it needs to resolve any reference to external package at compile time. The "go" tool expects the source of external packages in locally accessible path thus you need to use "go get" to download them.
From what you described, you probably did not set the GOPATH. Use ECHO $GOPATH to check if it is set correctly.
For my GO project, I normally use GOPATH as workspace, similar to virtualenv in Python or rbenv/rvm in Ruby. Let say my project "myproject" has root at /projects/myproject, my source file will be located at /projects/myproject/src/myproject and there is an import of "github.com/user/project", then
> cd /projects/myproject
> export GOPATH=`pwd` # or export GOPATH=/projects/myproject
> go get github.com/user/project
After "go get" command, the source of "github.com/user/project" will be downloaded to /projects/myproject/src/github.com/user/project.
When you use "go build" or "go install" then, it will compile as the external packages is in the $GOPATH/src folder.
If you install Go in the default folder, you need to include Go installed bin folder in the PATH environment variable. After that GOPATH is the other environment variable you need for "go" tool to work.
That's how I done it:
1. Setup your workspace first
mkdir $HOME/go
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
2. Create the project
mkdir -p $GOPATH/src/github.com/user
mkdir $GOPATH/src/github.com/user/hello
touch $GOPATH/src/github.com/user/hello/hello.go
3. Install it
go install github.com/user/hello
4. Run it
cd $GOPATH/bin
./hello
I used the following vagrant image: https://github.com/dcoxall/vagrant-golang
From the help output for go get, it says:
By default, get uses the network to check out missing packages but does not use it to look for updates to existing packages.
When you created the $GOPATH/src/github.com/user/project directory prior to running go get, it assumed that the package had already been downloaded so skipped to the step of trying to build and install the package. That failed because the directory contained no Go source files.
So the simple fix is to not create the folder associated with the package you are trying to download: go get will do that for you.