Skip to content

Commit 782ed33

Browse files
authored
Merge pull request #17 from ResearchObject/prepare-release
Move build system to poetry and prepare for release
2 parents 28c96c9 + f0b70c9 commit 782ed33

18 files changed

+1881
-104
lines changed

.github/workflows/lint.yml

+9-7
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,19 @@ jobs:
2121
uses: actions/setup-python@v5
2222
with:
2323
python-version: "3.10"
24+
- name: Install poetry
25+
run: |
26+
sudo apt install -y pipx
27+
pipx install poetry
2428
- name: Install dependencies
2529
run: |
26-
python -m pip install --upgrade pip
27-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
28-
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
30+
poetry install
2931
- name: Lint with flake8
3032
run: |
3133
# stop the build if there are Python syntax errors or undefined names
32-
flake8 ./src/rocrate_upload --count --select=E9,F63,F7,F82 --show-source --statistics
33-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
34-
flake8 .B/src/rocrate_upload --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
34+
poetry run flake8 ./src/rocrate_zenodo --count --select=E9,F63,F7,F82 --show-source --statistics
35+
# The GitHub editor is 127 chars wide
36+
poetry run flake8 ./src/rocrate_zenodo --count --max-complexity=10 --max-line-length=127 --statistics
3537
- name: Lint with black
3638
run: |
37-
black --check --diff .
39+
poetry run black --check --diff .

.github/workflows/test.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,16 @@ jobs:
2525
uses: actions/setup-python@v5
2626
with:
2727
python-version: ${{ matrix.python-version }}
28+
- name: Install poetry
29+
run: |
30+
sudo apt install -y pipx
31+
pipx install poetry
2832
- name: Install dependencies
2933
run: |
30-
python -m pip install --upgrade pip
31-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
32-
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
34+
poetry install
3335
- name: Lint with mypy
3436
run: |
35-
mypy .
37+
poetry run mypy .
3638
- name: Test with pytest
3739
run: |
38-
pytest
40+
poetry run pytest

demo/demo.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from rocrate.rocrate import ROCrate
22

3-
from rocrate_upload.upload import (
3+
from rocrate_zenodo.upload import (
44
build_zenodo_metadata_from_crate,
55
ensure_crate_zipped,
66
upload_crate_to_zenodo,

docs/developer_guide.md

+15-7
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
1-
# Developer Guide - Under Construction
1+
# Developer Guide
22

33
## Environment
44

5-
Install dependencies:
5+
### Poetry setup
66

7+
If you do not already have `poetry` installed, install it following the [Poetry installation documentation](https://python-poetry.org/docs/#installation).
8+
9+
Then install dependencies from `poetry.lock`:
10+
11+
```bash
12+
poetry install
13+
```
14+
15+
Activate the virtual environment:
716
```bash
8-
# general dependencies
9-
pip install -r requirements.txt
10-
# dev dependencies
11-
pip install -r requirements-dev.txt
17+
poetry shell
1218
```
1319

20+
### Zenodo access token setup
21+
1422
Configure Zenodo access token(s) as in [user guide - Set up a Zenodo personal access token](user_guide.md#set-up-a-zenodo-personal-access-token).
1523

1624
## Run tests
1725

18-
Beware that tests may make Zenodo uploads using your access token.
26+
Beware that tests can make Zenodo uploads using your access token.
1927

2028
In the root directory:
2129
```bash

docs/user_guide.md

+16-17
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
# User Guide - Under Construction
1+
# User Guide
22

3-
## Install the project
3+
## Setup
44

5+
### Install the package
6+
7+
Install from PyPI using `pip` or your preferred package manager:
58
```
6-
git clone https://github.com/ResearchObject/ro-crate-uploader.git
7-
cd ro-crate-uploader
8-
pip install -r requirements.txt
9-
pip install .
9+
pip install rocrate_zenodo
1010
```
11-
12-
## Set up a Zenodo personal access token
11+
### Set up a Zenodo personal access token
1312

1413
Create a file called `~/.config/zenodo.ini` on your computer with the following contents:
1514

@@ -47,23 +46,23 @@ api_token = your-token-here
4746

4847
`ro-crate-uploader` will read this token whenever it connects to Zenodo in order to perform actions under your account. It's recommended to use the Zenodo sandbox until you're confident using `ro-crate-uploader`.
4948

50-
## Run the code
49+
## Usage
5150

52-
Run the `rocrate_upload` command in your terminal. Use the `-s` flag to upload to Zenodo sandbox, or omit it to upload to real Zenodo.
51+
To upload a crate to Zenodo sandbox:
5352
```
54-
rocrate_upload -s demo/demo_crate
53+
rocrate_zenodo -s demo/demo_crate
5554
```
56-
Replace `demo/demo_crate` with the path to the RO-Crate directory you want to upload.
55+
Replace `demo/demo_crate` with the path to the RO-Crate directory you want to upload. The `-s` flag sets the destination to the Zenodo sandbox; you can omit `-s` to upload to real Zenodo.
5756

5857
Once complete, you should see the draft record in your Zenodo dashboard.
5958

60-
Further info:
59+
For further help and options, run:
6160
```
62-
rocrate_upload --help
61+
rocrate_zenodo --help
6362
```
6463

6564
## Tips
6665

67-
1. Set `givenName` and `familyName` on authors of the RO-Crate.
68-
2. Use the SPDX URI for the top-level license, e.g. `https://spdx.org/licenses/CC-BY-NC-SA-4.0.html`
69-
3. Check your upload carefully before publishing.
66+
1. Set `givenName` and `familyName` on authors of the RO-Crate. This ensures that author names are formatted correctly in Zenodo.
67+
2. Use the SPDX URI for the top-level license, e.g. `https://spdx.org/licenses/CC-BY-NC-SA-4.0.html`. Other URIs for licenses are not currently well supported.
68+
3. Check your upload carefully in the Zenodo web interface before publishing. Not all metadata will be carried across from the RO-Crate, and some may be transferred incorrectly. Please [raise an issue](https://github.com/ResearchObject/ro-crate-uploader/issues/new) if you notice a discrepancy.

0 commit comments

Comments
 (0)