Howto deploy a Github fork of a CKAN-plugin? - python

I'm localizing the ckan archiver plugin for additional languages.
For testing puropses I'd like to
fork the Github repo
make and test my changes locally
update my forked Github repo and use it with multiple customer installations
make a Github pull request to integrate my changes to the official repo
My question: How to tell CKAN to use my forked Github repo?
Is this possible in the plugin spec ckan.ini:
[app:main]
ckan.plugins = stats text_view recline_view archiver # old
ckan.plugins = stats text_view recline_view mygithubaccount/myarchiverfork # new?
or how can this be achieved instead?

Inside the virtual environment, you need to install your fork:
. /usr/lib/ckan/default/bin/activate
git clone your forked_repo
cd forked_repo && python setup.py develop
Then just use the same name inside the ckan.plugins

Related

Why is poetry not updating git+ssh dependency from private repo versioned using git tag?

I have two python projects, lib and app, managed through poetry. Lib is on github in a private repo and the version in its pyproject.toml is 0.2.0. This is tagged in github with git tag v0.2.0.
Access to the gh private repo is enabled by adding my ssh public key to my gh account using these instructions. Lib is then made a dependency of app using
poetry add git+ssh://git#github.com:org/lib.git#v0.2.0
in the app folder and this creates the dependency in pyproject.toml of app with the line
lib = {git = "git#github.com:org/lib.git", rev = "v0.2.0"}
So far, so good.
Now I make a change to lib and the version increases to 0.2.1 in pyproject.toml. The code is pushed to gh and tagged with git tag v0.2.1. I try to update the dependecy in app using
poetry update lib
in the app folder but it doesn't work. Neither does poetry lock.
As a worksaround, if I issue the command
poetry add git+ssh://git#github.com:org/lib.git#v0.2.1
then it updates without issue, however I would like poetry to check for updates with just
poetry update
or
poetry update lib
I have seen that this is possible for public repos (using https) and also (I think, but could be mistaken) where the git+ssh url is pinned to a branch, say #latest. However I cannot get it to work with a tagged version.
How to do this?

Adding a git submodule from a remote repository with gitpython

For automating some of our workflows I am implementing some Python scripts which create project templates. The content of a project template is located in a folder which also is a local git repository. So the project in the end will be linked and pushed to a remote repository on our company server. Each project additionally uses some of our own created libraries which are added as a git submodule into the project folder and is part of the project git repository.
So my script should now first create the local project git repository which I do by using Gitpython with the following code:
Repo.init(os.path.join(sRepoPath, '.git'), bare=True)
After the repository is created, I want to add one or more remote repositories as a submodule and then clone them into the project folder. But I can't find out how to do it from the Gitpython documentation. It does not cover such a case with remotes as a submodule.
I've already tried several code combinations from the Gitpython documentation. Something like (of course not working):
mainRepo = Repo(sDestinationRepoPath)
test_remote = mainRepo.create_remote('submodule', "ssh://git#bb.mycompany.corp:1234/fwlib/system_lib.git")
mainRepo.create_submodule(test_remote)
But I can't sort it out how it should be done. Can anyone tell me how to do it?

Python and Docker: Install remote private git repositories into a container in an editable way

I'm trying to install private python-based git repos from a requirements.txt into a docker container such that they are easily editable during development.
For example, I have a Django project which contains a Dockerfile that allows building that project inside of a docker container. (It might look something like this https://github.com/JoeJasinski/docker-django-demo/blob/master/Dockerfile).
Now, say that project has a requirements.txt file that pulls in code from a private repos as follows.
django=1.11.2
-e git+git#github.com:myorg/my-private-project.git#egg=my_private_project
-e git+ssh://git#git.example.com/second-private-project#mytag#egg=second_private_project
-e git+https://github.com/myorg/third-private-project#egg=third_private_project
Ideally, I'd make it so I can edit both my main project, and the dependent repos without having to re-build the docker container each time. The Dockerfile "ADD . dest/" command makes it possible for the main project to be edited in place, but I'm having difficulty finding a good solution for installing these private repositories.
Normally (outside of Docker), the pip -e flag makes repos editable in place, which is great since I can edit and commit to them like any other repo.
However, inside of Docker, the container doesn't have access to the ssh private key needed to download the private repos (and this is probably a good thing, so we don't build the key into the docker images).
One thought I had is to download the private repos outside of the container, prior to building. Then somehow those repos would be "ADD"ed to the Docker container at build time and then individually added to the PYTHONPATH (maybe during runtime?). However, I feel like I'm over-complicating the situation.
Any suggestions as to a good, simple (Pythonic) way to install private python-based git repositories into a container so that it's easy to develop on both the main project and dependent repositories?

Referencing external private Git repository in CircleCi build

Here is the scenario I am dealing with:
I WANT to/HAVE setup CircleCI build for my project with unit tests etc.
In this project I use another one of my libraries which needs to be installed on the build container in CirleCi, otherwise my tests are failing.
I need to find a way to either:
pull git repository of external reference and install it
Or download it as zip
Or some other way ?
Happy to add more explanation if needed.
From the section Using Resources External to Your Repository:
CircleCI supports git submodule, and has advanced SSH key management to let you access multiple repositories from a single test suite. From your project’s Project Settings > Checkout SSH keys page, you can add a “user key” with one-click, allowing you access code from multiple repositories in your test suite. Git submodules can be easily set up in your circle.yml file (see example 1).
CircleCI’s VMs are connected to the internet. You can download dependencies directly while setting up your project, using curl or wget.
(Or just using git clone without submodules.)

PyPI automatic deployment

I have a repository (on GitHub) consisting of a number of modules that can be added to the main project as plugins. I want to set up the repository such that an automatic PyPI deployment is triggered (only for the changed module) every time a pull request is accepted.
Is there any way to achieve this?
Travis-CI supports automatic PyPI deployments but for the entire repository. I need it only for a folder inside the repo (a module).
You can use the after_success: option to implement custom deployments on travis-ci.
Something like:
after_success:
"cd $subfolder && python setup.py sdist upload -r pypi"
You will have to provide your pypi credentials yourself using whichever method you find best.

Categories

Resources