Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert setup.cfg to pyproject.toml, update tools #80

Merged
merged 18 commits into from
Sep 29, 2023

Conversation

braingram
Copy link
Contributor

@braingram braingram commented Sep 26, 2023

Move configuration in setup.cfg to pyproject.toml.

Use ruff to replace flake8, isort and bandit.

Update tools to otherwise more closely match asdf (pre-commit config, rules, codespell, etc).

Python 3.12 testing was added. The tests are currently passing and a claim for 3.12 support was added to pyproject.toml.

During this update a few things were noticed:

jinja

jinja is used to perform formatting for one string:

from jinja2 import Environment

It is not listed as a dependency. This PR removes the use of jinja and replaces it with built-in python string formatting.

rename instead of refname

In directives.py ruff removed an unused variable rename.

elif shorten:
rename = schema_id
return refname, schema_id + fragment

This appears to be a typo (which was likely intended to be refname). However, switching this to refname results in build errors. I opened an issue for this (see: #81). For the scope of this PR the unused rename is replaced with a pass.

numpy

An attempt is made in conf.py to seed the numpy random number generated.

# Ensure documentation examples are determinstically random.
try:
numpy.random.seed(int(os.environ["SOURCE_DATE_EPOCH"]))
except KeyError:
pass

The used environment variable is not defined on readthedocs and makes this seeding unused for readthedocs builds. This PR removes this unused seeding.

datetime import in conf.py

datetime is imported by unused in conf.py. Asdf (and possibly other downstream packages) expect datetime to be imported when conf.py is star imported. A note and noqa was added to this import however the downstream packages should likely be updated to not expect this import or even better to not use a star import of conf.py.

@braingram braingram changed the title Pyproject toml Convert setup.cfg to pyprojec.toml, update tools Sep 26, 2023
@braingram braingram marked this pull request as ready for review September 26, 2023 14:39
@braingram braingram changed the title Convert setup.cfg to pyprojec.toml, update tools Convert setup.cfg to pyproject.toml, update tools Sep 26, 2023
@braingram braingram requested a review from eslavich September 26, 2023 14:45
Copy link
Contributor

@eslavich eslavich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

if shorten and not schema_id:
refname = components[-1]
elif shorten:
rename = schema_id
# TODO this should probably be:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oopsies...

@braingram braingram merged commit 97f22f6 into asdf-format:main Sep 29, 2023
21 of 22 checks passed
@braingram braingram deleted the pyproject_toml branch September 29, 2023 20:07
@braingram braingram mentioned this pull request Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants