Skip to content

Commit d13aa5e

Browse files
Merge pull request #24 from DiogoRibeiro7/codex/fix-version-mismatch-between-pyproject-and-github-tag
Add version consistency check
2 parents e4b4291 + 4202bb6 commit d13aa5e

File tree

8 files changed

+253
-5
lines changed

8 files changed

+253
-5
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Check Version Consistency
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
jobs:
8+
version:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 0
14+
- uses: actions/setup-python@v5
15+
with:
16+
python-version: '3.11'
17+
- name: Verify version matches tag
18+
run: python scripts/check_version_match.py

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# CHANGELOG
22

33

4+
## v1.0.0 (2025-06-06)
5+
6+
### Misc
7+
8+
- Align pyproject version with GitHub tag
9+
- Add project Code of Conduct
10+
411
## v0.7.1 (2025-04-13)
512

613
### Bug Fixes

CODE_OF_CONDUCT.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, disability, ethnicity, sex characteristics, gender identity and
8+
expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, caste, color, religion, or sexual
10+
identity and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
- Demonstrating empathy and kindness toward other people
21+
- Being respectful of differing opinions, viewpoints, and experiences
22+
- Giving and gracefully accepting constructive feedback
23+
- Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
- Focusing on what is best not just for us as individuals, but for the overall
26+
community
27+
28+
Examples of unacceptable behavior include:
29+
30+
- The use of sexualized language or imagery, and sexual attention or advances
31+
of any kind
32+
- Trolling, insulting or derogatory comments, and personal or political attacks
33+
- Public or private harassment
34+
- Publishing others' private information, such as a physical or email address,
35+
without their explicit permission
36+
- Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail
56+
address, posting via an official social media account, or acting as an
57+
appointed representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement at
63+
64+
All complaints will be reviewed and investigated promptly and fairly.
65+
66+
All community leaders are obligated to respect the privacy and security of the
67+
reporter of any incident.
68+
69+
## Enforcement Guidelines
70+
71+
Community leaders will follow these Community Impact Guidelines in determining
72+
the consequences for any action they deem in violation of this Code of
73+
Conduct:
74+
75+
### 1. Correction
76+
77+
**Community Impact**: Use of inappropriate language or other behavior deemed
78+
unprofessional or unwelcome in the community.
79+
80+
**Consequence**: A private, written warning from community leaders, providing
81+
clarity around the nature of the violation and an explanation of why the
82+
behavior was inappropriate. A public apology may be requested.
83+
84+
### 2. Warning
85+
86+
**Community Impact**: A violation through a single incident or series of
87+
actions.
88+
89+
**Consequence**: A warning with consequences for continued behavior. No
90+
interaction with the people involved, including unsolicited interaction with
91+
their audience, for a specified period of time. This includes avoiding
92+
interactions in community spaces as well as external channels like social
93+
media. Violating these terms may lead to a temporary or permanent ban.
94+
95+
### 3. Temporary Ban
96+
97+
**Community Impact**: A serious violation of community standards, including
98+
sustained inappropriate behavior.
99+
100+
**Consequence**: A temporary ban from any sort of interaction or public
101+
communication with the community for a specified period of time. No public or
102+
private interaction with the people involved, including unsolicited interaction
103+
with their audience, is allowed during this period. Violating these terms may
104+
lead to a permanent ban.
105+
106+
### 4. Permanent Ban
107+
108+
**Community Impact**: Demonstrating a pattern of violation of community
109+
standards, including sustained inappropriate behavior, harassment of an
110+
individual, or aggression toward or disparagement of classes of individuals.
111+
112+
**Consequence**: A permanent ban from any sort of public interaction within the
113+
community.
114+
115+
## Attribution
116+
117+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118+
version 2.1, available at
119+
https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.
120+
121+
Community Impact Guidelines were inspired by
122+
[Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
123+
124+
For answers to common questions about this code of conduct, see
125+
https://www.contributor-covenant.org/faq. Translations are available at
126+
https://www.contributor-covenant.org/translations.

CONTRIBUTING.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Contributing to gen_surv
2+
3+
Thank you for taking the time to contribute to **gen_surv**! This document provides a brief overview of the recommended workflow for feature requests and pull requests.
4+
5+
## Getting Started
6+
7+
1. Fork the repository and create your feature branch from `main`.
8+
2. Install dependencies with `poetry install`.
9+
3. Ensure the test suite passes with `poetry run pytest`.
10+
4. If you add a feature or fix a bug, update `CHANGELOG.md` accordingly.
11+
12+
## Version Consistency
13+
14+
Releases are tagged in Git. Before creating a release, verify that the version declared in `pyproject.toml` matches the latest Git tag:
15+
16+
```bash
17+
python scripts/check_version_match.py
18+
```
19+
20+
The CI workflow `version-check.yml` runs this same script on pull requests to `main`.
21+
22+
## Submitting Changes
23+
24+
1. Commit your changes with clear messages.
25+
2. Push to your branch and open a pull request.
26+
3. Ensure your PR description explains the motivation and summarizes your changes.
27+
28+
We appreciate your contributions and feedback!

README.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ poetry install
2323
```
2424
## ✨ Features
2525

26-
- Consistent interface across models
27-
- Censoring support (`uniform` or `exponential`)
28-
- Easy integration with `pandas` and `NumPy`
29-
- Suitable for benchmarking survival algorithms and teaching
26+
- Consistent interface across models
27+
- Censoring support (`uniform` or `exponential`)
28+
- Easy integration with `pandas` and `NumPy`
29+
- Suitable for benchmarking survival algorithms and teaching
30+
- Accelerated Failure Time (Log-Normal) model generator
3031

3132
## 🧪 Example
3233

@@ -62,6 +63,7 @@ generate(model="thmm", n=100, qmat=[[0, 0.2, 0], [0.1, 0, 0.1], [0, 0.3, 0]],
6263
| `gen_cmm()` | Continuous-Time Multi-State Markov Model |
6364
| `gen_tdcm()` | Time-Dependent Covariate Model |
6465
| `gen_thmm()` | Time-Homogeneous Markov Model |
66+
| `gen_aft_log_normal()` | Accelerated Failure Time Log-Normal |
6567

6668

6769
```text
@@ -95,3 +97,21 @@ genSurvPy/
9597
## 🧠 License
9698

9799
MIT License. See [LICENSE](LICENSE) for details.
100+
101+
102+
## 🔖 Release Process
103+
104+
This project uses Git tags to manage releases. A GitHub Actions workflow
105+
(`version-check.yml`) verifies that the version declared in `pyproject.toml`
106+
matches the latest Git tag. If they diverge, the workflow fails and prompts a
107+
correction before merging. Run `python scripts/check_version_match.py` locally
108+
before creating a tag to catch issues early.
109+
110+
## 🌟 Code of Conduct
111+
112+
Please read our [Code of Conduct](CODE_OF_CONDUCT.md) to learn about the
113+
expectations for participants in this project.
114+
115+
## 🤝 Contributing
116+
117+
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on setting up your environment, running tests, and submitting pull requests.

docs/source/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,4 @@ generate(model="thmm", n=100, qmat=[[0, 0.2, 0], [0.1, 0, 0.1], [0, 0.3, 0]],
5353

5454
- [Source Code](https://github.com/DiogoRibeiro7/genSurvPy)
5555
- [License](https://github.com/DiogoRibeiro7/genSurvPy/blob/main/LICENSE)
56+
- [Code of Conduct](https://github.com/DiogoRibeiro7/genSurvPy/blob/main/CODE_OF_CONDUCT.md)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "gen_surv"
3-
version = "0.7.4"
3+
version = "1.0.0"
44
description = "A Python package for simulating survival data, inspired by the R package genSurv"
55
authors = ["Diogo Ribeiro <[email protected]>"]
66
license = "MIT"

scripts/check_version_match.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/usr/bin/env python3
2+
"""Check that pyproject version matches the latest git tag."""
3+
from pathlib import Path
4+
import subprocess
5+
import sys
6+
import tomllib
7+
8+
ROOT = Path(__file__).resolve().parents[1]
9+
10+
11+
def pyproject_version() -> str:
12+
pyproject_path = ROOT / "pyproject.toml"
13+
with pyproject_path.open("rb") as f:
14+
data = tomllib.load(f)
15+
return data["tool"]["poetry"]["version"]
16+
17+
18+
def latest_tag() -> str | None:
19+
try:
20+
tag = subprocess.check_output(
21+
["git", "describe", "--tags", "--abbrev=0"], cwd=ROOT, text=True
22+
).strip()
23+
return tag.lstrip("v")
24+
except subprocess.CalledProcessError:
25+
return None
26+
27+
28+
def main() -> int:
29+
tag = latest_tag()
30+
version = pyproject_version()
31+
32+
if not tag:
33+
print("No git tag found", file=sys.stderr)
34+
return 1
35+
36+
if version != tag:
37+
print(
38+
f"Version mismatch: pyproject.toml has {version} but latest tag is {tag}",
39+
file=sys.stderr,
40+
)
41+
return 1
42+
43+
print(f"Version matches latest tag: {version}")
44+
return 0
45+
46+
47+
if __name__ == "__main__":
48+
sys.exit(main())

0 commit comments

Comments
 (0)