Skip to content

Commit

Permalink
cookiecutter: Use pyproject.toml instead of setup.cfg or babel.cfg
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Sep 12, 2024
1 parent 17d8d36 commit 2a68bcf
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ README.rst

# Configuration
pyproject.toml
setup.cfg

# Testing
**/tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
python-version: ${{ matrix.python-version }}
{%- endraw %}
cache: pip
cache-dependency-path: setup.cfg
cache-dependency-path: pyproject.toml
- run: pip install .[test]
- run: coverage run --source={{ cookiecutter.package_name }} pytest -W error
- uses: coverallsapp/github-action@v2
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
with:
python-version: '3.10'
cache: pip
cache-dependency-path: setup.cfg
cache-dependency-path: pyproject.toml
- shell: bash
run: curl -s -S --retry 3 $BASEDIR/tests/install.sh | bash -
- shell: bash
Expand Down
2 changes: 1 addition & 1 deletion docs/python/ci.rst
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ Find repositories for Python packages but without ``pypi.yml`` files:

.. code-block:: bash
find . -name setup.cfg ! -path '*/node_modules/*' -exec bash -c 'if grep long_description {} > /dev/null && [[ -z $(find $(echo {} | cut -d/ -f2) -name pypi.yml) ]]; then echo {}; fi' \;
find . -name pyproject.toml ! -path '*/node_modules/*' -exec bash -c 'if grep classifiers {} > /dev/null && [[ -z $(find $(echo {} | cut -d/ -f2) -name pypi.yml) ]]; then echo {}; fi' \;
Find and compare ``i18n.yml`` files:

Expand Down
15 changes: 10 additions & 5 deletions docs/python/i18n.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,17 @@ When using Django, use its `translation functions and template tags <https://doc
Configure message extraction
----------------------------

When using Django, this step is already done. Otherwise, create a `babel.cfg file <https://babel.pocoo.org/en/latest/messages.html#extraction-method-mapping-and-configuration>`__, for example:
When using Django, this step is already done. Otherwise, create a `pyproject.toml file <https://babel.pocoo.org/en/latest/messages.html#extraction-method-mapping-and-configuration>`__, for example:

.. code-block:: ini
.. code-block:: toml
[python: **.py]
[jinja2: **.html]
[[tool.babel.mappings]]
method = "python"
pattern = "**.py"
[[tool.babel.mappings]]
method = "jinja2"
pattern = "**.html"
Add the Transifex mapping
-------------------------
Expand Down Expand Up @@ -58,7 +63,7 @@ Whenever text in the interface is added or updated, you must extract the strings
.. code-block:: bash
:caption: Python (example)
pybabel extract -F babel.cfg -o messages.pot .
pybabel extract -F pyproject.toml -o messages.pot .
pybabel update -N -i messages.pot -d locale
Then, push the PO files to Transifex with:
Expand Down
2 changes: 1 addition & 1 deletion docs/python/preferences.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Maintainers can find dependencies with:

.. code-block:: bash
find . \( -name 'setup.cfg' -or -name 'requirements.in' \) -exec echo {} \; -exec cat {} \;
find . \( -name 'pyproject.toml' -or -name 'requirements.in' \) -exec echo {} \; -exec cat {} \;
Preferences
-----------
Expand Down
2 changes: 1 addition & 1 deletion docs/python/samples/i18n/babel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- run: pip install babel
- name: Update catalogs
run: |
pybabel extract -F babel.cfg -o messages.pot .
pybabel extract -F pyproject.toml -o messages.pot .
pybabel update -N -i messages.pot -d locale
- name: Count incomplete translations
shell: bash
Expand Down

0 comments on commit 2a68bcf

Please sign in to comment.