Contribute to Dfetch

Before implementing a feature, please ask one of the maintainers to avoid any unnecessary or double work. Let other people know through the relevant GitHub issue that you are planning on implementing it. Also for new features, first create an issue that can be discussed.

After implementing (with tests and documentation) create a PR on Github and let your changes be reviewed.

Virtual Environment

Create a virtual environment by double-clicking script/create_venv.py or by running the following command. This will install all development, test and docs dependencies from pyproject.toml, install DFetch as editable package and install all runtime dependencies from pyproject.toml.

script/create_venv.py

Important

dfetch is primarily developed with python 3.13

Running in Github Codespaces

Github codespaces make it possible to edit dfetch directly in the browser in a VSCode instance. All dependencies are pre-installed and makes it easy to get started.

Open in GitHub Codespaces

Tip

You can preview the documentation locally by running the Serve Docs task. Codespaces will automatically suggest to open the forwarded port to view the changes in your browser.

Running in VSCode

To debug or run directly from VSCode create the Virtual Environment. Select the python from the virtual environment. And open the dfetch.code-workspace.

Quality

To avoid any discussion about formatting black is used as code formatter. Next to that isort is used for sorting the imports. And doc8 is used as rst linter.

import-linter is used to guard the Architecture by verifying that imports between modules respect the C4 layer boundaries. Run it with:

lint-imports

Run script/check_quality.bat (or GitHub will run it for you). Alternatively when using VSCode run the Check Quality task from the command palette.

Testing

Unit tests

pytest is used as testing framework. All code contributed should be accompanied with unit tests. Tests can be found in the tests folder.

To see coverage, in the virtual environment run pytest with coverage

pytest --cov=dfetch tests

From VSCode all tests can be run from the Test view.

Feature tests

Feature tests are used for higher-level integration testing of functionality. For this behave is used as testing framework. Feature files in the features folder contain plain-language examples that demonstrate dfetch’s behaviour. The sentences in the feature files map to step definitions in the features/steps folder.

Tests can be run directly from the command-line:

behave features

Feature files are tagged with the command they exercise (e.g. @update, @check). You can run just the examples for a specific command using its tag:

behave features --tags=update

Alternatively in VSCode run the Run all feature tests task from the command palette.

To debug these tests, mark the Feature: or Scenario: to debug with the @wip tag and run the Feature tests (wip) debug configuration in VSCode.

Creating documentation

Run script/create_docs.bat and open index.html in doc/_build/html to read it. See This example for documenting the code. Alternatively in VSCode run the Create Docs task from the command palette.

Design Guide

The docs and landing page share a single design system. Follow these tokens whenever you add new pages, diagrams, or HTML blocks to keep the visual language consistent.

Colour palette

--primary
#c2620a
Amber Orange
CTAs, active borders, diagram start nodes, section pips
--primary-dark
#a0510a
Amber Dark
Hover states, gradient end, button borders
--accent
#4e7fa0
Slate Blue
Decision diamonds, links, secondary badges, note borders
--accent-dark
#3a6682
Slate Dark
Hover states on accent elements, diagram labels
--text
#1c1917
Near Black
Body copy, headings, diagram text
--text-muted
#78716c
Warm Gray
Captions, sub-labels, placeholder text, diagram arrow labels
--bg-tint
#fef8f0
Warm Cream
Alternate section bands, card backgrounds, table headers
--bg-mint
#eff6fa
Cool Mint
Tip/note backgrounds, accent section bands

Typography

Inter body · UI · headings
300 Vendor dependencies without the pain
400 Vendor dependencies without the pain
500 Vendor dependencies without the pain
600 Vendor dependencies without the pain
700 Vendor dependencies without the pain
800 Vendor dependencies without the pain
JetBrains Mono code · tokens · CLI
400 dfetch update --force
500 dfetch update --force

Use for: inline code, CLI examples, hex values, token names, cheatsheet syntax, diagram labels where monospace is needed.

CSS tokens reference

Use CSS custom properties rather than raw hex values so changes propagate everywhere automatically.

Token

Value

Use for

--primary

#c2620a

Primary action colour

--primary-dark

#a0510a

Hover / pressed state

--accent

#4e7fa0

Secondary / info colour

--accent-dark

#3a6682

Hover on accent elements

--text

#1c1917

Body text, headings

--text-2

#3d3530

Secondary text

--text-muted

#78716c

Captions, labels, placeholders

--bg-tint

#fef8f0

Warm section backgrounds

--bg-mint

#eff6fa

Cool section backgrounds

--border

#e7e0d8

Card borders, dividers

--r / --r-sm / --r-lg

12px / 8px / 20px

Border radius (card / badge / hero)

--shad-sm / --shad-md / --shad-lg

Box shadow tiers

PlantUML diagrams

All flow and mindmap diagrams must use the shared skinparam block from doc/static/uml/check.puml as a template. Key values:

Element

Value

Notes

Activity background

#ffffff

White nodes on transparent canvas

Activity border

#c2620a (--primary)

1.5 pt thickness

Diamond background

#eff6fa (--bg-mint)

Decision nodes use the cool tint

Diamond border

#4e7fa0 (--accent)

Consistent with accent colour

Arrow colour

#78716c (--text-muted)

Keeps arrows from competing with nodes

Start node

#c2620a (--primary)

Filled amber disc

Partition background

#fef8f0 (--bg-tint)

Warm cream section bands

Default font

Arial, 12 pt, #1c1917

Matches --text

Diataxis section colours

Each of the four Diataxis sections has its own accent colour. These are applied automatically by doc/static/js/diataxis.js: it adds a CSS class to <body> and to the sidebar caption elements so both the top page strip and the sidebar navigation header reflect the section.

--dxt-tutorial
#c2620a
Tutorials
Same as --primary; warm amber for learning-oriented pages
--dxt-howto
#4e7fa0
How-to Guides
Same as --accent; slate blue for task-oriented pages
--dxt-reference
#4a7a62
Reference
Sage green; neutral, precise tone for information pages
--dxt-explanation
#7a5a9a
Explanation
Soft purple; contemplative tone for conceptual pages

To add a new page to a section, add its filename (without .rst) to the PAGE_SECTIONS map in doc/static/js/diataxis.js.

Releasing

  • Bump version number in dfetch/__init__.py.

  • Run ./script/release.py.

  • Double check any feature scenarios for a version number.

  • Run all unit / feature tests.

  • Re-generate asciicasts using VSCode task (linux/mac).

  • Commit all release changes.

  • Create pull request & merge to main.

  • Create annotated tag on main and push it:

git checkout main
git pull
git tag -a '0.13.0' -m "Release version 0.13.0"
git push --tags
  • The ci.yml job will automatically create a draft release in GitHub Releases with all artifacts.

  • Once the release is published, a new package is automatically pushed to PyPi.

  • After release, add new header to CHANGELOG.rst:

Release 0.14.0 (unreleased)
====================================