Checking out private repository on pip install - python

I've been working on an update to a server that requires a private GitHub repository. I can download the repo on my machine, because I'm able to enter a password when prompted. When I try to do this with my server, which is running on an Amazon EC2 instance, I don't have these prompts, so the module from the GitHub repository is not installed. Is there a way for me to provide the username and password in the installing file that I'm using for pip, so I can have the private repo module install successfully?
I'm using the -e git+<url>#egg=<name> in my requirements.txt

You can use SSH links instead of HTTPS links, like git#github.com:username/projectname.git instead of https://github.com/username/projectname.git, and use authentication keys instead of a password.
Step by step, you have to:
Change URL in requirements.txt to git#....
Create a key pair for your deployment machine and store it in ~/.ssh/ directory.
Add the key to you Github account.
Read the GitHub help pages for more detailed instructions.

Related

How to publish python packages to internal artifactory in poetry using a token

I am using poetry version 1.1.6 to build and publish my project to an internal artifactory.
I have provided the below command and configured the repository.
poetry config repositories.myrepo https://my-internal-artifactory/api/pypi/python/simple
How do I configure API token for an internal repository?
I tried this
poetry config http-basic.myrepo mytoken
Its still prompting for password assuming that I am providing a username and password. However, all I have is a token. I don't have a username and password.
The docs doesn't seem to provide sufficient information for private repositories using tokens,
Note : Before poetry, we were using curl to upload to artifactory using the token.
How do we publish to private repositories with token in poetry? Is it even possible to do this? Any help would be greatly appreciated.
The http-basic config is for user + password combination, you're only providing one of them.
There's another configuration setting called pypi-token, you probably want to use this instead (more information in the credentials section of poetry). In your case it should be poetry config pypi-token.myrepo mytoken
Make sure that you haven't specified both http-basic and pypi-token, as just one of them will work - i belive poetry will check for pypi-token and if that is present it will use that. Just use poetry config --unset to remove the other config option.
My problem was I wanted to publish to Artifactory, where you have a token but you also have a user, in that case you need to use the http-basic option and specify both your user and your token as the password.

How to create an Azure Artifacts public feed to make it possible to pip install the nightly builds of an open source project without credentials?

I created a new artifact feed from a public open source project that is already being used to perform Azure Pipelines public CI on a repo hosted on github.
I successfully uploaded a bunch of test Python wheel files to that feed using twine and the appropriate credentials.
The generated pip feed URL looks as follows:
https://pkgs.dev.azure.com/orgname/publicprojectname/_packaging/feedname/pypi/simple/
If I type the "pypi"/"pip" URL of the feed in the browser where I am logged in, I get the following message:
This functionality is currently not available.
If I type the same URL in a new "private browsing" window on firefox, I get redirected to the Azure login page.
My end goal would be to share nightly builds and I do not want to use the main pypi.org server for that.
Note: this official tutorial mentions a specific button named "+ New public feed (preview)" to create the feed but I could not find it on my project. I used the regular "+ New feed" button instead. Maybe this is the cause of the problem?
Even if the URL cannot be browsed from a regular browser, pointing pip to use it with the following command works as expected:
pip install -i https://pkgs.dev.azure.com/orgname/publicprojectname/_packaging/feedname/pypi/simple/ packagename
To list the content of feed, anonymous users can use a different URL:
https://dev.azure.com/orgname/publicprojectname/_packaging?_a=feed&feed=feedname
Side note: make sure you do not have artifacts-keyring package installed in the venv you use to test anonymous pip access:
pip uninstall -y artifacts-keyring
Otherwise trying to access you feed from pip will trigger the following credential pause:
$ pip install -i https://pkgs.dev.azure.com/orgname/publicprojectname/_packaging/feedname/pypi/simple/ packagename
Looking in indexes: hhttps://pkgs.dev.azure.com/orgname/publicprojectname/_packaging/feedname/pypi/simple/
[Minimal] [CredentialProvider]DeviceFlow: https://pkgs.dev.azure.com/orgname/publicprojectname/_packaging/feedname/pypi/simple/
[Minimal] [CredentialProvider]ATTENTION: User interaction required.
**********************************************************************
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code XXXXXXXX to authenticate.
**********************************************************************
[Error] [CredentialProvider]Device flow authentication failed. User was presented with device flow, but didn't react within 90 seconds.

Installing a Git-hosted module with pip on OpenShift

I have a project with a requirements.txt resembling this:
-e git+https://some.gitlab.com/some_group/some_repo#egg=repo
selenium
pywinauto
I made a source secret on OpenShift with my username and password and started the build. Cloning the project goes through, but cloning some_repo fails with an Error: "Can't find Username".
I'm a bit confused because the main project was successfully cloned with the credentials provided in the secret, but it doesn't seem like Pip is reusing those.
What's more confusing is that OpenShift seems to store the credentials in a .gitconfig file, that should be known to Pip:
I0107 15:35:14.756570 1 password.go:84] Adding username/password credentials to git config:
# credential git config
[credential]
helper = store --file=/tmp/gitcredentials.324456941
Any idea ?
P.S. I wanted to try with an SSHKey but for some reason the admins doesn't want to enable this option on the company's GitLab. And I don't want to put some credentials in the url inside the requirements.txt.
Edit : I have no problem with this on my workstation
pip expects you to add the username and password as a part of the URL if you are not using ssh keys. You could set the secrets as environment variables and refer to them in your pip.conf.
[global]
index = https://$username:$password#some.gitlab.com/some_group/some_repo

How to install Redis DeskTop manager for Ubuntu 14.04

Can somebody suggest how to install redis desktop manager in ubuntu 14.04?
I want to use for python application. While I'm cloning from github, it's asking username and password, but I don't have such credentials. And when I'm installing by downloading zip file, it's not installing.
So please suggest some effective way.
how to install redis desktop manager in ubuntu 14.04?
Just follow the link for installing in ubuntu..
Ubuntu:
Download deb package from http://redisdesktop.com/download (Requires subscription)
Install package via Ubuntu Software Center
Run RedisDesktopManager : /usr/share/redis-desktop-manager/bin/rdm or redis-desktop-manager
These steps copied as-is from the link I provided.
While I'm cloning from github, it's asking username and password, but I d'nt have any such credentials.
to create your credentials it is easy.
Go to github site. https://github.com/join?source=header-home
Click on sighup.
fill the form, username, valid email, password. and Submit.
use the same creds for cloning the repo.
And when I'm installing by downloading zip file, it's not installing.
Please download the deb-file, and install via ubuntu software center

How to contact specific pypi server using Chef and python_pip

We're running our own PyPi server. Now we're starting to use Chef to handle deployments. I'm trying to figure out the best approach to pip install from within a Chef recipe, contacting our custom server and passing credentials.
Typically we would intall packages like this:
pip install -i http://<server address:portno>/simple extremely_cool_package
The server prompts for username and password. The server speaks basic access authentication since it's behind our firewall.
Can python_pip do all this, and if so how? If not, what's the best practice?
The following isn't optimal, but it gets the job done:
python_pip "extremely_cool_package" do
action :install
options "--index-url=http://username:password#server address:portno/simple"
end
I was facing the same problem when trying to install from a pip repository.
The easiest way is to introduce your credentials ~/.pip/pip.conf in the form:
[global]
index-url = http://user:password#server_address:portno/simple
You can also put pip.conf in the root of your virtualenv folder and use pip install inside the virtualenv session.
Edit:
In order of avoiding your default pip library being replaced by the new one you should use
[global]
extra-index-url = http://user:password#server_address:portno/simple

Categories