diff --git a/.github/SUPPORT.md b/.github/SUPPORT.md index 4148d18..4195ae3 100644 --- a/.github/SUPPORT.md +++ b/.github/SUPPORT.md @@ -1,15 +1,16 @@ # Support ## Documentation +- [ckanext-attribution documentation](https://ckanext-attribution.readthedocs.io) - [Our API documentation](https://naturalhistorymuseum.github.io/dataportal-docs) - [Official CKAN documentation](http://docs.ckan.org/en/latest) ## Issues +- [Issues for ckanext-attribution](https://github.com/NaturalHistoryMuseum/ckanext-attribution/issues) - [The NHM on Github](https://github.com/NaturalHistoryMuseum) - [General issue tracker](https://github.com/NaturalHistoryMuseum/data-portal-issues/issues) -- [Our CKAN extensions](https://github.com/search?q=topic%3Ackan+org%3ANaturalHistoryMuseum&type=repositories) (for more specific issues) +- [Our CKAN extensions](https://github.com/search?q=topic:ckan+org:NaturalHistoryMuseum&type=repositories) (for more specific issues) ## Contact Us - [Gitter](https://gitter.im/nhm-data-portal/lobby) - [Email _data@nhm.ac.uk_](mailto:data@nhm.ac.uk) -- [Twitter](https://twitter.com/nhm_data) diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 0000000..f341257 --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,20 @@ +cff-version: 1.2.0 +title: CKAN Attribution extension +message: >- + If you use this software, please cite it using the + metadata from this file. +type: software +authors: + - name: Natural History Museum + city: London + country: GB + alias: NHM + email: data@nhm.ac.uk +repository-code: 'https://github.com/NaturalHistoryMuseum/ckanext-attribution' +abstract: A CKAN extension that adds support for complex attribution. +keywords: + - ckan + - ckanext + - attribution +license: GPL-3.0-or-later +version: 1.2.9 diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..2bdd451 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,132 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, caste, color, religion, or sexual +identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the overall + community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or advances of + any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email address, + without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders 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, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +[data@nhm.ac.uk](mailto:data@nhm.ac.uk). +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.1, available at +[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder][Mozilla CoC]. + +For answers to common questions about this code of conduct, see the FAQ at +[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at +[https://www.contributor-covenant.org/translations][translations]. + +[homepage]: https://www.contributor-covenant.org +[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html +[Mozilla CoC]: https://github.com/mozilla/diversity +[FAQ]: https://www.contributor-covenant.org/faq +[translations]: https://www.contributor-covenant.org/translations diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..3372db8 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,195 @@ +# Contributing + +Hi! Thanks for considering contributing to ckanext-attribution. :sauropod: + +We welcome suggestions, bug reports, and code or documentation changes. This document will give you a quick overview of how to make one of these contributions. + +If you're completely new to Git, GitHub, or contributing to open source, you might find it helpful to read some other material first, like [W3's Git Tutorial](https://www.w3schools.com/git), [GitHub Quickstart](https://docs.github.com/en/get-started/quickstart), or [How to Contribute to Open Source](https://opensource.guide/how-to-contribute). This document does assume some familiarity with these concepts for brevity, but we're happy to help anyone who's new or needs further clarification. + + +## Quick links + +- [Code of Conduct](./CODE_OF_CONDUCT.md) +- [Support](./.github/SUPPORT.md) +- [Issues](https://github.com/NaturalHistoryMuseum/ckanext-attribution/issues) + + +## Table of contents + +1. [Introduction](#introduction) +2. [Questions](#questions) +3. [Suggestions and bug reports](#suggestions-and-bug-reports) +4. [Commits and pull requests](#commits-and-pull-requests) + 1. [Commits](#commits) + 2. [Code changes and style guide](#code-changes-and-style-guide) + 3. [Documentation changes](#documentation-changes) + + +## Introduction + +### Code of Conduct + +We have a [Code of Conduct](./CODE_OF_CONDUCT.md), which all contributors and community participants are expected to adhere to. + +### About this repository + +This repository contains the code for an extension/plugin for a larger system called [CKAN](https://github.com/ckan/ckan); it is not a standalone project. + +### Official maintainers + +This extension and [several others](https://github.com/search?q=topic:ckan+org:NaturalHistoryMuseum&type=repositories) are maintained by the Data Portal team at the Natural History Museum, London. This is a very small team, so contributions are very welcome! + +The current core team consists of: +- Josh ([@jrdh](https://github.com/jrdh)) - Technical Lead +- Ginger ([@alycejenni](https://github.com/alycejenni)) - Software Engineer + + +## Questions + +Before asking your question, have you checked: +- [The README](./README.md) +- [The documentation](https://ckanext-attribution.readthedocs.io) +- [The existing issues](https://github.com/NaturalHistoryMuseum/ckanext-attribution/issues?q=is:issue) +- [CKAN's documentation](https://docs.ckan.org/en/latest) + +If none of those answer your question, try contacting us before raising it as an issue on GitHub. You can find places to contact us in [SUPPORT.md](./.github/SUPPORT.md). + + +## Suggestions and bug reports + +Suggestions, feature requests, and bug reports are all submitted as [GitHub issues](https://docs.github.com/en/issues). + +See GitHub's documentation for the basics on [how to create an issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/creating-an-issue). Before you create an issue, please check the [existing issues](https://github.com/NaturalHistoryMuseum/ckanext-attribution/issues?q=is:issue) to see if it's already been raised. + +### Good bug reports + +We've provided a template for bug reports. It's not 100% necessary to follow this template exactly, but it does demonstrate the kind of information that will be useful to anyone trying to fix the problem. The most key information is anything that will allow someone to try and recreate your issue on their own system. + +### Good feature suggestions + +We've also provided a template for feature suggestions. This is fairly sparse, and again isn't completely necessary to follow exactly. Please just try to provide as much information about your idea as possible. + + +## Commits and pull requests + +If you want to contribute a change to any of the files in the repository, whether it's code, documentation, or repository meta files like `.gitignore`, you'll need to make commits and pull requests. + +The process is generally as follows: + +1. [Fork the repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo). +2. Create a new branch to work on by branching off `dev`. We name ours in the format `user/feature-name`, e.g. `ginger/deprecate-ckanpackager`. Try to only work on one topic (e.g. implementing one feature, or fixing a couple of related bugs) per branch. +3. Make your changes, and commit often; each commit should only contain one change. See below for specifics on how to word your commits. +4. Push your changes back to your fork. +5. [Open a pull request](https://docs.github.com/en/get-started/quickstart/contributing-to-projects#making-a-pull-request) in this repository, with the base branch set to **dev** and the compare branch set to your new branch. Provide a summary of your changes in the description. +6. If the automatic tests fail (these may take a while), please go back to your code and try to make them pass. You may have to update the tests themselves. You don't have to close the pull request while you're doing this; it'll update as you add further commits. +7. Wait for feedback from one of the core maintainers. If it's been a week or so and we haven't responded, we may not have seen it. You can find other places to contact us in [SUPPORT.md](./.github/SUPPORT.md). + +### Commits + +Our commits follow the [Conventional Commits](https://www.conventionalcommits.org) style for consistency and to make it easy to generate changelogs. Please follow this style when you make your commits. We have our own slightly tweaked version of the default style called [`cz-nhm`](https://github.com/NaturalHistoryMuseum/cz-nhm). It's very similar with just a few additions. + +Commits are formatted as follows - not every line is required: +``` +(): + +BREAKING CHANGE: + + + +Closes: +``` + +e.g. +``` +fix(actions): write a short lowercase description of what you did + +Give a bit more context or detail about the changes. + +Closes: #1, #3 +``` + +Or, a very basic but still completely valid commit: +``` +feat: add an exciting new feature +``` + +The tools described below are very useful for generating these messages and sticking to the structure, so we _highly_ recommend using them. + +#### Tools + +We use a few tools to help us with code standardisation and keeping to the conventional commits style. When making a commit, the two key tools to know about are: + +1. [commitizen](https://commitizen-tools.github.io/commitizen) +2. [pre-commit](https://pre-commit.com) + +Both tools are Python-based and can be installed with `pip`. You'll probably want to use something like [pipx](https://pypa.github.io/pipx) or [venv](https://docs.python.org/3/library/venv.html) instead of installing them globally, but for simplicity, the instructions below are just for pip. + +##### commitizen + +commitizen is a CLI tool for creating commits in the conventional commits style. + +To install with `pip`: +```shell +# NB: cz-nhm must be installed in the same environment as commitizen +pip install commitizen cz-nhm +``` + +Then to make a commit: +```shell +cz c +# and follow the prompts +``` + +##### pre-commit + +pre-commit is a tool that runs a variety of checks and modifications before a commit is made. You can check the [.pre-commit-config.yaml](./.pre-commit-config.yaml) file to see eaxtly what it's currently configured to do for this repository, but of particular note: + +- reformats Python code with [Black](https://github.com/psf/black) +- reformats JavaScript and stylesheets with [Prettier](https://prettier.io) +- reformats docstrings with [docformatter](https://github.com/PyCQA/docformatter) +- checks your commit message is correcly formatted + +To install with `pip`: +```shell +pip install pre-commit +``` + +When installed, the checks will be run on all staged files when you try to make a commit. If any of them fail or make any modifications, the commit will be abandoned and you will have to write the message again. Because of this, it's probably best to run the checks on the staged files manually before you even attempt a commit: +```shell +pre-commit run +``` + +Don't forget to stage any modifications that it makes! Once it runs without failing, then you can make your commit. + +Something to remember is that empty docstrings will cause conflicts between Black and docformatter and the checks will fail repeatedly - so don't leave your docstrings empty! + +### Code changes and style guide + +We generally use external style guides and tools to help us maintain standardised code. Black and Prettier will be run with pre-commit. + +#### Python + +We follow the [Black style](https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html), with the notable exception that we use single quotes. + +We also _mostly_ use [CKAN's style](http://docs.ckan.org/en/latest/contributing/python.html), with the following exceptions: +- prefer `f''` strings over `.format()` +- don't use `u''` strings +- use double quotes for docstrings, not single quotes + +#### JavaScript and stylesheets (CSS, LESS, etc) + +We use [Prettier](https://prettier.io) to format these files. + +#### Accessibility + +Particularly if you're making frontend changes such as modifying HTML, please make sure your changes meet level AA of the [Web Content Accessibility Guidelines (WCAG)](https://www.w3.org/WAI/standards-guidelines/wcag). + +### Documentation changes + +Our documentation is generated using [MkDocs](https://www.mkdocs.org), then hosted on [Read the Docs](https://about.readthedocs.com). You can view the current documentation for this repository at [ckanext-attribution.readthedocs.io](https://ckanext-attribution.readthedocs.io). + +Most of the documentation for this repository is generated automatically by pulling _docstrings_ from the Python code. This documentation is placed in the "API" subfolder in the rendered output. + +There are also a few pages written as standalone `.md` files, e.g. [configuration.md](./docs/configuration.md), or as a subfolder, e.g. [usage](./docs/usage/index.md). You can also edit these or create new pages. In most of our extensions these are still very sparse or automatically generated from content in the README, but the extension `ckanext-versioned-datastore` has a [good example of more complex documentation](https://github.com/NaturalHistoryMuseum/ckanext-versioned-datastore/tree/main/docs/usage/downloads). + +Once you've made your changes, follow the commit and pull request guidelines as you would for a code change. You will almost certainly be using the `docs:` commit prefix.