- TagMark
First of all, thanks for taking your time to contribute and help make our project even better than it is today! The following is a set of guidelines for contributing to TagMark. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.
First please enter the root directory of tagmark
.
Step 1 create you and enter virtual environment:
here we take mamba(conda) as example:
➜ mamba create -n testvenv python=3.11
➜ mamba activate testvenv
Step 2 install poetry
(testvenv) ➜ pip install poetry
Step 3 fork and clone the tagmark repo
Step 4 if your IDE is vscode, here are the recommended settings
.vscode/launch.json
:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Module",
"type": "python",
"request": "launch",
"cwd": "${workspaceRoot}",
"module": "tagmark.cli",
"justMyCode": false,
"args": [
// args for debug, change according to your needs
"convert",
"-i",
"data/tagmark_ui_data.jsonl",
"-f",
"tagmark_jsonlines",
"-o",
"data/new_tagmark_ui_data.jsonl"
]
}
]
}
.vscode/settings.json
{
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"python.formatting.provider": "none",
}
Step 1 run Docker daemon
Step 2 Build devcontainer image and start container:
in a new VSCode win, press Ctrl+Shift+P(windows) / Command+Shift+P(MacOS) to open Command Palette
and select Dev container: Clone Repository in Container Volume...
, you may be required to enter these/choose things:
- `git repo url``: https://github.com/pwnfan/tagmark.git
- Python version: you should select version >= 3.11
- Linux Distribution: I selected the first one(an alias of a specified version of ubuntu), but I did not test the others. You can try what you like.
after a while the image will be built and the container will be run, the VSCode windows will be reloaded and the git repo will show up.
create a PAT and store it into the .env
file in your local tagmark source dir, the details has been referred in README > Installation > Step 4
make install
poetry install
make lint
black .
isort --profile black .
flake8 --ignore=E501,W503 .
make test
poetry run pytest -v --cov=tagmark --cov-report=term-missing tests/
or if you want to generate a html report, just replace --cov-report=term-missing
with --cov-report=html
make build
poetry build
make clean
find . | grep -E "(__pycache__|\.pyc|\.pyo$\)" | xargs rm -rf
rm -rf dist
rm -rf .coverage
rm -rf .pytest_cache
rm -rf htmlcov
make changelog o=v0.1.0 n=v0.2.0 f=changelog.txt
o
: an older(starting) Git commit version number, its optional values are:- Git commit hash
- Git tag
n
: a newer(ending) Git commit version number, its optional values are:- Git commit hash
- Git tag
- HEAD, HEAD^, HEAD~3, etc.
f
: the path of the output file
git log {o}..{n} --oneline --abbrev-commit --pretty="* %h %s" > {f};
the meaning of the arguments are the same as those in Option 1: Using make command.
example:
git log v0.1.0..v0.2.0 --oneline --abbrev-commit --pretty="* %h %s" > changelog.txt
commit message format: {scope}>{action}: msg
{scope}
:infra
: infrastructure, fundamental thingsinfra.build
: build systeminfra.ci
: CI configuration files and scriptsinfra.misc
: miscellaneous things or other things- .gitignore
- .github
- Makefile
- etc
code
: code of TagMarkcode.dep
: (external) dependencies(libraries/modules/packages, etc.)code.core
: main core code of TagMark incore
foldercode.tool
: tool/plugin of TagMark intool
foldercode.tests
: testing code of TagMark intests
foldercode.misc
: miscellaneous things or other thingscode.data
: any data used by code
data
- any data not used by code
- the final output/result of the code execution
- etc
docs
: documentationproj
: this project, often used in combination with therelease
action
{action}
:new
- add new file(s) to a scope
- add new feature to existing file(s)
- add new content to existing document(s)
modify
: any modifications for existing filesmodify.fix
: bug fixmodify.perf
: code change that improves performancemodify.style
: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, naming, etc.)modify.refactor
: code refactor which not relates to fix, perf and stylemodify.update
: update an external dependencies(libraries/modules/packages, etc.)modify.misc
: miscellaneous things or other things- comment
revert
: revert any existing commitsdel
: removerelease
: Commit a release for a conventional changelog project
The subject contains a succinct description of the change, like Update code highlighting in README.md.
- No dot (.) at the end.
- Use the imperative, present tense: "change" not "changed" nor "changes".
please run the linter command in 4. Linting to format your code before pushing your pull request.
The Linting commands will also be run in the CI progress auto triggered by Github Actions to check the style of your code when you push your pull request to dev
branch. If the check failed your pull request is not able to be merged.