Skip to content

Commit 6522f37

Browse files
authored
Merge pull request #31 from KristinaGomoryova/pypi_cleanup
Pypi cleanup
2 parents e475977 + 71dc774 commit 6522f37

8 files changed

+90
-130
lines changed

CHANGELOG.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9-
## [0.0.1] - 1900-12-31
9+
## [0.1.0] - 2024-07-15
1010

1111
### Added
1212

13+
- function to read the metadata or alkane file in csv/tsv/xls/xlsx format
14+
- function to process the metadata file: validate file names, derive and rearrange additional metadata columns
15+
- function to save the processed metadata or alkane dataframe as tsv
16+
1317
### Removed
1418

1519
### Changed

CITATION.cff

+2
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,7 @@ repository-code: "https://github.com/RECETOX/rcx-tk"
1313
keywords:
1414
- rcx
1515
- process metadata
16+
- alkanes
17+
- metabolomics
1618
message: "If you use this software, please cite it using these metadata."
1719
license: MIT

NOTICE

-2
This file was deleted.

README.dev.md

+40-48
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,31 @@
22

33
If you're looking for user documentation, go [here](README.md).
44

5-
## Development install
5+
## Package installation
66

7-
```shell
8-
# Create a virtual environment, e.g. with
9-
python -m venv env
7+
To create a new environment, use the micromamba:
8+
9+
```console
10+
micromamba create -n rcx-tk poetry
11+
micromamba activate rcx-tk
12+
```
13+
To install all dependencies specified in the `pyproject.toml` file, use poetry:
1014

11-
# activate virtual environment
12-
source env/bin/activate
15+
```console
16+
poetry install
17+
```
1318

14-
# make sure to have a recent version of pip and setuptools
15-
python -m pip install --upgrade pip setuptools
19+
A command line interface was also implemented using Click, so the package can be run by either using python3:
1620

17-
# (from the project root directory)
18-
# install rcx_tk as an editable package
19-
python -m pip install --no-cache-dir --editable .
20-
# install development dependencies
21-
python -m pip install --no-cache-dir --editable .[dev]
21+
```console
22+
python3 -m rcx_tk --method='' <path-to-input-data> <path-to-output-data>
2223
```
2324

24-
Afterwards check that the install directory is present in the `PATH` environment variable.
25+
or using poetry:
26+
27+
```console
28+
poetry run rcx_tk --method='' <file-path-to-input-data> <file-path-to-output-data>
29+
```
2530

2631
## Running the tests
2732

@@ -116,9 +121,9 @@ make doctest
116121
Bumping the version across all files is done with [bump-my-version](https://github.com/callowayproject/bump-my-version), e.g.
117122

118123
```shell
119-
bump-my-version bump major # bumps from e.g. 0.3.2 to 1.0.0
120-
bump-my-version bump minor # bumps from e.g. 0.3.2 to 0.4.0
121-
bump-my-version bump patch # bumps from e.g. 0.3.2 to 0.3.3
124+
poetry version major # bumps from e.g. 0.3.2 to 1.0.0
125+
poetry version minor # bumps from e.g. 0.3.2 to 0.4.0
126+
poetry version patch # bumps from e.g. 0.3.2 to 0.3.3
122127
```
123128

124129
## Making a release
@@ -145,50 +150,37 @@ In a new terminal:
145150
# has the state of origin/main branch
146151
cd $(mktemp -d rcx_tk.XXXXXX)
147152
git clone [email protected]:RECETOX/rcx-tk .
153+
```
148154

149-
# make sure to have a recent version of pip and the publishing dependencies
150-
python -m pip install --upgrade pip
151-
python -m pip install .[publishing]
152-
153-
# create the source distribution and the wheel
154-
python -m build
155+
Create and activate a new environment:
155156

156-
# upload to test pypi instance (requires credentials)
157-
python -m twine upload --repository testpypi dist/*
157+
```console
158+
micromamba create -n rcx-tk-pypi poetry
159+
micromamba activate rcx-tk-pypi
158160
```
159161

160-
Visit
161-
[https://test.pypi.org/project/rcx_tk](https://test.pypi.org/project/rcx_tk)
162-
and verify that your package was uploaded successfully. Keep the terminal open, we'll need it later.
162+
Create an account on PyPI.
163163

164-
In a new terminal, without an activated virtual environment or an env directory:
164+
In the Account settings, find the API tokens section and click on "Add API token". Copy your token.
165165

166-
```shell
167-
cd $(mktemp -d rcx_tk-test.XXXXXX)
166+
Add your API token to Poetry:
168167

169-
# prepare a clean virtual environment and activate it
170-
python -m venv env
171-
source env/bin/activate
168+
```console
169+
poetry config pypi-token.pypi your-api-token
170+
```
172171

173-
# make sure to have a recent version of pip and setuptools
174-
python -m pip install --upgrade pip
172+
Build your project:
175173

176-
# install from test pypi instance:
177-
python -m pip -v install --no-cache-dir \
178-
--index-url https://test.pypi.org/simple/ \
179-
--extra-index-url https://pypi.org/simple rcx_tk
174+
```console
175+
poetry build
180176
```
181177

182-
Check that the package works as it should when installed from pypitest.
183-
184-
Then upload to pypi.org with:
178+
Publish your package to PyPI:
185179

186-
```shell
187-
# Back to the first terminal,
188-
# FINAL STEP: upload to PyPI (requires credentials)
189-
python -m twine upload dist/*
180+
```console
181+
poetry publish
190182
```
191183

192184
### (3/3) GitHub
193185

194-
Don't forget to also make a [release on GitHub](https://github.com/RECETOX/rcx-tk/releases/new). If your repository uses the GitHub-Zenodo integration this will also trigger Zenodo into making a snapshot of your repository and sticking a DOI on it.
186+
Don't forget to also make a [release on GitHub](https://github.com/RECETOX/rcx-tk/releases/new). If your repository uses the GitHub-Zenodo integration this will also trigger Zenodo into making a snapshot of your repository and sticking a DOI on it.

README.md

+22-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
## Badges
22

3-
(Customize these badges with your own links, and check https://shields.io/ or https://badgen.net/ to see which other badges are available.)
4-
53
| fair-software.eu recommendations | |
64
| :-- | :-- |
75
| (1/5) code repository | [![github repo badge](https://img.shields.io/badge/github-repo-000.svg?logo=github&labelColor=gray&color=blue)](https://github.com/RECETOX/rcx-tk) |
@@ -21,9 +19,16 @@
2119

2220
## How to use rcx_tk
2321

24-
Tools for internal use
22+
`rcx-tk` package provides tools to process the metadata or alkane files.
23+
24+
On the input, the user is expected to supply a path to the metadata/alkane file in tsv/csv/xls/xlsx file. The file is then converted to a dataframe which is further processed. The main steps are:
25+
26+
- columns rearrangement
27+
- validation of the file names
28+
- validation that the `injectionNumber` column is of integer type
29+
- derivation of new metadata: `sampleName`, `sequenceIdentifier`, `sampleIdentifier` and `localOrder`
2530

26-
The project setup is documented in [project_setup.md](project_setup.md). Feel free to remove this document (and/or the link to this document) if you don't need it.
31+
Finally, the processed dataframe is saved into user-defined location.
2732

2833
## Installation
2934

@@ -32,12 +37,23 @@ To install rcx_tk from GitHub repository, do:
3237
```console
3338
git clone [email protected]:RECETOX/rcx-tk.git
3439
cd rcx-tk
35-
python -m pip install .
40+
poetry install
41+
```
42+
43+
The main functions are process_metadata_file and process_alkane_ri_file.
44+
45+
The tool can be run also using command-line interface, either by the python3 or poetry:
46+
47+
```console
48+
python3 <path-to-__main.py__> --method='' <path-to-input-data> <path-to-output-data>
3649
```
3750

51+
```console
52+
poetry run rcx_tk --method='' <file-path-to-input-data> <file-path-to-output-data>
53+
```
3854
## Documentation
3955

40-
Include a link to your project's full documentation here.
56+
The project is documented [here](https://rcx-tk.readthedocs.io/en/latest/?badge=latest).
4157

4258
## Contributing
4359

next_steps.md

-47
This file was deleted.

project_setup.md

+14-13
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ checklist](https://guide.esciencecenter.nl/#/best_practices/checklist).
1111

1212
This repository is set up with Python versions:
1313

14-
- 3.8
15-
- 3.9
16-
- 3.10
1714
- 3.11
1815
- 3.12
1916

@@ -23,19 +20,23 @@ versions.
2320

2421
## Package management and dependencies
2522

26-
You can use either pip or conda for installing dependencies and package management. This repository does not force you
27-
to use one or the other, as project requirements differ. For advice on what to use, please check [the relevant section
28-
of the
29-
guide](https://guide.esciencecenter.nl/#/best_practices/language_guides/python?id=dependencies-and-package-management).
23+
For installing the dependencies and package management, [micromamba](https://mamba.readthedocs.io/en/latest/user_guide/micromamba.html) and [poetry](https://python-poetry.org/) have been used.
3024

31-
- Runtime dependencies should be added to `pyproject.toml` in the `dependencies` list under `[project]`.
32-
- Development dependencies should be added to `pyproject.toml` in one of the lists under `[project.optional-dependencies]`.
25+
The dependencies are listed in the `pyproject.toml` file under the section `[tool.poetry.dependencies]` and `[tool.poetry.group.dev.dependencies]`.
3326

3427
## Packaging/One command install
3528

36-
You can distribute your code using PyPI.
37-
[The guide](https://guide.esciencecenter.nl/#/best_practices/language_guides/python?id=building-and-packaging-code) can
38-
help you decide which tool to use for packaging.
29+
To create a new environment, use the micromamba:
30+
31+
```console
32+
micromamba create -n rcx-tk poetry
33+
micromamba activate rcx-tk
34+
```
35+
To install all dependencies specified in the `pyproject.toml` file, use poetry:
36+
37+
```console
38+
poetry install
39+
```
3940

4041
## Testing and code coverage
4142

@@ -114,4 +115,4 @@ help you decide which tool to use for packaging.
114115
## NOTICE
115116

116117
- List of attributions of this project and Apache-license dependencies
117-
- [Relevant section in the guide](https://guide.esciencecenter.nl/#/best_practices/licensing?id=notice)
118+
- [Relevant section in the guide](https://guide.esciencecenter.nl/#/best_practices/licensing?id=notice)

pyproject.toml

+7-13
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "rcx-tk"
33
version = "0.1.0"
44
description = "This package adjusts and cleans the metadata file provided by a user."
5-
authors = ["Zargham Ahmad <[email protected]>" ]
5+
authors = ["Zargham Ahmad <[email protected]>" , "Kristina Gomoryova <[email protected]>"]
66
license = "MIT"
77
readme = "README.md"
88
keywords = ["metadata", "alkanes", "metabolomics"]
@@ -117,17 +117,11 @@ known-first-party = ["rcx_tk"]
117117
force-single-line = true
118118
no-lines-before = ["future","standard-library","third-party","first-party","local-folder"]
119119

120-
[[tool.bumpversion.files]]
121-
filename = "src/rcx_tk/__init__.py"
122-
123-
[[tool.bumpversion.files]]
124-
filename = "pyproject.toml"
125-
126-
[[tool.bumpversion.files]]
127-
filename = "CITATION.cff"
128-
129-
[[tool.bumpversion.files]]
130-
filename = "docs/conf.py"
131-
132120
[tool.poetry.scripts]
133121
rcx_tk = "rcx_tk.__main__:main"
122+
123+
[tool.poetry_bumpversion.file."src/rcx_tk/__init__.py"]
124+
[tool.poetry_bumpversion.file."CITATION.cff"]
125+
[tool.poetry_bumpversion.file."docs/conf.py"]
126+
[tool.poetry_bumpversion.file."pyproject.toml"]
127+

0 commit comments

Comments
 (0)