Giter VIP home page Giter VIP logo

enhancement-proposals's Introduction

Brightway Enhancement Proposals

A Brightway Enhancement Proposal (BEP) is a formal decision-making system adapted from other enhancement proposals used widely in software development. A BEP allows the community and steering community to examine and debate alternatives, and reach consensus on important and controversial decisions.

BEP status table

Number Status Title
1 Proposed BEP template
2 Draft Merge repositories
3 Draft Brightway Documentation
4 Draft Changelog Files for Releases

License

This document is released into the public domain

enhancement-proposals's People

Contributors

cmutel avatar michaelweinold avatar tngtudor avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

enhancement-proposals's Issues

B Brightway Common Database API

One big barrier to adapting Brightway to other databases is its tight coupling between projects, the default database backend, and the IO library. To decouple these, we first need to define data formats, interfaces, and endpoints.

The interface is easy to define - we will use Python, with normal data structures, either built in or with attrs or similar.

The data format will be eILCD. eILCD is an XML format for life cycle inventory and impact category data. We are choosing eILCD instead of developing something on our own, or using a different existing format, because:

  • eILCD is the only format really battle tested with multiple implementations and use in a variety of contexts
  • eILCD is the transfer format for GLAD and PEF
  • eILCD is extensively documented, both with XSD files and guidance

Don't get the wrong impression, eILCD is everything you hate about XML, but arguably even worse than usual as it was mostly designed by scientists instead of programmers. But it is still better than the alternatives.

The hardest part are the API endpoints. These are Python methods or functions which programs can use to interface with any database backend that follow the Brightway common database standard; database implementors can choose to only support part of this standard, but we should define this standard in a parsimonious fashion, such that open source implementations do choose to implement the whole standard.

Based on the current default database backend, the following CRUD endpoints should be considered:

  • Node (Can be called activity or process)
  • Edge (Can be called exchange)
  • Impact category
  • Characterization factor

It might also be necessary to have a common endpoint for bw_projects for when a project is activated.

After finishing this section, programmers will be able to choose whatever database and schema they want, and will know exactly which functions are expected by bw_io such that the IO classes can write or update data. There will also be a reference implementation, compatible with existing bw2data code and semantics, which will demonstrate how users can import data from bw_io, and query data from an ORM.

Specific tasks:

Nice-to-have:

H Governance

An important part of Brightway maturing is a formal decision making process for making changes to and prioritizing development in Brightway. To that end, we will:

Départ de Sentier (DdS) will manage the Steering Committee and Users Group. Managing the Brightway project, and organizing the Brightcon conference, are two core activities of DdS.

G Infrastructure: Homogeneous build, test and deploy metrics

Motivation

Every time we need to make a change, e.g. add a tool, update Github Workflows system images, etc. we need to manually change every library. Manual changes can be inconsistent and are a pain, leading to procrastination. Larger changes are basically impossible to imagine.

Desired template attributes

We need a standard template and guide for libraries which has the following qualities:

  • Uses Github workflows to test all three OSes with both the latest and next-to-last system images and Py 3.7-3.10.
  • Test installation using both conda and pip
  • Uses setup.cfg instead of setup.py. Include sections for dev (has e.g. pytest, pip-tools), stable (all requirements pinned), and normal installation (requirements have ranges of >=)
  • Reports 1-click code coverage results
  • Provides badges for CI results, code coverage (e.g. shields.io)
  • Has a solution for hosted HTML documentation including napoleon
  • Uses tooling to help improve code quality
  • Single-source the library version (why these solutions so hacky!?)
  • Automated builds and uploads to anaconda on tagged commits

Adapting the hypermodern template

A lot of these attributes are found in the hypermodern template, though @cmutel would argue against the following:

  • Use of poetry: Better to stick with standard tools instead of more opinionated ones in components designed to be integrated into applications.
  • Use of tox or nox: Not necessary, we do testing in CI, and setting up a venv for each test run is quite heavy for our components.
  • Automated build notes. Could be considered in the future, we don't yet have the discipline to use this consistently, and it makes life harder for new contributors.

We should use the following (copied from their docs):

pre-commit hooks

Note that we assume the following are done as pre-commit hooks by the template (instead of by Github Workflows):

  • Import sorting with isort
  • Code formatting with Black and Prettier
  • Black formatting in documentation snippets
  • Static type-checking with mypy
  • Runtime type-checking with Typeguard

cookiecutter instead of pyscaffold

pyscaffold ticks a lot of boxes, but has some controversial choices which are hard to remove, including the use of setuptools-scm and tox, has custom commands instead of pip and friends (not great for new users), and would need to adapted to include the Azure Workflows config in any case. @cmutel thinks that a custom cookiecutter template is probably the best choice. Ideally, someone would already have such a template, as the cookiecutter ecosystem is large, but no suitable template was found browsing cookiecutter-templates.

pip, not poetry or pipenv

Let's skip the drama, pip with pip-tools and pipreqs works just fine.

Useful links

Tasks

  • Make cookiecutter template that satisfies the required attributes
  • Document use of this template, both for new library creation and for updating libraries
  • Create example project from the example template
  • Have regular checks to ensure that all Brightway libraries work correctly as dependent libraries evolve

A Separate bw_calc

E eILCD as standard interface between `bw_data` and `bw_io`

The current interface between bw2data and bw2io is inadequate - it does not include a lot of important metadata, it grew organically without clear design or vision, it doesn't not distinguish between inventory and impact assessment, and it barely specified and therefore impossible to implement by outside collaborators.

Specific tasks:

Nice-to-have:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.