-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(template): Better template README, use ruff instead of black, us…
…e pyproject.toml
- Loading branch information
Showing
9 changed files
with
231 additions
and
140 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,100 @@ | ||
# OCF Template Repository | ||
Template Repository for OCF Projects | ||
# OCF Template | ||
|
||
## Usage | ||
**Starting point for OCF projects** | ||
|
||
Do the following to customize the repo to the project: | ||
[![contributors badge](https://img.shields.io/github/contributors/openclimatefix/ocf-template?color=FFFFFF)](https://github.com/openclimatefix/ocf-template/graphs/contributors) | ||
[![workflows badge](https://img.shields.io/github/actions/workflow/status/openclimatefix/ocf-template/ci.yml?branch=maine&color=FFD053)](https://github.com/openclimatefix/ocf-template/actions/workflows/ci.yml) | ||
[![issues badge](https://img.shields.io/github/issues/openclimatefix/ocf-template?color=FFAC5F)](https://github.com/openclimatefix/ocf-template/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc) | ||
[![tags badge](https://img.shields.io/github/v/tag/openclimatefix/ocf-template?include_prereleases&sort=semver&color=7BCDF3)](https://github.com/openclimatefix/ocf-template/tags) | ||
[![pypi badge](https://img.shields.io/pypi/v/ocf-template?&color=086788)](https://pypi.org/project/ocf-template) | ||
[![documentation badge](https://img.shields.io/badge/docs-latest-333333)](https://openclimatefix.github.io/ocf-template/) | ||
|
||
- Replace `src` with name of the library/project | ||
- Update `setup.py` with the proper info | ||
- Change `commit` to `True` in `.bumpversion.cfg` if you want the minor version | ||
to increment on every commit. | ||
- Add PyPi access token to release to PyPi | ||
- Update name of folder in the test workflow | ||
This section of the README should contain a brief description of the project. | ||
Perhaps give a short amount of context around why it exists; the problem it solves. | ||
By the end of reading this short paragraph, a contributor should not be confused | ||
as to the purpose of the repository and its role in the organisation. | ||
|
||
They might even have an idea of how it could be useful to them! | ||
|
||
> [!Note] | ||
> Any important callouts (informing visitors this repository is in early | ||
> design stages, or not for general use, or requires a lot of prerequisite | ||
> knowledge or infrastructure) should be placed in a note like this. | ||
> Like: This repository does not hold template workflows, contributing | ||
> guides, etc - head to | ||
> [OCF's .github repository](https://github.com/openclimatefix/.github) | ||
> for those. | ||
## Installation | ||
|
||
How to install the project for *general use* - **not** for development: | ||
"`pip install x`", or "pull the latest checkpoint from `y`", | ||
not "clone the repo and run `make install`". | ||
For example, to "install" this template as the basis of a new repository, | ||
do the following: | ||
|
||
1. Click **Use this template** (in green) above the upper right of this file | ||
2. Select **Create a new repository** | ||
3. Create the new repository as desired | ||
|
||
## Example usage | ||
|
||
One or two short examples of using the project to solve a problem. | ||
Quick happy-path examples that show the project in action or outline a | ||
common use case. | ||
|
||
> [!Note] | ||
> If the project does not have a clear usage pattern, consider informing the | ||
> user as such in the first callout. Then you can skip *Installation* and | ||
> *Example usage* - perhaps replacing them with a *Quickstart* section - | ||
> or just moving straight on to *Development*. | ||
Once you have installed the project into a new GitHub repository, | ||
`git clone` it and `cd` into the created directory. | ||
|
||
**For a Python project:** | ||
|
||
Modify the `pyproject.toml` | ||
file, updating the name, description, authors, and dependencies as needed. | ||
Install the project in editable mode (in a new virtual environment!) | ||
with `pip install -e .`. | ||
|
||
Also, importantly, update this README! | ||
|
||
**For other projects:** | ||
|
||
Simply delete `src` and `pyproject.toml`, and just use the README part of the template. | ||
|
||
*For more information, head to the [Documentation](#documentation).* | ||
|
||
## Documentation | ||
|
||
Link to the project's documentation, if it exists. Also consider internal | ||
linking to parts of interest of the documentation, such as **Development**, | ||
**API**, **Configuration** and so on. | ||
|
||
## Development | ||
|
||
Anything specific to getting set up for development on the project: required libraries, | ||
infrastructure, extra tools that may be desired ([MyPy](https://mypy.readthedocs.io/en/stable/), | ||
[pre-commit](https://pre-commit.com/), etc). Also, how to run tests! | ||
|
||
Make sure you have the most up to date drivers for your 32 GPU array to use this template! | ||
|
||
> [!Note] | ||
> The development section might be contained within the documentation, in which case | ||
> remove the *Development* section, and instead specify links to the relevant parts | ||
> of the documentation in the *Documentation* section. | ||
## Contributing and community | ||
|
||
- PR's are welcome! See the [OCF Organisation Repo](https://github.com/openclimatefix) for details on contributing | ||
- Find out more about OCF in the [Meta Repo](https://github.com/openclimatefix/ocf-meta-repo) | ||
- Check out the OCF blog at https://openclimatefix.org/blog for updates | ||
- Follow OCF on [Twitter](https://twitter.com/OpenClimateFix) | ||
|
||
[![OCF Logo](https://cdn.prod.website-files.com/62d92550f6774db58d441cca/6324a2038936ecda71599a8b_OCF_Logo_black_trans.png)](https://openclimatefix.org) | ||
|
||
|
||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
# --- PROJECT CONFIGURATION --- # | ||
|
||
[build-system] | ||
requires = ["setuptools>=67", "wheel", "setuptools-git-versioning>=2.0,<3"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
# Metadata (see https://peps.python.org/pep-0621/) | ||
[project] | ||
name = "ocf-python-project" | ||
dynamic = ["version"] # Set automtically using git: https://setuptools-git-versioning.readthedocs.io/en/stable/ | ||
description = "Consise summary of project" | ||
readme = {file = "README.md", content-type = "text/markdown"} | ||
requires-python = ">=3.12.0" | ||
license = {text = "MIT License"} | ||
authors = [ | ||
{ name = "Open Climate Fix Team", email = "[email protected]"} | ||
] | ||
classifiers = [ | ||
"Programming Language :: Python :: 3", | ||
"License :: OSI Approved :: MIT License", | ||
] | ||
dependencies = [ | ||
"numpy >= 1.23.2", | ||
] | ||
|
||
[project.optional-dependencies] | ||
test = [ | ||
"unittest-xml-reporting == 3.2.0", # Used for XML test results in Actions | ||
] | ||
lint = [ | ||
"mypy >= 1.11.0", | ||
"ruff >= 0.6.4", | ||
] | ||
docs = [ | ||
"pydoctor >= 24.3.0", | ||
] | ||
dev = [ | ||
"ocf-python-project[test,lint,docs]", | ||
] | ||
|
||
[project.scripts] | ||
# Put entrypoints in here | ||
|
||
[project.urls] | ||
repository = "https://github.com/openclimatefix/ocf-python-template" | ||
|
||
[tool.setuptools] | ||
include-package-data = false | ||
|
||
[tool.setuptools-git-versioning] | ||
enabled = true | ||
|
||
# --- LINTING AND TYPING CONFIGURATION --- # | ||
|
||
# MyPy configuration | ||
# * See https://mypy.readthedocs.io/en/stable/index.html | ||
[tool.mypy] | ||
python_version = "3.12" | ||
dmypy = true | ||
strict = true | ||
warn_unreachable = true | ||
warn_return_any = true | ||
disallow_untyped_defs = true | ||
plugins = [ | ||
"numpy.typing.mypy_plugin", | ||
] | ||
|
||
# Ruff configuration | ||
# * See https://beta.ruff.rs/docs/ | ||
[tool.ruff] | ||
line-length = 100 | ||
indent-width = 4 | ||
exclude = ["__init__.py"] | ||
|
||
[tool.ruff.lint] | ||
fixable = ["ALL"] | ||
ignore = ["ANN101", "ANN102"] | ||
select = [ | ||
"F", # pyflakes | ||
"E", # pycodestyle | ||
"W", # whitespace and newlines | ||
"I", # isort | ||
"UP", # modernize | ||
"ANN", # flake8 type annotations | ||
"S", # flake8 bandit | ||
"B", # flake8 bugbear | ||
"C4", # flake8 comprehensions | ||
"COM", # flake8 commas | ||
"T20", # flake8 print | ||
"SIM", # flake8 simplify | ||
"ARG", # flake8 unused arguments | ||
"DTZ", # flake8 datetimes | ||
"Q", # flake8 quotes | ||
"TCH", # flake8 typecheck | ||
"D", # pydocstyle | ||
"RUF", # ruff-specific rules | ||
] | ||
|
||
[tool.ruff.lint.per-file-ignores] | ||
"test*" = ["D", "ANN"] | ||
|
||
[tool.ruff.lint.pydocstyle] | ||
convention = "google" | ||
|
||
[tool.ruff.format] | ||
quote-style = "double" | ||
indent-style = "space" | ||
line-ending = "auto" | ||
docstring-code-format = true | ||
docstring-code-line-length = 100 | ||
|
||
# --- DOCUMENTATION CONFIGURATION --- # | ||
|
||
[tool.pydoctor] | ||
add-package = ["src/nwp_consumer"] | ||
project-base-dir = "src/nwp_consumer" | ||
docformat = "google" | ||
html-output = "docs" | ||
theme = "classic" | ||
privacy = [ | ||
"HIDDEN:**.test_*", | ||
] | ||
|
||
|
Empty file.