Skip to content

[#8382] Packaging updates in the extensions template #8456

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

Merged
merged 11 commits into from
Oct 10, 2024

Conversation

amercader
Copy link
Member

@amercader amercader commented Sep 24, 2024

Refers to #8382 (this also includes #8437)

As discussed in #8382, this PR:

  • Updates the documentation to remove instances of the deprecated python setup.py develop and python setup.py sdist upload commands, and to not recommend editable installs unless it's a development install
  • Adds a new pyproject.toml file to the extension template which includes all project information, except for:
    • setuptools config options, which go to setup.cfg
    • Babel config options, which still hasn't mature pyproject.toml support
  • Adds the [build-system] section to CKAN core's pyproject.toml

There are no changes with relation to namespace packages or requirements in this PR

Fixes #8316

In our post_gen_project hook, we were dumping the cookiecutter object as
a Python object but using the `jsonify` filter. Cookicutter 2.6
introduced a new item in the context which is None by default, and this
got translated as `null` when dumping it, which is not valid Python
syntax.

I've refactored the hook a bit so it dumps the context in a bit more
safely manner.
* Remove instances of deprecated `python setup.py develop` and `python
setup.py sdist upload`
* Don't recommend editable installs unless it's a development install
Moved all project information there except for:

* setuptools config options, that go to setup.cfg
* Babel config options, which still hasn't mature pyproject.toml support
@wardi wardi self-assigned this Sep 26, 2024
@@ -45,7 +45,7 @@ To install {{ cookiecutter.project }}:

git clone https://github.com/{{ cookiecutter.github_user_name }}/{{ cookiecutter.project }}.git
cd {{ cookiecutter.project }}
pip install -e .
pip install .
Copy link
Member Author

Choose a reason for hiding this comment

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

This causes some confusion because the source remains in the directory where you cloned it, but the actual modules are installed in the virtual env libraries dir. Which means that users might try to make changes in the cloned files and be confused when these are not applied (it certainly happened to me a couple of times). Maybe I'm biased and a regular users won't tinker with the sources that much but if we really don't want to use editable installs by default perhaps we should a clear note here about the development install option mentioned a bit below.

See #8456 (comment)

Hopefully we will address the requirements handling and can just
recommend `pip install ckanext-xxx` soon
@amercader
Copy link
Member Author

@wardi I've reverted the install command back to editable as discussed in the dev meeting, this is ready for review

@wardi wardi merged commit e042ef7 into master Oct 10, 2024
9 checks passed
@wardi wardi deleted the 8382-packaging-updates branch October 10, 2024 14:10
@amercader
Copy link
Member Author

/backport please

@amercader
Copy link
Member Author

/backport

@ckanbot
Copy link

ckanbot commented Oct 10, 2024

Backport failed for dev-v2.11, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin dev-v2.11
git worktree add -d .worktree/backport-8456-to-dev-v2.11 origin/dev-v2.11
cd .worktree/backport-8456-to-dev-v2.11
git switch --create backport-8456-to-dev-v2.11
git cherry-pick -x 665c235dfe411b64c71978d4ae5a4b1816f8979e f7342c7926c7e67d83e590b77b3132a00a8c7937 77f6bbedf51cbc7c7a9a2511d64ae42705cb02e4 88672de2c76a436c296852b24f4ee2172f754031 cbaf04853424268ec19793a04cc0508648a40f2c 880351582df9808b039902f7dac2866c7d674d72 2a2f63c4066edab38e7ce872bad3940073963cc3 cc8744ff79931e1e8077a38ecfd8112254cb0bd5 85f8cd8bab9244a74428690c0fb3a297ea65ac49 d1a54f5aed7dbbf36d85fde53f871d9bf5f5bc24

amercader added a commit that referenced this pull request Oct 11, 2024
See #8456 (comment)

Hopefully we will address the requirements handling and can just
recommend `pip install ckanext-xxx` soon
amercader added a commit to ckan/ckanext-dcat that referenced this pull request Oct 23, 2024
Consolidate all setuptools config in setup.cfg as per
discussion in ckan/ckan#8456
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants