- Notifications
You must be signed in to change notification settings - Fork0
DataShades/ckan-deps-installer
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
CopyMakefile
into the root of you main CKAN exntension and runmake prepare
. This command will download the latest version of scripts for managingportal dependencies.
Instead of copying Makefile manually, if you haveckanext-toolbelt installed, youcan use the following command:
ctb make config deps-makefile> Makefile
Runmake prepare
before using any of the commands below.
Whenever it's possible, consider using PyPI andrequirements.txt
(orsetuptools'install_requires
option). And only if extensions is not publishedto PyPI(or you need specific branch/tag/commit) use current tool.
Add all extensions required by your portal to the Makefile(it containsckanext-spatial
as an example) and runmake full-upgrade
to synchronize andinstall dependencies.
Any new dependency requires two changes in Makefile:
- Add extension alias to
ext_list
variable. - Describe the alias using syntax:
remote-ALIAS = REPOSITORY_URL REFERENCE_TYPE REFERENCE
You can use any word as alias, but the simplest option is to use extensionname. For example:
- use
scheming
as alias forckanext-scheming
and start alias' description withremote-scheming = ...
- use
dcat
as alias forckanext-dcat
and start alias' description withremote-dcat = ...
- use
spatial
as alias forckanext-spatial
and start alias' description withremote-spatial = ...
Repository URL is the same as one, you are using forgit clone REPOSITORY_URL
. For example:
ckanext-scheming
:https://github.com/ckan/ckanext-scheming.gitckanext-dcat
:https://github.com/ckan/ckanext-dcat.gitckanext-spatial
:https://github.com/ckan/ckanext-spatial.git
Reference type is one of the following:
branch
if you want to use specific branch of the projecttag
if you want to use specific tag of the projectcommit
if you want to use specific commit of the project
The best choice istag
, because it's self-descriptive. If tag is notavailable, prefer usingcommit
, because it guarantees predictable build. Andonly when none of above is available(or you are not afraid of accidentalbreaking changes), usebranch
The last part, reference, is a name of the git object you are referring to:
- if reference type set to
tag
, it can bev1.2.3
- if reference type set to
commit
, it can befa38c1e5
- if reference type set to
branch
, it can bemaster
Now you can do the following:
Synchronize(download missing and switch existing to correct tag/commit/branch) specific extension using its alias:
make sync-ALIAS# for example: make sync-spatial
Install specific extension using its alias. This command will install extension itself, and its
requirements.txt
if available.make install-ALIAS# for example: make install-spatial
Synchronize and install all extensions:
make sync install
Synchronize and install CKAN, all extensions and current extension(one, that contains Makefile):
make full-upgrade
If you want to install extra packages(pip install my_pkg[extra1,extra2]
), add following variable to the Makefile:
package_extras-remote-ALIAS = extra1,extra2
For example, if you want to installtest
extras for scheming and you definedscheming asremote-scheming
, you need the following line:
package_extras-remote-scheming =test
If you are using alternatives(<alternative>-<alias>
, described below), replaceremote
part with an alternative name. I.e, foralternative=dev
, you need to adapt extras definition in the following way:
package_extras-dev-scheming =test
Command | Description |
---|---|
version | check if current version of installer is correct |
prepare | Download/updatedeps.mk file, that contains the main logic |
list | list all dependencies |
ckanext-ALIAS | clone the extension if missing and checkout to the required state |
ckanext | perform ckanext-ALIAS for every single dependency |
sync-ALIAS | clone, update origin, reset changes and checkout the extension |
sync | perform sync-ALIAS for every single dependency |
install-ALIAS | install the extension and its pip-requirements |
install | perform install-ALIAS for every single dependency |
ckan-check | verify CKAN version |
check-ALIAS | check whether the extension is in required state |
check | perform check-ALIAS for every single dependency and dockan-check |
ckan | clone CKAN repository |
ckan-sync | set CKAN to the expected tag |
ckan-install | install CKAN with its requirements |
self-install | install current extension and its requirements |
full-upgrade | synchronize and install everything(it is just a combination ofsync ckan-sync install ckan-install self-install ) |
local-index | download all the requirements. This allows you to install the project withlocal=1 flag even without internet access |
In addition, some commands can behave differently when additional flags(x=y
)added to the command. For example,install
command can installdev-requirements.txt
if flagdevelop=1
added:
make install develop=1
Commands | Flag | Example | Behavior |
---|---|---|---|
sync* | alternative=PREFIX | alternative=dev | try using<prefix>-<ext> (i.e,dev-spatial instead ofremote-spatial ) definition of extensions before falling back toremote-<ext> . Default alternative value isremote |
install* | develop=ANYTHING | develop=1 | install dev-requirements if present |
install* | local=ANYTHING | local=1 | use local packages instead of PyPI(you need to build it first viamake local-index ) |
install* | pyright_compatible=ANYTHING | pyright_compatible=1 | make sure pyright can find installed packages during typechecking(via exportingSETUPTOOLS_ENABLE_FEATURES="legacy-editable" ) |
install*, local-index | index=FOLDER | index=pypi | path to local package index(relative to parent directory:../ ). By default: pypi |