Skip to content

Latest commit

 

History

History
195 lines (133 loc) · 5.87 KB

README.md

File metadata and controls

195 lines (133 loc) · 5.87 KB

quantifying

Quantifying the Commons

Overview

This project seeks to quantify the size and diversity of the commons--the collection of works that are openly licensed or in the public domain.

Code of conduct

CODE_OF_CONDUCT.md:

The Creative Commons team is committed to fostering a welcoming community. This project and all other Creative Commons open source projects are governed by our Code of Conduct. Please report unacceptable behavior to conduct@creativecommons.org per our reporting guidelines.

Contributing

See CONTRIBUTING.md.

Development

Prerequisites

This repository uses pipenv to manage the required Python modules:

  1. Install pipenv:
  2. Create the Python virtual environment and install prerequisites using pipenv:
    pipenv sync --dev

Running scripts that require client credentials

To successfully run scripts that require client credentials, you will need to follow these steps:

  1. Copy the contents of the env.example file in the script's directory to .env:
    cp env.example .env
  2. Uncomment the variables in the .env file and assign values as needed. See sources.md on how to get credentials:
    GOOGLE_API_KEYS=your_api_key
    PSE_KEY=your_pse_key
    
  3. Save the changes to the .env file.
  4. You should now be able to run scripts that require client credentials without any issues.

Static analysis

  1. Install pre-commit

    • Using pip:
      pip install pre-commit
    • Using homebrew:
      brew install pre-commit
  2. Install the git hook scripts

    pre-commit install

It will run on every commit automatically.

pre-commit Configuration

A .pre-commit-config.yaml file has been added to the repository. This configuration file defines hooks to maintain code quality and formatting standards. These hooks are automatically executed before each commit to ensure consistency across the codebase. They include:

  • Black: A code formatter for Python.
  • Flake8: A tool that checks Python code for style and quality.
  • isort: A utility for sorting and formatting Python imports.

The configuration ensures that the codebase adheres to consistent formatting and style guidelines, enhancing readability and maintainability.

Using dev/tools.sh helper script

The dev/tools.sh helper script runs the static analysis tools (black, flake8, and isort):

./dev/tools.sh

It can also accept command-line arguments to specify specific files or directories to check:

./dev/tools.sh PATH/TO/MY/FILE.PY

Resources

  • Python Guidelines — Creative Commons Open Source
  • Black: the uncompromising Python code formatter
  • flake8: a python tool that glues together pep8, pyflakes, mccabe, and third-party plugins to check the style and quality of some python code.
  • isort: A Python utility / library to sort imports
    • (It doesn't import any libraries, it only sorts and formats them.)
  • ppypa/pipenv: Python Development Workflow for Humans.
  • pre-commit: A framework for managing and maintaining multi-language pre-commit hooks.

GitHub Actions

The .github/workflows/python_static_analysis.yml GitHub Actions workflow performs static analysis (black, flake8, and isort) on committed changes. The workflow is triggered automatically when you push changes to the main branch or open a pull request.

Data sources

Kindly visit the sources.md file for it.

History

For information on past efforts, see history.md.

Copying & license

Code

LICENSE: the code within this repository is licensed under the Expat/MIT license.

Data

CC0 1.0 Universal (CC0 1.0) Public Domain Dedication button

The data within this repository is dedicated to the public domain under the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication.

Documentation

CC BY 4.0 license button

The documentation within the project is licensed under a Creative Commons Attribution 4.0 International License.