Skip to content

Commit 4fdd5cf

Browse files
authored
Merge pull request #3 from github/open-source-prep
Prep to Open Source
2 parents 268e213 + 6209b3a commit 4fdd5cf

34 files changed

+1153
-437
lines changed

.github/workflows/build-and-upload.yaml

-11
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,3 @@ jobs:
3838
- name: Build Package
3939
uses: ./ # Action defined in action.yaml in the root
4040
if: steps.changed-files.outputs.any_changed == 'true'
41-
42-
- name: Setup Octofactory config
43-
uses: jfrog/setup-jfrog-cli@7c95feb32008765e1b4e626b078dfd897c4340ad
44-
if: steps.changed-files.outputs.any_changed == 'true'
45-
env:
46-
JF_ENV_1: ${{ secrets.OCTOFACTORY_SERVER_CONFIG }}
47-
48-
- name: Upload to Octofactory
49-
if: steps.changed-files.outputs.any_changed == 'true'
50-
run: |
51-
jfrog rt u dist/ logger-decorator-pypi

.github/workflows/coverage.yaml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
name: Post Coverage Commit
3+
4+
on:
5+
workflow_run:
6+
workflows: ["Pytest"]
7+
types:
8+
- completed
9+
10+
jobs:
11+
coverage:
12+
runs-on: ubuntu-latest
13+
if: github.event.workflow_run.event == "pull_request" && github.event.workflow_run.conclusion == "success"
14+
permissions:
15+
pull-requests: write
16+
contents: write
17+
actions: read
18+
steps:
19+
- name: Python Coverage Comment
20+
uses: py-cov-action/python-coverage-comment-action@b2eb38dd175bf053189b35f738f9207278b00925
21+
with:
22+
GITHUB_TOKEN: ${{ github.token }}
23+
GITHUB_PR_RUN_ID: ${{ github.event.workflow_run.id }}

.github/workflows/matchers/ruff.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "ruff",
5+
"pattern": [
6+
{
7+
"regexp": "^(Would reformat): (.+)$",
8+
"message": 1,
9+
"file": 2
10+
}
11+
]
12+
}
13+
]
14+
}

.github/workflows/mutation.yaml

-38
This file was deleted.

.github/workflows/package-quality-control.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ on:
1111
jobs:
1212
# Checks that version number has been updated
1313
package-quality-control:
14+
permissions:
15+
contents: read
1416
runs-on: ubuntu-latest
1517
steps:
1618
- name: Checkout Current PR Branch
@@ -19,7 +21,7 @@ jobs:
1921
uses: actions/setup-python@v5
2022
- name: Check for Changed Files
2123
id: changed-files
22-
uses: tj-actions/changed-files@v44
24+
uses: tj-actions/changed-files@635f118699dd888d737c15018cd30aff2e0274f8
2325
with:
2426
files: |
2527
pyproject.toml

.github/workflows/pyright.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55

66
jobs:
77
pyright:
8+
permissions:
9+
contents: read
810

911
runs-on: ubuntu-latest
1012
steps:
@@ -19,4 +21,4 @@ jobs:
1921
hatch env create dev
2022
- run: echo "$(hatch env find dev)/bin" >> $GITHUB_PATH
2123
- name: Run pyright
22-
uses: jakebailey/pyright-action@v2.3.1
24+
uses: jakebailey/pyright-action@b5d50e5cde6547546a5c4ac92e416a8c2c1a1dfe

.github/workflows/pytest.yaml

+14-9
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,14 @@ on:
88

99
jobs:
1010
pytest:
11+
permissions:
12+
contents: read
1113

1214
runs-on: ${{ matrix.os }}
1315
strategy:
1416
matrix:
1517
os: [ubuntu-latest, macos-latest, windows-latest]
16-
python-version: ["3.9", "3.10", "3.11", "pypy3.9", "pypy3.10"]
17-
exclude:
18-
- os: macos-latest
19-
python-version: "3.9"
20-
- os: windows-latest
21-
python-version: "3.9"
18+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
2219

2320
steps:
2421
- uses: actions/checkout@v4
@@ -35,7 +32,6 @@ jobs:
3532
# Need relative files for the action to report, but it messes up mutmut
3633
echo "[run]" >> .coveragerc
3734
echo "relative_files = true" >> .coveragerc
38-
cat .coveragerc
3935
4036
hatch run dev:pytest
4137
env:
@@ -45,27 +41,36 @@ jobs:
4541
with:
4642
name: coverage-${{ matrix.os }}-${{ matrix.python-version }}
4743
path: .coverage.${{ matrix.os }}.${{ matrix.python-version }}
44+
include-hidden-files: true
4845

4946
coverage:
47+
name: Coverage
5048
runs-on: ubuntu-latest
5149
needs: pytest
5250
permissions:
5351
pull-requests: write
5452
contents: write
5553
steps:
5654
- uses: actions/checkout@v4
57-
5855
- uses: actions/download-artifact@v4
5956
id: download
6057
with:
6158
pattern: coverage-*
6259
merge-multiple: true
6360
- name: Re-add relative so the action is happy
6461
run: |
62+
# Need relative files for the action to report, but it messes up mutmut
6563
echo "[run]" >> .coveragerc
6664
echo "relative_files = true" >> .coveragerc
6765
- name: Python Coverage Comment
68-
uses: py-cov-action/python-coverage-comment-action@v3.24
66+
uses: py-cov-action/python-coverage-comment-action@b2eb38dd175bf053189b35f738f9207278b00925
6967
with:
7068
GITHUB_TOKEN: ${{ github.token }}
7169
MERGE_COVERAGE_FILES: true
70+
- name: Store Pull Request comment to be posted
71+
uses: actions/upload-artifact@v4
72+
if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true'
73+
with:
74+
name: python-coverage-comment-action
75+
path: python-coverage-comment-action.txt
76+
include-hidden-files: true

.github/workflows/ruff.yaml

+9-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55

66
jobs:
77
ruff:
8+
permissions:
9+
contents: read
810

911
runs-on: ubuntu-latest
1012
steps:
@@ -17,6 +19,11 @@ jobs:
1719
run: |
1820
python -m pip install hatch
1921
hatch env create dev
20-
- name: Lint with Ruff
22+
- name: Lint with Ruff (check)
2123
run: |
22-
hatch run dev:ruff --output-format=github .
24+
hatch run dev:ruff check --output-format=github .
25+
- name: Register problem matcher for ruff format
26+
run: echo "::add-matcher::.github/workflows/matchers/ruff.json"
27+
- name: Lint with Ruff (format)
28+
run: |
29+
hatch run dev:ruff format --check .

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repos:
88
# Run the formatter.
99
- id: ruff-format
1010
- repo: https://github.com/RobertCraigie/pyright-python
11-
rev: v1.1.355
11+
rev: v1.1.382
1212
hooks:
1313
- id: pyright
1414
# I don't love having to specify these here, but pre-commit only seems to work

CODE_OF_CONDUCT.md

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, gender identity and expression, level of experience,
9+
nationality, personal appearance, race, religion, or sexual identity and
10+
orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at <[email protected]>. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at [http://contributor-covenant.org/version/1/4][version]
72+
73+
[homepage]: http://contributor-covenant.org
74+
[version]: http://contributor-covenant.org/version/1/4/

CONTRIBUTING.md

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
## Contributing
2+
3+
[fork]: https://github.com/github/annotated-logger/fork
4+
[pr]: https://github.com/github/annotated-logger/compare
5+
[style]: https://docs.astral.sh/ruff/
6+
7+
Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great.
8+
9+
Contributions to this project are [released](https://help.github.com/articles/github-terms-of-service/#6-contributions-under-repository-license) to the public under the [project's open source license](LICENSE.txt).
10+
11+
Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
12+
13+
## Developing a fix/feature
14+
15+
Annotated Logger uses `ruff`, `pytest`, `pyright` and `mutmut` for testing and linting. It uses [`hatch`](https://github.com/pypa/hatch) as a project manager to build and install dependencies. When developing locally it's suggested that you ensure that your editor supports `ruff` and `pyright` for inline linting. The `pytest` test suite is very quick and should be run frequently. (`mutmut`)[https://github.com/boxed/mutmut] is a mutation testing tool and is fairly slow as it runs the other three tools hundreds of times after making minor tweaks to the code. It will typically be run only once development is complete to ensure everything is fully tested.
16+
17+
`script/mutmut_runner` is what `mutmut` uses to see if the mutation fails, however, it's also quite useful on it's own as it runs `ruff`, `pytest` and `pyright` exiting as soon as anything fails, so it makes a good sanity check.
18+
19+
In addition to the tests and linting above all PRs will compare the version number in \_\_init\_\_.py with the version in `main` to ensure that new PRs results in new versions.
20+
21+
## Submitting a pull request
22+
23+
1. [Fork][fork] and clone the repository
24+
1. Configure and install the dependencies: `script/bootstrap`
25+
1. Make sure the tests pass on your machine: `hatch run dev:test`
26+
1. Make sure linting passes: `hatch run dev:lint` and `hatch run dev:typing`
27+
1. Create a new branch: `git checkout -b my-branch-name`
28+
1. Make your change, add tests, and make sure the tests still pass
29+
1. Push to your fork and [submit a pull request][pr]
30+
1. Pat yourself on the back and wait for your pull request to be reviewed and merged.
31+
32+
Here are a few things you can do that will increase the likelihood of your pull request being accepted:
33+
34+
- Follow the [style guide][style].
35+
- Write tests.
36+
- Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests.
37+
- Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
38+
39+
## Resources
40+
41+
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
42+
- [Using Pull Requests](https://help.github.com/articles/about-pull-requests/)
43+
- [GitHub Help](https://help.github.com)

LICENSE.txt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright GitHub, Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)