Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
JaeAeich committed Jul 3, 2024
1 parent af32296 commit f114f2c
Show file tree
Hide file tree
Showing 10 changed files with 2,074 additions and 248 deletions.
8 changes: 4 additions & 4 deletions .cruft.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"template": "https://github.com/elixir-cloud-aai/cookiecutter-python",
"commit": "43f9bd92eaf21557e87d3932524fe5ffb6fd7ef4",
"commit": "fe9787042053d7cae1ccd7ff8d6fef4611f41b2a",
"checkout": null,
"context": {
"cookiecutter": {
"author_name": "ELIXIR Cloud AAI",
"author_email": "[email protected]",
"development_status": "Alpha",
"short_description": "File handler utilizing TUS and MinIO with DRS-Filer integration",
"development_status": "1 - Planning",
"short_description": "File handler utilizing TUS and MinIO with DRS-Filer integration.",
"project_name": "tus-storagehandler",
"project_slug": "tus_storagehandler",
"github_username": "elixir-cloud-aai",
"python_version": "3.11",
"add_script": "y",
"add_script": "n",
"year": "2024",
"_template": "https://github.com/elixir-cloud-aai/cookiecutter-python"
}
Expand Down
29 changes: 15 additions & 14 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
size, disability, ethnicity, sex characteristics, gender identity and
expression, level of experience, education, socio-economic status, nationality,
personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Expand Down Expand Up @@ -37,11 +37,11 @@ Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
Project maintainers have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, or to ban temporarily or permanently any
contributor for other behaviors that they deem inappropriate, threatening,
offensive, or harmful.

## Scope

Expand All @@ -55,10 +55,11 @@ further defined and clarified by project maintainers.
## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting [[email protected]][elixir-cloud-aai-email]. All complaints
will be reviewed and investigated and will result in a response that is deemed
necessary and appropriate to the circumstances. The project team is obligated
to maintain confidentiality with regard to the reporter of an incident. Further
reported by contacting
[[email protected]][elixir-cloud-aai-email]. All complaints will
be reviewed and investigated and will result in a response that is deemed
necessary and appropriate to the circumstances. The project team is obligated to
maintain confidentiality with regard to the reporter of an incident. Further
details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
Expand All @@ -67,8 +68,8 @@ members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor
Covenant][contributor-covenant], version 1.4, available at
This Code of Conduct is adapted from the
[Contributor Covenant][contributor-covenant], version 1.4, available at
<https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>

[contributor-covenant]: https://contributor-covenant.org/
Expand Down
16 changes: 8 additions & 8 deletions PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ Generally, **PRs are only reviewed when all boxes are ticked off and all
automated checks pass** (use the comment section below if you believe that
your PR is ready to be merged even though not all boxes were ticked off). -->

- \[ \] My code follows the [contributing guidelines][contributing-guidelines] of this
project, including, in particular, with regard to any style guidelines
- \[ \] The title of my PR complies with the [Conventional Commits
specification][conv-commits]; in particular, it clearly indicates
that a change is a breaking change
- \[ \] My code follows the [contributing guidelines][contributing-guidelines]
of this project, including, in particular, with regard to any style guidelines
- \[ \] The title of my PR complies with the
[Conventional Commits specification][conv-commits]; in particular, it clearly
indicates that a change is a breaking change
- \[ \] I acknowledge that all my commits will be squashed into a single commit,
using the PR title as the commit message
- \[ \] I have performed a self-review of my own code
Expand All @@ -39,9 +39,9 @@ your PR is ready to be merged even though not all boxes were ticked off). -->
changed behavior
- \[ \] I have added type annotations for all function/class/method interfaces
or updated existing ones (only for Python, TypeScript, etc.)
- \[ \] I have provided appropriate documentation ([Google-style Python
docstrings][py-doc-google]) for all packages/modules/functions/classes/
methods or updated existing ones
- \[ \] I have provided appropriate documentation
([Google-style Python docstrings][py-doc-google]) for all
packages/modules/functions/classes/ methods or updated existing ones
- \[ \] My changes generate no new warnings
- \[ \] I have added tests that prove my fix is effective or that my feature
works
Expand Down
169 changes: 53 additions & 116 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,143 +1,90 @@
# Python Cookiecutter Template
[![Bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://bandit.readthedocs.io/en/latest/)
[![codecov](https://codecov.io/gh/elixir-cloud-aai/tus-storagehandler/branch/main/graph/badge.svg)](https://codecov.io/gh/elixir-cloud-aai/tus-storagehandler)
[![Documentation Status](https://readthedocs.org/projects/tus_storagehandler/badge/?version=latest)](https://tus_storagehandler.readthedocs.io/en/latest/?badge=latest)
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](./LICENSE)
[![Python 3.11](https://img.shields.io/badge/python-3.11-blue.svg)](https://www.python.org/)
[![GitHub contributors](https://img.shields.io/github/contributors/elixir-cloud-aai/tus-storagehandler)](https://github.com/elixir-cloud-aai/tus-storagehandler/graphs/contributors)
[![Ruff](https://img.shields.io/badge/linter%20&%20formatter-ruff-000000.svg)](https://docs.astral.sh/ruff/)
[![Safety](https://img.shields.io/badge/security-safety-orange.svg)](https://safetycli.com/product/safety-cli)

This is a Cookiecutter template for creating a Python project with Poetry,
including configurations for various project settings.
# tus-storagehandler

File handler utilizing TUS and MinIO with DRS-Filer integration.

## Table of Contents

- [Introduction](#introduction)
- [Basic Usage](#basic-usage)
- [Installation](#installation)
- [Usage](#usage)
- [Configurations](#configurations)
- [Package manager - Poetry](#package-manager---poetry)
- [Linters and formatters - Ruff](#linters-and-formatters---ruff)
- [Spell checker - Typos](#spell-checker---typos)
- [Static type checker - Mypy](#static-type-checker---mypy)
- [Documentation - Sphinx](#documentation---sphinx)
- [Testing - pytest and pytest-cov](#testing---pytest-and-pytest-cov)
- [CI/CD - GitHub Actions](#cicd---github-actions)
- [Disclaimer](#disclaimer)
- [Development](#development)
- [Contributing](#contributing)
- [Code of Conduct](#code-of-conduct)
- [Versioning](#versioning)
- [License](#license)
- [Contact](#contact)

## Usage
## Basic Usage

1. **Install cruft** (if you haven't already):
## Installation

```sh
pip install cruft
```
## Development

For ease, certain scripts have been abbreviated in `Makefile`, make sure that
have installed the dependencies before running the commands.

2. **Generate a New Project**:
> **Note**: `make` commands are only available for Unix-based systems.
To view the commdands available, run:

```sh
cruft create https://github.com/elixir-cloud-aai/cookiecutter-python.git
make
```

### Don't wanna use cruft?

You can also use the `cookiecutter` command directly:
Here are certain commands that you might find useful:

1. **Install cookiecutter** (if you haven't already):
- Making a virtual environment

```sh
pip install cookiecutter
make v
```

2. **Generate a New Project**:
- Installing dependencies

```sh
cookiecutter gh:elixir-cloud-aai/cookiecutter-python
make i
```

> **Note**: If you're using just `cookiecutter`, manually remove
`update-template` job from `update.yaml` github action workflow file as
`cookiecutter` doesn't support autosync like cruft.

## Configurations

### Package manager - Poetry
- Running tests

This project uses [Poetry][poetry-org] as a package manager. Check out the
commands at the [official documentation][poetry-docs].

### Linters and formatters - Ruff

To lint and format `Python` code files, it uses [Ruff][ruff], the default
configuration is set in the `pyproject.toml` file.

```toml
select = [
"B", # flake8-bugbear
"E", # pycodestyle
"F", # Pyflakes
"I", # isort
"PL", # pylint
"SIM", # flake8-simplify
"UP", # pyupgrade
]
```sh
make t
```

To configure it to your needs, refer to the [rules documentation][rudff-linter]
, and for formatter configuration, refer to the
[configuration documentation][ruff-formatter].
- Running linter, formatter and spell checker

### Spell checker - Typos

If you want to ignore certain words, add them to the `pyproject.toml` file,
under the `tool.typos.default.extend-words` key.

```toml
[tool.typos.default.extend-words]
mke = 'mke'
```sh
make fl
```

For further configuration, refer to the [typos docs][typos-docs].
- Building the documentation

### Static type checker - Mypy

Change the configuration in `pyproject.toml` file, for further information refer to
the [documentation][mypy-config].

### Documentation - Sphinx

Configuration for Sphinx is in the `docs/source/conf.py` file, for further info refer
to the [Sphinx documentation][sphinx-docs]. The default configuration uses
[furo theme][furo] and [ReadTheDocs][rtd] to host the documentation, you can
change the configuration using `/docs/source/conf.py` and `.readthedocs.yml`
file.

> **Note**: Make sure to setup the `ReadTheDocs` account and add the project to
the account to host the documentation.

### Testing - pytest and pytest-cov

Generate a coverage report using `pytest-cov` and uploads it to codecov.io.

> **Note**: Make sure to setup the `Codecov` account and add the project to the
account to host the coverage report and add github [token](#cicd---github-actions).

## CI/CD - GitHub Actions
```sh
make d
```

Here are the GitHub Actions Secrets that need to be included in the repository
settings:
- Running type checker

- `PYPI_PASSWORD`: PyPI account password.
- `CODECOV_TOKEN`: Codecov token.
- `AUTO_UPDATE_GITHUB_TOKEN`: GitHub token with permissions to write to the repository.
```sh
make tc
```

## Disclaimer
- Running all pre-commit checks

Some of the links and images have been hardcoded with `ELIXIR Cloud & AAI`'s
assets in the documentation, please update them manually if needed. These
assets **MUST** be included for projects owned by ELIXIR Cloud & AAI, but
**MUST NOT** be included for projects that are not (personal projects, projects
owned by other orgs).
```sh
make pc
```

**Only`markdown` files and `images/` directory need to be changed.**
> **Note**: This is not the complete list of commands, run `make` to find if
> more have been added.
## Contributing

Expand All @@ -162,7 +109,7 @@ leaders.
## Versioning

The project adopts the [semantic versioning][semver] scheme for versioning.
Currently the service is in a pre-release stage, so changes to the API,
Currently the software is in a pre-release stage, so changes to the API,
including breaking changes, may occur at any time without further notice.

## License
Expand All @@ -174,13 +121,12 @@ copy of which is also available in [`LICENSE`][license].

The project is maintained by [ELIXIR Cloud & AAI][elixir-cloud-aai], a Driver
Project of the [Global Alliance for Genomics and Health (GA4GH)][ga4gh], under
the umbrella of the [ELIXIR][elixir] [Compute Platform][elixir-compute].
the umbrella of the [ELIXIR] [Compute Platform][elixir-compute].

To get in touch with us, please use one of the following routes:

- For filing bug reports, feature requests or other code-related issues, please
make use of the project's
[issue tracker](https://github.com/elixir-cloud-aai/cookiecutter-python/issues).
make use of the project's [issue tracker][issue-tracker].
- For private/personal issues, more involved communication, or if you would like
to join our team as a regular contributor, you can either join our
[chat board][badge-chat-url] or [email] the community leaders.
Expand All @@ -196,17 +142,8 @@ To get in touch with us, please use one of the following routes:
[elixir-compute]: https://elixir-europe.org/platforms/compute
[email]: mailto:[email protected]
[ga4gh]: https://ga4gh.org/
[issue-tracker]: https://github.com/elixir-cloud-aai/tus-storagehandler/issues
[license]: LICENSE
[logo-elixir]: images/logo-elixir.svg
[logo-elixir-cloud-aai]: images/logo-elixir-cloud-aai.svg
[poetry-org]: https://python-poetry.org/
[poetry-docs]: https://python-poetry.org/docs/cli/
[ruff]: https://docs.astral.sh/ruff
[ruff-linter]: https://docs.astral.sh/ruff/rules/
[ruff-formatter]: https://docs.astral.sh/ruff/formatter
[typos-docs]: https://pypi.org/project/typos/
[mypy-config]: https://mypy.readthedocs.io/en/stable/config_file.html
[sphinx-docs]: https://www.sphinx-doc.org/en/master/usage/configuration.html
[furo]: https://pradyunsg.me/furo/quickstart/
[rtd]: https://readthedocs.org/
[semver]:https://semver.org/
[semver]: https://semver.org/
34 changes: 17 additions & 17 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

# -- Project information -----------------------------------------------------
def _get_project_meta():
_pyproject_path = Path(__file__).parents[2] / "pyproject.toml"
with open(_pyproject_path, mode="rb") as pyproject:
return tomli.load(pyproject)["tool"]["poetry"]
_pyproject_path = Path(__file__).parents[2] / "pyproject.toml"
with open(_pyproject_path, mode="rb") as pyproject:
return tomli.load(pyproject)["tool"]["poetry"]


pkg_meta = _get_project_meta()
Expand All @@ -38,20 +38,20 @@ def _get_project_meta():
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.todo",
"sphinx.ext.coverage",
"sphinx.ext.viewcode",
"sphinx.ext.autosummary",
# Used to write beautiful docstrings:
"sphinx.ext.napoleon",
# Used to include .md files:
"m2r2",
# Used to insert typehints into the final docs:
"sphinx_autodoc_typehints",
# Used to embed values from the source code into the docs:
"added_value",
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.todo",
"sphinx.ext.coverage",
"sphinx.ext.viewcode",
"sphinx.ext.autosummary",
# Used to write beautiful docstrings:
"sphinx.ext.napoleon",
# Used to include .md files:
"m2r2",
# Used to insert typehints into the final docs:
"sphinx_autodoc_typehints",
# Used to embed values from the source code into the docs:
"added_value",
]
# Set `typing.TYPE_CHECKING` to `True`:
# https://pypi.org/project/sphinx-autodoc-typehints/
Expand Down
Loading

0 comments on commit f114f2c

Please sign in to comment.