Skip to content

Commit 08d2fdb

Browse files
committed
Harden CI quality gates and add OSS governance docs
1 parent 0e262d9 commit 08d2fdb

File tree

6 files changed

+164
-82
lines changed

6 files changed

+164
-82
lines changed

.github/workflows/tests.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,42 @@ permissions:
1111
contents: read
1212

1313
jobs:
14+
quality:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Set Up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: "3.12"
25+
cache: pip
26+
27+
- name: Upgrade pip
28+
run: python -m pip install --upgrade pip
29+
30+
- name: Install
31+
run: python -m pip install -e ".[dev]"
32+
33+
- name: Formatting (Black)
34+
run: black --check .
35+
36+
- name: Lint (Ruff)
37+
run: ruff check .
38+
39+
- name: Type Check (Mypy)
40+
run: mypy
41+
42+
- name: Build Package
43+
run: python -m build
44+
45+
- name: Validate Package Metadata
46+
run: twine check dist/*
47+
1448
pytest:
49+
needs: quality
1550
runs-on: ubuntu-latest
1651
strategy:
1752
fail-fast: false

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.9.10
4+
hooks:
5+
- id: ruff
6+
- id: ruff-format
27
- repo: https://github.com/psf/black
38
rev: 24.3.0
49
hooks:

CODE_OF_CONDUCT.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as contributors and maintainers pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6+
7+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8+
9+
## Our Standards
10+
11+
Examples of behavior that contributes to a positive environment include:
12+
13+
- Demonstrating empathy and kindness toward other people.
14+
- Being respectful of differing opinions, viewpoints, and experiences.
15+
- Giving and gracefully accepting constructive feedback.
16+
- Taking responsibility and apologizing to those affected by our mistakes.
17+
- Focusing on what is best for the overall community.
18+
19+
Examples of unacceptable behavior include:
20+
21+
- The use of sexualized language or imagery, and sexual attention or advances of any kind.
22+
- Trolling, insulting or derogatory comments, and personal or political attacks.
23+
- Public or private harassment.
24+
- Publishing others' private information, such as a physical or email address, without their explicit permission.
25+
- Other conduct which could reasonably be considered inappropriate in a professional setting.
26+
27+
## Enforcement Responsibilities
28+
29+
Project maintainers are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior they deem inappropriate, threatening, offensive, or harmful.
30+
31+
## Scope
32+
33+
This Code of Conduct applies within all project spaces, and also applies when an individual is officially representing the project in public spaces.
34+
35+
## Enforcement
36+
37+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the maintainers at lotitoqf@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
38+
39+
All maintainers are obligated to respect the privacy and security of the reporter of any incident.
40+
41+
## Attribution
42+
43+
This Code of Conduct is adapted from the Contributor Covenant, version 2.1:
44+
https://www.contributor-covenant.org/version/2/1/code_of_conduct.html

CONTRIBUTING.md

Lines changed: 40 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,68 @@
1-
# Contributing to Hypergraphx on GitHub
1+
# Contributing to Hypergraphx
22

3-
Follow this step-by-step guide to contribute to Hypergraphx.
3+
Thanks for contributing to Hypergraphx.
44

5-
## 1. Set Up Your GitHub Account
5+
## Development Setup
66

7-
If you haven't already, create a GitHub account at [GitHub.com](https://github.com/).
8-
9-
## 2. Fork the Repository
10-
11-
- Go to the main page of the Hypergraphx repository.
12-
- In the top-right corner of the page, click on the "Fork" button. This will create a copy of the repository in your
13-
GitHub account.
14-
15-
## 3. Clone Your Forked Repository
16-
17-
- Navigate to your forked repository in your GitHub account.
18-
- Click the "Code" button and copy the URL.
19-
- Open your terminal and navigate to the directory where you want to clone the repository.
20-
- Run the following command:
21-
22-
```bash
23-
git clone [URL]
24-
```
25-
26-
Replace `[URL]` with the URL you copied.
27-
28-
## 4. Set Upstream Remote
29-
30-
To keep your forked repository updated with the changes from the original repository, you need to set an upstream
31-
remote:
32-
33-
- Navigate to the directory of your cloned repository in the terminal.
34-
- Run the following command:
7+
1. Fork the repository and clone your fork.
8+
2. Create and activate a virtual environment.
9+
3. Install the package in editable mode with development dependencies:
3510

3611
```bash
37-
git remote add upstream https://github.com/HGX-Team/hypergraphx.git
38-
```
39-
40-
## 5. Create a New Branch
41-
42-
Before making any changes, it's a good practice to create a new branch:
43-
44-
- Navigate to the directory of your cloned repository in the terminal.
45-
- Run the following command to create and switch to a new branch:
46-
47-
```bash
48-
git checkout -b your-branch-name
12+
python -m pip install --upgrade pip
13+
python -m pip install -e ".[dev,viz,temporal]"
14+
pre-commit install
4915
```
5016

51-
## 6. Make Your Changes
17+
## Local Quality Checks
5218

53-
- Edit the files or add new files as required.
54-
- Once you've made your changes, save them.
55-
- Format Python code with Black before committing:
19+
Run these before opening a pull request:
5620

5721
```bash
58-
black .
22+
black --check .
23+
ruff check .
24+
mypy
25+
pytest
26+
python -m build
27+
twine check dist/*
5928
```
6029

61-
- (Recommended) Install pre-commit so formatting happens automatically:
30+
If you want to run pre-commit hooks across the repository:
6231

6332
```bash
64-
pre-commit install
33+
pre-commit run --all-files
6534
```
6635

67-
## 7. Commit Your Changes
36+
## Documentation
6837

69-
- In the terminal, navigate to the directory of your cloned repository.
70-
- Run the following commands to add and commit your changes:
38+
Build docs locally when your change affects docs, APIs, or tutorials:
7139

7240
```bash
73-
git add .
74-
git commit -m "Your commit message here"
41+
python -m pip install -e ".[docs]"
42+
make -C docs html
7543
```
7644

77-
## 8. Push Your Changes to GitHub
78-
79-
- Push your changes to your forked repository on GitHub:
80-
81-
```bash
82-
git push origin your-branch-name
83-
```
45+
## Branch and Commit Guidelines
8446

85-
## 9. Create a Pull Request (PR)
47+
- Create a focused branch from `main`.
48+
- Keep pull requests small and scoped to one change.
49+
- Write clear commit messages in imperative mood (for example: `Add temporal centrality regression test`).
50+
- Add or update tests for behavioral changes.
51+
- Update docs when user-facing behavior changes.
8652

87-
- Go to your forked repository on GitHub.
88-
- Click on the "Pull requests" tab and then click on the "New pull request" button.
89-
- Ensure the base repository is the original Hypergraphx repository and the base branch is the branch you want to merge
90-
your changes into (usually `main`).
91-
- Ensure the head repository is your forked repository and the compare branch is the branch you made your changes in.
92-
- Click on the "Create pull request" button.
93-
- Fill in the PR title and description, explaining your changes.
94-
- Click on the "Create pull request" button to submit your PR.
53+
## Pull Request Checklist
9554

96-
## 10. Wait for Review
55+
- Tests added/updated for new behavior.
56+
- Local quality checks pass.
57+
- Docs updated (if relevant).
58+
- PR description explains motivation, approach, and impact.
9759

98-
- The maintainers of the Hypergraphx repository will review your PR.
99-
- They might request some changes or improvements. If so, make the required changes in your branch, commit them, and
100-
push them to GitHub. Your PR will be automatically updated.
60+
## Reporting Bugs and Requesting Features
10161

102-
## 11. PR Gets Merged
62+
- Use GitHub Issues for bugs and feature requests.
63+
- Include a minimal reproducible example for bugs.
64+
- For security issues, do not open a public issue. See `SECURITY.md`.
10365

104-
Once your PR is approved, the maintainers will merge it into the main branch of the Hypergraphx repository.
66+
## Code of Conduct
10567

106-
**Note:** Always follow the contribution guidelines provided by the repository maintainers, and always be respectful and
107-
constructive in your interactions.
68+
By participating in this project, you agree to follow the Code of Conduct in `CODE_OF_CONDUCT.md`.

SECURITY.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Security Policy
2+
3+
## Reporting a Vulnerability
4+
5+
If you discover a security vulnerability in Hypergraphx, please report it privately by email to:
6+
7+
- lotitoqf@gmail.com
8+
9+
Please do not open a public GitHub issue for security vulnerabilities.
10+
11+
When reporting, include:
12+
13+
- A clear description of the issue and affected component(s).
14+
- Reproduction steps or a proof of concept.
15+
- Potential impact.
16+
- Any suggested mitigation.
17+
18+
We will acknowledge receipt as soon as possible and work with you to validate and remediate the issue.
19+
20+
## Supported Versions
21+
22+
Security fixes are generally applied to the latest release on PyPI and the `main` branch.

pyproject.toml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ dependencies = [
2525
"scipy",
2626
"networkx",
2727
"pandas",
28+
"tqdm",
2829
]
2930
dynamic = ["version"]
3031

@@ -35,11 +36,12 @@ Homepage = "https://github.com/HGX-Team/hypergraphx"
3536
dev = [
3637
"pytest",
3738
"black>=24.3.0",
39+
"ruff>=0.6.0",
40+
"mypy>=1.10.0",
41+
"build>=1.2.1",
42+
"twine>=5.1.1",
3843
"pre-commit",
3944
]
40-
temporal = [
41-
"tqdm",
42-
]
4345
viz = [
4446
"matplotlib",
4547
# optional interactive hover labels in plot_motifs
@@ -71,3 +73,16 @@ local_scheme = "dirty-tag"
7173
[tool.black]
7274
line-length = 88
7375
target-version = ["py310"]
76+
77+
[tool.ruff]
78+
line-length = 88
79+
target-version = "py310"
80+
81+
[tool.ruff.lint]
82+
select = ["E9", "F63", "F7", "F82"]
83+
84+
[tool.mypy]
85+
python_version = "3.10"
86+
ignore_missing_imports = true
87+
warn_unused_configs = true
88+
files = ["hypergraphx"]

0 commit comments

Comments
 (0)