Skip to content

Commit c65f19f

Browse files
committed
Doc (Readme): Updated readme documentation
1 parent a86f79d commit c65f19f

File tree

1 file changed

+39
-70
lines changed

1 file changed

+39
-70
lines changed

README.md

Lines changed: 39 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,9 @@
11
[![Tests](https://github.com//ckanext-versions/workflows/Tests/badge.svg?branch=main)](https://github.com//ckanext-versions/actions)
22

33
# ckanext-versions
4-
5-
**TODO:** Put a description of your extension here: What does it do? What features does it have? Consider including some screenshots or embedding a video!
6-
7-
8-
## Requirements
9-
10-
**TODO:** For example, you might want to mention here which versions of CKAN this
11-
extension works with.
12-
13-
If your extension works across different versions you can add the following table:
14-
15-
Compatibility with core CKAN versions:
16-
17-
| CKAN version | Compatible? |
18-
| --------------- | ------------- |
19-
| 2.6 and earlier | not tested |
20-
| 2.7 | not tested |
21-
| 2.8 | not tested |
22-
| 2.9 | not tested |
23-
24-
Suggested values:
25-
26-
* "yes"
27-
* "not tested" - I can't think of a reason why it wouldn't work
28-
* "not yet" - there is an intention to get it working
29-
* "no"
30-
4+
This CKAN extension allows users to create and manage versions of datasets. It provides a versioning system that tracks changes made to datasets over time and allows user to view and download previous versions.
315

326
## Installation
33-
34-
**TODO:** Add any additional install steps to the list below.
35-
For example installing any non-Python dependencies or adding any required
36-
config settings.
37-
387
To install ckanext-versions:
398

409
1. Activate your CKAN virtual environment, for example:
@@ -56,68 +25,68 @@ To install ckanext-versions:
5625

5726
sudo service apache2 reload
5827

28+
## API Documentation
5929

60-
## Config settings
61-
62-
None at present
30+
### `package_version_create`
31+
**Description**: Creates a new version of a dataset.
6332

64-
**TODO:** Document any optional config settings here. For example:
33+
**Parameters**:
34+
- `package_id` (str): The ID of the dataset.
35+
- `name` (str): The name of the version.
36+
- `description` (str, optional): The description of the version.
37+
- `creator_user_id` (str, optional): The ID of the user creating the version.
6538

66-
# The minimum number of hours to wait before re-checking a resource
67-
# (optional, default: 24).
68-
ckanext.versions.some_setting = some_default_value
39+
**Returns**: A dictionary representing the created version.
6940

7041

71-
## Developer installation
42+
### `package_version_update`
43+
**Description**: Updates an existing dataset version.
7244

73-
To install ckanext-versions for development, activate your CKAN virtualenv and
74-
do:
75-
76-
git clone https://github.com//ckanext-versions.git
77-
cd ckanext-versions
78-
pip install -e .
79-
pip install -r dev-requirements.txt
45+
**Parameters**:
46+
- `data_dict` (dict): Contains the version details to update.
8047

48+
**Returns**: A dictionary representing the updated version.
8149

82-
## Tests
8350

84-
To run the tests, do:
51+
### `package_version_show`
52+
**Description**: Retrieves details of a specific dataset version.
8553

86-
pytest --ckan-ini=test.ini
54+
**Parameters**:
55+
- `id` (str): The ID of the version.
8756

57+
**Returns**: A dictionary representing the version.
8858

89-
## Releasing a new version of ckanext-versions
9059

91-
If ckanext-versions should be available on PyPI you can follow these steps to publish a new version:
9260

93-
1. Update the version number in the `pyproject.toml` file. See [PEP 440](http://legacy.python.org/dev/peps/pep-0440/#public-version-identifiers) for how to choose version numbers.
61+
### `package_version_list`
62+
**Description**: Lists all versions of a dataset.
9463

95-
2. Make sure you have the latest version of necessary packages:
64+
**Parameters**:
65+
- `package_id` (str): The ID of the dataset.
9666

97-
pip install --upgrade setuptools wheel twine
67+
**Returns**: A list of dictionaries representing the versions.
9868

99-
3. Create a source and binary distributions of the new version:
10069

101-
python -m build && twine check dist/*
10270

103-
Fix any errors you get.
71+
### `package_version_delete`
72+
**Description**: Deletes a specific dataset version.
10473

105-
4. Upload the source distribution to PyPI:
74+
**Parameters**:
75+
- `id` (str): The ID of the version to delete.
10676

107-
twine upload dist/*
77+
**Returns**: A dictionary indicating success.
10878

109-
5. Commit any outstanding changes:
11079

111-
git commit -a
112-
git push
11380

114-
6. Tag the new release of the project on GitHub with the version number from
115-
the `setup.py` file. For example if the version number in `setup.py` is
116-
0.0.1 then do:
81+
### `package_version_diff`
82+
**Description**: Returns a diff of the current version compared to the previous version.
11783

118-
git tag 0.0.1
119-
git push --tags
84+
**Parameters**:
85+
- `id` (str): The ID of the version.
86+
- `diff_type` (str, optional): The type of diff (`unified`, `context`, or `html`).
12087

121-
## License
88+
**Returns**: A dictionary containing the diff.
12289

123-
[AGPL](https://www.gnu.org/licenses/agpl-3.0.en.html)
90+
**Errors**:
91+
- `ObjectNotFound`: If the version or previous version is not found.
92+
- `ValidationError`: If `diff_type` is not recognized.

0 commit comments

Comments
 (0)