-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from KristinaGomoryova/pypi_cleanup
Pypi cleanup
- Loading branch information
Showing
8 changed files
with
90 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,26 +2,31 @@ | |
|
||
If you're looking for user documentation, go [here](README.md). | ||
|
||
## Development install | ||
## Package installation | ||
|
||
```shell | ||
# Create a virtual environment, e.g. with | ||
python -m venv env | ||
To create a new environment, use the micromamba: | ||
|
||
```console | ||
micromamba create -n rcx-tk poetry | ||
micromamba activate rcx-tk | ||
``` | ||
To install all dependencies specified in the `pyproject.toml` file, use poetry: | ||
|
||
# activate virtual environment | ||
source env/bin/activate | ||
```console | ||
poetry install | ||
``` | ||
|
||
# make sure to have a recent version of pip and setuptools | ||
python -m pip install --upgrade pip setuptools | ||
A command line interface was also implemented using Click, so the package can be run by either using python3: | ||
|
||
# (from the project root directory) | ||
# install rcx_tk as an editable package | ||
python -m pip install --no-cache-dir --editable . | ||
# install development dependencies | ||
python -m pip install --no-cache-dir --editable .[dev] | ||
```console | ||
python3 -m rcx_tk --method='' <path-to-input-data> <path-to-output-data> | ||
``` | ||
|
||
Afterwards check that the install directory is present in the `PATH` environment variable. | ||
or using poetry: | ||
|
||
```console | ||
poetry run rcx_tk --method='' <file-path-to-input-data> <file-path-to-output-data> | ||
``` | ||
|
||
## Running the tests | ||
|
||
|
@@ -116,9 +121,9 @@ make doctest | |
Bumping the version across all files is done with [bump-my-version](https://github.com/callowayproject/bump-my-version), e.g. | ||
|
||
```shell | ||
bump-my-version bump major # bumps from e.g. 0.3.2 to 1.0.0 | ||
bump-my-version bump minor # bumps from e.g. 0.3.2 to 0.4.0 | ||
bump-my-version bump patch # bumps from e.g. 0.3.2 to 0.3.3 | ||
poetry version major # bumps from e.g. 0.3.2 to 1.0.0 | ||
poetry version minor # bumps from e.g. 0.3.2 to 0.4.0 | ||
poetry version patch # bumps from e.g. 0.3.2 to 0.3.3 | ||
``` | ||
|
||
## Making a release | ||
|
@@ -145,50 +150,37 @@ In a new terminal: | |
# has the state of origin/main branch | ||
cd $(mktemp -d rcx_tk.XXXXXX) | ||
git clone [email protected]:RECETOX/rcx-tk . | ||
``` | ||
|
||
# make sure to have a recent version of pip and the publishing dependencies | ||
python -m pip install --upgrade pip | ||
python -m pip install .[publishing] | ||
|
||
# create the source distribution and the wheel | ||
python -m build | ||
Create and activate a new environment: | ||
|
||
# upload to test pypi instance (requires credentials) | ||
python -m twine upload --repository testpypi dist/* | ||
```console | ||
micromamba create -n rcx-tk-pypi poetry | ||
micromamba activate rcx-tk-pypi | ||
``` | ||
|
||
Visit | ||
[https://test.pypi.org/project/rcx_tk](https://test.pypi.org/project/rcx_tk) | ||
and verify that your package was uploaded successfully. Keep the terminal open, we'll need it later. | ||
Create an account on PyPI. | ||
|
||
In a new terminal, without an activated virtual environment or an env directory: | ||
In the Account settings, find the API tokens section and click on "Add API token". Copy your token. | ||
|
||
```shell | ||
cd $(mktemp -d rcx_tk-test.XXXXXX) | ||
Add your API token to Poetry: | ||
|
||
# prepare a clean virtual environment and activate it | ||
python -m venv env | ||
source env/bin/activate | ||
```console | ||
poetry config pypi-token.pypi your-api-token | ||
``` | ||
|
||
# make sure to have a recent version of pip and setuptools | ||
python -m pip install --upgrade pip | ||
Build your project: | ||
|
||
# install from test pypi instance: | ||
python -m pip -v install --no-cache-dir \ | ||
--index-url https://test.pypi.org/simple/ \ | ||
--extra-index-url https://pypi.org/simple rcx_tk | ||
```console | ||
poetry build | ||
``` | ||
|
||
Check that the package works as it should when installed from pypitest. | ||
|
||
Then upload to pypi.org with: | ||
Publish your package to PyPI: | ||
|
||
```shell | ||
# Back to the first terminal, | ||
# FINAL STEP: upload to PyPI (requires credentials) | ||
python -m twine upload dist/* | ||
```console | ||
poetry publish | ||
``` | ||
|
||
### (3/3) GitHub | ||
|
||
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. | ||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
## Badges | ||
|
||
(Customize these badges with your own links, and check https://shields.io/ or https://badgen.net/ to see which other badges are available.) | ||
|
||
| fair-software.eu recommendations | | | ||
| :-- | :-- | | ||
| (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 @@ | |
|
||
## How to use rcx_tk | ||
|
||
Tools for internal use | ||
`rcx-tk` package provides tools to process the metadata or alkane files. | ||
|
||
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: | ||
|
||
- columns rearrangement | ||
- validation of the file names | ||
- validation that the `injectionNumber` column is of integer type | ||
- derivation of new metadata: `sampleName`, `sequenceIdentifier`, `sampleIdentifier` and `localOrder` | ||
|
||
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. | ||
Finally, the processed dataframe is saved into user-defined location. | ||
|
||
## Installation | ||
|
||
|
@@ -32,12 +37,23 @@ To install rcx_tk from GitHub repository, do: | |
```console | ||
git clone [email protected]:RECETOX/rcx-tk.git | ||
cd rcx-tk | ||
python -m pip install . | ||
poetry install | ||
``` | ||
|
||
The main functions are process_metadata_file and process_alkane_ri_file. | ||
|
||
The tool can be run also using command-line interface, either by the python3 or poetry: | ||
|
||
```console | ||
python3 <path-to-__main.py__> --method='' <path-to-input-data> <path-to-output-data> | ||
``` | ||
|
||
```console | ||
poetry run rcx_tk --method='' <file-path-to-input-data> <file-path-to-output-data> | ||
``` | ||
## Documentation | ||
|
||
Include a link to your project's full documentation here. | ||
The project is documented [here](https://rcx-tk.readthedocs.io/en/latest/?badge=latest). | ||
|
||
## Contributing | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
name = "rcx-tk" | ||
version = "0.1.0" | ||
description = "This package adjusts and cleans the metadata file provided by a user." | ||
authors = ["Zargham Ahmad <[email protected]>" ] | ||
authors = ["Zargham Ahmad <[email protected]>" , "Kristina Gomoryova <[email protected]>"] | ||
license = "MIT" | ||
readme = "README.md" | ||
keywords = ["metadata", "alkanes", "metabolomics"] | ||
|
@@ -117,17 +117,11 @@ known-first-party = ["rcx_tk"] | |
force-single-line = true | ||
no-lines-before = ["future","standard-library","third-party","first-party","local-folder"] | ||
|
||
[[tool.bumpversion.files]] | ||
filename = "src/rcx_tk/__init__.py" | ||
|
||
[[tool.bumpversion.files]] | ||
filename = "pyproject.toml" | ||
|
||
[[tool.bumpversion.files]] | ||
filename = "CITATION.cff" | ||
|
||
[[tool.bumpversion.files]] | ||
filename = "docs/conf.py" | ||
|
||
[tool.poetry.scripts] | ||
rcx_tk = "rcx_tk.__main__:main" | ||
|
||
[tool.poetry_bumpversion.file."src/rcx_tk/__init__.py"] | ||
[tool.poetry_bumpversion.file."CITATION.cff"] | ||
[tool.poetry_bumpversion.file."docs/conf.py"] | ||
[tool.poetry_bumpversion.file."pyproject.toml"] | ||
|