The first things to do when contributing to the code base here are to clone this repository and set up your Python environment.
- Clone this repository:
# Either the HTTPS method...
$ git clone https://github.com/Machine-Learning-for-Medical-Language/cnlp_transformers.git
# ...or the SSH method
$ git clone git@github.com:Machine-Learning-for-Medical-Language/cnlp_transformers.git- Enter the repo:
cd cnlp_transformers - You will need Python 3.8. Either a
venvvirtual environment or a Conda environment should work. Create your environment and activate it. - Install the development dependencies:
pip install -r dev-requirements.txt - Install
cnlp-transformersin editable mode:pip install -e .
The remainder of the instructions on this document will assume that you have installed the development dependencies.
If you have changes to the code that you wish to contribute to the repository, please follow these steps.
- Fork the project on GitHub.
- Add your fork as a remote to push your work to. Replace
{username}with your username. This names the remote "fork", the default Machine-Learning-for-Medical-Language remote is "origin".
# Either the HTTPS method...
$ git remote add fork https://github.com/{username}/cnlp_transformers.git
# ...or the SSH method
$ git remote add fork git@github.com:{username}/cnlp_transformers.git- Make a new branch and set your fork as the upstream remote:
$ git switch -c your-branch-name # or git checkout -b
$ git push --set-upstream fork your-branch-name- Open an issue that motivates the change you are making if there is not one already.
- Make your changes in
your-branch-nameon your fork. - Open a PR to close the issue.
First, increment the version number in src/cnlpt/VERSION if it isn't already.
Then, run build:
$ python -m buildThis will build the package in the ./dist/ directory, creating it if it does not exist.
In preparation, set up your PyPI API key if you haven't already:
- Log into your PyPI account
- Generate an API key for the
cnlp-transformersproject here - Create a file
~/.pypirc:
[pypi]
username = __token__
password = <the token value, including the `pypi-` prefix>Only follow these steps after merging the new version branch into master.
-
Checkout the merge commit for the new version; this will usually be the latest commit in
master. -
Before continuing, ensure the version number in
src/cnlpt/VERSIONhas been incremented from the previous version on PyPI. -
Delete the contents of the
./dist/directory if it exists. -
Build the new version according to the building instructions above.
-
Upload to PyPI with
twine:$ python -m twine upload dist/*
To rebuild the autodoc toctrees and the transformers Intersphinx
mappings, run build_doc_source.sh.
To build the docs locally for testing documentation changes before
uploading to readthedocs, first uncomment lines 36 and 65 on
docs/conf.py, then execute the following:
$ cd docs
$ make htmlThis will write the docs to docs/build/html; simply open
docs/build/html/index.html in your browser of choice to view the
built documentation.