From da685f5bc4f4ca7d392cab426d78e04c99688f79 Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Tue, 5 Nov 2024 09:01:49 +0100 Subject: [PATCH] Update cruft --- .cruft.json | 2 +- .github/codecov.yml | 4 +++ README.md | 66 +++++++++++++++++++-------------------------- docs/source/conf.py | 2 +- tox.ini | 53 +++++++----------------------------- 5 files changed, 43 insertions(+), 84 deletions(-) create mode 100644 .github/codecov.yml diff --git a/.cruft.json b/.cruft.json index 9847df58..a0e672ad 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,6 +1,6 @@ { "template": "https://github.com/cthoyt/cookiecutter-snekpack", - "commit": "640faa5f1e39285d9f8103a3f5877db999abebc7", + "commit": "12edfcfa5f519467b5d834f0d4e706fb7cf4f065", "checkout": null, "context": { "cookiecutter": { diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 00000000..b6365605 --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,4 @@ +# see https://docs.codecov.com/v4.6/docs/codecov-yaml +ignore: + - "src/pyobo/__main__.py" + - "src/pyobo/cli.py" diff --git a/README.md b/README.md index a13f863f..268f412a 100644 --- a/README.md +++ b/README.md @@ -23,10 +23,12 @@ Codecov status Cookiecutter template from @cthoyt - - Code style: black + + Ruff Contributor Covenant + + DOI

Tools for biological identifiers, names, synonyms, xrefs, hierarchies, relations, and properties through the @@ -414,14 +416,14 @@ and make update to the `url` entry for that namespace in the Bioregistry. The most recent release can be installed from [PyPI](https://pypi.org/project/pyobo/) with: -```shell -pip install pyobo +```console +python3 -m pip install pyobo ``` The most recent code and data can be installed directly from GitHub with: -```shell -pip install git+https://github.com/biopragmatics/pyobo.git +```console +python3 -m pip install git+https://github.com/biopragmatics/pyobo.git ``` ## 👐 Contributing @@ -478,10 +480,10 @@ The final section of the README is for if you want to get involved by making a c To install in development mode, use the following: -```bash +```console git clone git+https://github.com/biopragmatics/pyobo.git cd pyobo -pip install -e . +python3 -m pip install -e . ``` ### Updating Package Boilerplate @@ -490,8 +492,8 @@ This project uses `cruft` to keep boilerplate (i.e., configuration, contribution configuration) up-to-date with the upstream cookiecutter package. Update with the following: -```shell -pip install cruft +```console +python3 -m pip install cruft cruft update ``` @@ -500,10 +502,11 @@ available [here](https://github.com/cruft/cruft?tab=readme-ov-file#updating-a-pr ### 🥼 Testing -After cloning the repository and installing `tox` with `pip install tox tox-uv`, +After cloning the repository and installing `tox` with +`python3 -m pip install tox tox-uv`, the unit tests in the `tests/` folder can be run reproducibly with: -```shell +```console tox -e py ``` @@ -514,12 +517,12 @@ Additionally, these tests are automatically re-run with each commit in a The documentation can be built locally using the following: -```shell +```console git clone git+https://github.com/biopragmatics/pyobo.git cd pyobo tox -e docs open docs/build/html/index.html -``` +``` The documentation automatically installs the package as well as the `docs` extra specified in the [`pyproject.toml`](../../Desktop/pyobo/pyproject.toml). `sphinx` plugins @@ -575,38 +578,23 @@ You only have to do the following steps once. #### Configuring your machine's connection to PyPI -You have to do the following steps once per machine. Create a file in your home directory called -`.pypirc` and include the following: - -```ini -[distutils] -index-servers = - pypi - testpypi - -[pypi] -username = __token__ -password = +You have to do the following steps once per machine. -# This block is optional in case you want to be able to make test releases to the Test PyPI server -[testpypi] -repository = https://test.pypi.org/legacy/ -username = __token__ -password = +```console +$ uv tool install keyring +$ keyring set https://upload.pypi.org/legacy/ __token__ +$ keyring set https://test.pypi.org/legacy/ __token__ ``` -Note that since PyPI is requiring token-based authentication, we use `__token__` as the user, verbatim. -If you already have a `.pypirc` file with a `[distutils]` section, just make sure that there is an `index-servers` -key and that `pypi` is in its associated list. More information on configuring the `.pypirc` file can -be found [here](https://packaging.python.org/en/latest/specifications/pypirc). +Note that this deprecates previous workflows using `.pypirc`. #### Uploading to PyPI After installing the package in development mode and installing -`tox` with `pip install tox tox-uv`, -run the following from the shell: +`tox` with `python3 -m pip install tox tox-uv`, +run the following from the console: -```shell +```console tox -e finish ``` @@ -617,7 +605,7 @@ This script does the following: and [`docs/source/conf.py`](../../Desktop/pyobo/docs/source/conf.py) to not have the `-dev` suffix 2. Packages the code in both a tar archive and a wheel using [`uv build`](https://docs.astral.sh/uv/guides/publish/#building-your-package) -3. Uploads to PyPI using [`twine`](https://github.com/pypa/twine). +3. Uploads to PyPI using [`uv publish`](https://docs.astral.sh/uv/guides/publish/#publishing-your-package). 4. Push to GitHub. You'll need to make a release going with the commit where the version was bumped. 5. Bump the version to the next patch. If you made big changes and want to bump the version by minor, you can use `tox -e bumpversion -- minor` after. diff --git a/docs/source/conf.py b/docs/source/conf.py index 61c9a513..269ca118 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -36,7 +36,7 @@ version = parsed_version.expand(r"\g.\g.\g") if parsed_version.group("release"): - tags.add("prerelease") # noqa: F821 + tags.add("prerelease") # noqa:F821 # See https://about.readthedocs.com/blog/2024/07/addons-by-default/ # Define the canonical URL if you are using a custom domain on Read the Docs diff --git a/tox.ini b/tox.ini index 626c0ea9..249a546b 100644 --- a/tox.ini +++ b/tox.ini @@ -212,33 +212,19 @@ commands = # 3. Get account recovery codes # 4. Set up 2-Factor Authentication # 5. Get an API token from https://pypi.org/manage/account/token/ -# 6. Create a file called .pypirc in the home directory if it does not already exist. -# 7. Add the following content to the .pypirc file -# -# [distutils] -# index-servers= -# pypi -# testpypi -# -# [pypi] -# username = __token__ -# password = -# -# If there's already an `index-servers =` list, just make sure you add `pypi` to it. -# More information about .pypirc can be found at https://packaging.python.org/en/latest/specifications/pypirc/ +# 6. Install keyring with `uv tool install keyring` +# 7. Add your token to keyring with `keyring set https://upload.pypi.org/legacy/ __token__` [testenv:release] description = Release the code to PyPI so users can pip install it skip_install = true -passenv = - TWINE_USERNAME - TWINE_PASSWORD deps = {[testenv:build]deps} - twine >= 1.5.0 + uv + keyring commands = {[testenv:build]commands} - twine upload --skip-existing dist/* + uv publish --username __token__ --keyring-provider subprocess --publish-url https://upload.pypi.org/legacy/ [testenv:finish] description = @@ -247,8 +233,6 @@ description = skip_install = true passenv = HOME - TWINE_USERNAME - TWINE_PASSWORD deps = {[testenv:release]deps} bump-my-version @@ -273,34 +257,19 @@ allowlist_externals = # 3. Get account recovery codes # 4. Set up 2-Factor Authentication # 5. Get an API token from https://test.pypi.org/manage/account/token/ -# 6. Create a file called .pypirc in the home directory if it does not already exist. -# 7. Add the following content to the .pypirc file -# -# [distutils] -# index-servers= -# pypi -# testpypi -# -# [testpypi] -# repository = https://test.pypi.org/legacy/ -# username = __token__ -# password = -# -# If there's already an `index-servers =` list, just make sure you add `testpypi` to it. -# More information about .pypirc can be found at https://packaging.python.org/en/latest/specifications/pypirc/ +# 6. Install keyring with `uv tool install keyring` +# 7. Add your token to keyring with `keyring set https://test.pypi.org/legacy/ __token__` [testenv:testrelease] description = Release the code to the test PyPI site skip_install = true -passenv = - TWINE_USERNAME - TWINE_PASSWORD deps = {[testenv:build]deps} - twine >= 1.5.0 + uv + keyring commands = {[testenv:build]commands} - twine upload --skip-existing --repository testpypi dist/* + uv publish --username __token__ --keyring-provider subprocess --publish-url https://test.pypi.org/legacy/ [testenv:testfinish] description = @@ -309,8 +278,6 @@ description = skip_install = true passenv = HOME - TWINE_USERNAME - TWINE_PASSWORD deps = {[testenv:testrelease]deps} bump-my-version