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

Use Flit for packaging #589

Merged
merged 10 commits into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ jobs:
- pip-{{ .Branch }}-
- pip-main-

- run: pip install -e .[testing]
- run: pip install flit
- run: flit install --deps production --extras testing

- type: cache-save
key: pip-{{ .Branch }}-{{ epoch }}
Expand All @@ -56,7 +57,8 @@ jobs:
- checkout
- run: git clone [email protected]:wagtail/wagtail.git

- run: pip install -e .[testing]
- run: pip install flit
- run: flit install --deps production --extras testing
- run: pip install ./wagtail

- run: python testmanage.py test
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
uses: actions/cache@v3
with:
path: .tox
key: tox-${{ hashFiles('setup.py') }}-py${{ matrix.python }}-dj${{ matrix.django }}-w${{ matrix.wagtail }}-sqlite
key: tox-${{ hashFiles('pyproject.toml') }}-py${{ matrix.python }}-dj${{ matrix.django }}-w${{ matrix.wagtail }}-sqlite
- name: Test
run: |
tox
Expand Down Expand Up @@ -132,7 +132,7 @@ jobs:
uses: actions/cache@v3
with:
path: .tox
key: tox-${{ hashFiles('setup.py') }}-py${{ matrix.python }}-dj${{ matrix.django }}-w${{ matrix.wagtail }}-postgres
key: tox-${{ hashFiles('pyproject.toml') }}-py${{ matrix.python }}-dj${{ matrix.django }}-w${{ matrix.wagtail }}-postgres
- name: Test
run: |
tox
Expand All @@ -155,8 +155,8 @@ jobs:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
pip install django~=3.2
pip install -e.[testing]
pip install flit
flit install --deps production --extras testing
pip install coverage==5.4
- name: Test
run: |
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.pyc
__pycache__/
*.py[co]
/build
/dist
/wagtail_localize.egg-info
Expand Down
8 changes: 0 additions & 8 deletions MANIFEST.in

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ clean: ## 🗑️ - Remove __pycache__ and test artifacts

package-setup:
@echo "📦 - Packaging for PyPI"
python3 setup.py clean --all sdist bdist_wheel
flit build --setup-py

package: clean package-setup ## 📦 - Package for PyPI

Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,20 @@ cd wagtail-localize

With your preferred virtualenv activated, install testing dependencies:

#### Using pip

```sh
pip install pip>=21.3
pip install -e .[testing] -U
```

#### Using flit

```sh
pip install flit
flit install
```

### pre-commit

Note that this project uses [pre-commit](https://github.com/pre-commit/pre-commit). To set up locally:
Expand Down
3 changes: 2 additions & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ publish = "site"
ignore = "git diff --quiet HEAD^ HEAD {readme.md,mkdocs.yml,netlify.toml,docs/,*.py}"
command = """
pip install django~=3.2
pip install -e.[testing,documentation]
pip install flit
flit install --deps production --extras documentation,testing
mkdocs build -d site
"""
86 changes: 86 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
[build-system]
requires = ["flit_core >=3.2,<4"]
build-backend = "flit_core.buildapi"

[project]
name = "wagtail-localize"
authors = [{name = "Karl Hobley", email = "[email protected]"}]
description = "Translation plugin for Wagtail CMS"
readme = "README.md"
license = {file = "LICENSE"}
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Framework :: Django",
"Framework :: Django :: 2.2",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.0",
"Framework :: Wagtail",
"Framework :: Wagtail :: 2",
"Framework :: Wagtail :: 3"
]
dynamic = ["version"]
zerolab marked this conversation as resolved.
Show resolved Hide resolved
requires-python = ">=3.7"
dependencies = [
"Django>=2.2,<4.1",
"Wagtail>=2.11,<4.0",
"polib>=1.1,<2.0",
"typing_extensions>=4.0"
]

[project.optional-dependencies]
testing = [
"dj-database-url==0.5.0",
"freezegun==1.1.0",
"django-rq>=2.5,<3.0"
]
documentation = [
"mkdocs==1.1.2",
"mkdocs-material==6.2.8",
"mkdocs-mermaid2-plugin==0.5.1",
"mkdocstrings==0.14.0",
"mkdocs-include-markdown-plugin==2.8.0",
"pygments==2.11.2"
]
google = [
"google-cloud-translate>=3.0.0"
]

[project.urls]
Home = "https://www.wagtail-localize.org"
Source = "https://github.com/wagtail/wagtail-localize"
Documentation = "https://www.wagtail-localize.org"

[tool.flit.module]
name = "wagtail_localize"

[tool.flit.sdist]
exclude = [
"wagtail_localize/static_src",
"wagtail_localize/test",
"wagtail_localize/tests",
"wagtail_localize/machine_translators/tests",
"wagtail_localize/segments/tests",
zerolab marked this conversation as resolved.
Show resolved Hide resolved
"wagtail_localize/static/.gitignore",
"Makefile",
"scripts",
"docs",
".*",
"*.js",
"*.json",
"*.ini",
"*.yml",
"netlify.toml",
"testmanage.py",
]
include = [
"wagtail_localize/static"
]
Comment on lines +84 to +86
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment is probably more a clarification for @zerolab when he comes to review it than anything else as it confused me initially:

The reason why we have to explicitly include this here (but we don't have to do this for the templates or .mo files, etc) is because flit respects .gitignore, so if we want to include files in the package build that are not checked into source control we have to tell flit to do it.

73 changes: 0 additions & 73 deletions setup.py

This file was deleted.