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

Migration to pyproject.toml #3338

Open
wants to merge 42 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
e4cddf2
migration to pyproject.toml
hirosassa Jan 18, 2025
b575804
migrate to pyproject.yml
hirosassa Jan 19, 2025
0c7f24d
migrate to pyproject.yml
hirosassa Jan 19, 2025
87de330
Merge branch 'master' into migration-to-uv
hirosassa Jan 19, 2025
aee8e9c
apply {envpython}
hirosassa Jan 19, 2025
06df545
apply {envpython}
hirosassa Jan 19, 2025
5ad74bc
pass env parameter directly
hirosassa Jan 19, 2025
0816898
remove cache tentatively
hirosassa Jan 19, 2025
2e88012
remove 3.8 tentatively
hirosassa Jan 19, 2025
a62ef47
allowlist_externals
hirosassa Jan 19, 2025
d51c3b0
allowlist_externals
hirosassa Jan 19, 2025
1ce319b
fix back
hirosassa Jan 19, 2025
48b9029
update requires
hirosassa Jan 19, 2025
e486da0
enforce tox-uv versions
hirosassa Jan 19, 2025
c9e2a8f
enforce tox-uv versions
hirosassa Jan 19, 2025
3e0720d
change versions
hirosassa Jan 19, 2025
f9819be
remove unused variables
hirosassa Jan 19, 2025
483aa25
remove constraint on sqlalchemy
hirosassa Jan 19, 2025
62f195a
refactor workflow
hirosassa Jan 19, 2025
cb3d1c1
remove runner
hirosassa Jan 19, 2025
aa22b4e
remove pi
hirosassa Jan 19, 2025
5e68ba0
version constraint
hirosassa Jan 19, 2025
d60b65f
fix: docs runs on python 310
hirosassa Jan 25, 2025
77a223d
test: run python 3.8 or above
hirosassa Jan 25, 2025
9bf7c67
recover: passenv
hirosassa Jan 25, 2025
68922bf
recover: sqlalchemy version
hirosassa Jan 25, 2025
0e8c7cd
fix: relock
hirosassa Jan 25, 2025
0c94ebb
remove python version
hirosassa Jan 25, 2025
57b56ea
relock
hirosassa Jan 25, 2025
4428baf
hack: use system python for py37
hirosassa Jan 25, 2025
2821873
hack: use system python for py37
hirosassa Jan 25, 2025
62fd597
fix back
hirosassa Jan 25, 2025
43c2856
Merge branch 'master' into migration-to-uv
hirosassa Feb 1, 2025
844d94d
use LuigiTestCase
hirosassa Feb 1, 2025
0038252
extend timeout tentatively
hirosassa Feb 1, 2025
1e7b2dc
fix back
hirosassa Feb 1, 2025
9616953
sort dependency groups and dependencies
hirosassa Feb 1, 2025
12a9d8a
update release process document
hirosassa Feb 1, 2025
7be8a6d
Merge branch 'master' into migration-to-uv
hirosassa Feb 1, 2025
cd6fee3
drop Python 3.7 support
hirosassa Feb 2, 2025
48650b7
removed unnecessary codecov step
hirosassa Feb 7, 2025
6f8a76f
fix install process of uv
hirosassa Feb 7, 2025
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
86 changes: 49 additions & 37 deletions .github/workflows/pythonbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,15 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Set up the latest version of uv
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v4
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements files
key: ${{ format('{0}-pip-{1}', runner.os, hashFiles('dev-requirements.txt', format('requirements{0}.txt', matrix.spark-version-suffix))) }}
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- name: Install dependencies
run: |
python -m pip install --upgrade pip 'tox<4.0'
uv tool install --python-preference only-managed --python 3.12 tox --with tox-uv # we need latest uv, tox, and tox-uv
uv python install --python-preference only-managed ${{ matrix.python-version }}
- name: Setup MySQL DB
run: |
sudo /etc/init.d/mysql start
Expand All @@ -51,7 +46,7 @@ jobs:
- name: Build
env:
TOXENV: ${{ matrix.tox-env }}
run: tox
run: uvx --with tox-uv tox run
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
Expand Down Expand Up @@ -94,27 +89,23 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v4
- name: Set up the latest version of uv
uses: astral-sh/setup-uv@v5
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements files
key: ${{ format('{0}-pip-{1}', runner.os, hashFiles('dev-requirements.txt', format('requirements{0}.txt', matrix.spark-version-suffix))) }}
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- name: Install dependencies
run: |
python -m pip install --upgrade pip 'tox<4.0'
uv tool install --python-preference only-managed --python 3.12 tox --with tox-uv # we need latest uv, tox, and tox-uv
uv python install --python-preference only-managed ${{ matrix.python-version }}

- name: Create PSQL database
run: |
PGPASSWORD=postgres psql -h localhost -p 5432 -c 'create database spotify;' -U postgres
- name: Build
env:
TOXENV: ${{ matrix.tox-env }}
run: tox
run: uvx --with tox-uv tox run
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
Expand Down Expand Up @@ -189,33 +180,54 @@ jobs:
- python-version: "3.12"
tox-env: py312-azureblob

steps:
- uses: actions/checkout@v4
- name: Set up the latest version of uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- name: Install dependencies
run: |
uv tool install --python-preference only-managed --python 3.12 tox --with tox-uv # we need latest uv, tox, and tox-uv
uv python install --python-preference only-managed ${{ matrix.python-version }}
- name: Build
env:
TOXENV: ${{ matrix.tox-env }}
OVERRIDE_SKIP_CI_TESTS: ${{ matrix.OVERRIDE_SKIP_CI_TESTS }}
run: uvx --with tox-uv tox run
- name: Upload coverage to Codecov
if: ${{ matrix.tox-env != 'flake8' && matrix.tox-env != 'docs' }}
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
verbose: true
others:
runs-on: ubuntu-20.04

strategy:
matrix:
include:
- python-version: "3.10"
tox-env: flake8
- python-version: "3.10"
tox-env: docs

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v4
- name: Set up the latest version of uv
uses: astral-sh/setup-uv@v5
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements files
key: ${{ format('{0}-pip-{1}', runner.os, hashFiles('dev-requirements.txt', format('requirements{0}.txt', matrix.spark-version-suffix))) }}
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- name: Install dependencies
run: |
python -m pip install --upgrade pip 'tox<4.0'
uv tool install --python-preference only-managed --python 3.12 tox --with tox-uv # we need latest uv, tox, and tox-uv
uv python install --python-preference only-managed ${{ matrix.python-version }}
- name: Build
env:
TOXENV: ${{ matrix.tox-env }}
OVERRIDE_SKIP_CI_TESTS: ${{ matrix.OVERRIDE_SKIP_CI_TESTS }}
run: tox
run: uvx --with tox-uv tox run
Copy link
Collaborator

Choose a reason for hiding this comment

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

The step just below this line includes a conditional to not run coverage upload if flake8 or docs. But this "others" matrix only includes flake8 and docs. Could we then remove its Upload coverage to Codecov step entirely?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed in 48650b7

- name: Upload coverage to Codecov
if: ${{ matrix.tox-env != 'flake8' && matrix.tox-env != 'docs' }}
uses: codecov/codecov-action@v5
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,5 @@ Icon
Network Trash Folder
Temporary Items
.apdisk

.python-version
2 changes: 2 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ python:
install:
- method: pip
path: .
extra_requirements:
- readthedocs
24 changes: 13 additions & 11 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,29 @@ We are always happy to receive Pull Requests. When you open a PR, it will
automatically build on Travis. So you're not strictly required to test the
patch locally before submitting it.

If you do want to run the tests locally you'll need to ``pip install tox`` and
then run one of the tox commands below.
If you do want to run the tests locally you'll need to run the commands below
.. code:: bash
pipx install uv
uv tool install tox --with tox-uv

You will need a ``tox --version`` of at least 2.0.
You will need a ``tox --version`` of at least 4.22.

.. code:: bash

# These commands are pretty fast and will tell if you've
# broken something major:
tox -e flake8
tox -e py37-core
tox run -e flake8
tox run -e py37-core

# You can also test particular files for even faster iterations
tox -e py37-core test/rpc_test.py
tox run -e py37-core -- test/rpc_test.py

# The visualiser tests require phantomjs to be installed on your path
tox -e visualiser
tox run -e visualiser

# And some of the others involve downloading and running Hadoop:
tox -e py33-cdh
tox -e py34-hdp
tox run -e py38-cdh
tox run -e py39-hdp

Where ``flake8`` is the lint checking, ``py37`` is obviously Python 3.7.
``core`` are tests that do not require external components and ``cdh`` and
Expand All @@ -45,7 +47,7 @@ For `cdh` and `hdp`, tox will download the hadoop distribution for you. You
however have to have Java installed and the `JAVA_HOME` environment variable
set.

For more details, check out the ``.travis.yml`` and ``tox.ini`` files.
For more details, check out the ``.github/workflows/pythonbuild.yml`` and ``tox.ini`` files.

Writing documentation
=====================
Expand All @@ -59,7 +61,7 @@ You verify that your documentation code compiles by running

.. code:: bash

tox -e docs
tox run -e docs

After that, you can check how it renders locally with your browser

Expand Down
7 changes: 0 additions & 7 deletions MANIFEST.in

This file was deleted.

2 changes: 1 addition & 1 deletion RELEASE-PROCESS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ For maintainers of Luigi, who have push access to pypi. Here's how you upload
Luigi to pypi.

#. Make sure [twine](https://pypi.org/project/twine/) is installed ``pip install twine``.
#. Update version number in `luigi/__meta__.py`.
#. Update version number in `luigi/__version__.py`.
dlstadther marked this conversation as resolved.
Show resolved Hide resolved
#. Commit, perhaps simply with a commit message like ``Version x.y.z``.
#. Push to GitHub at [spotify/luigi](https://github.com/spotify/luigi).
#. Clean up previous distributions by executing ``rm -rf dist``
Expand Down
10 changes: 5 additions & 5 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ def _warn_node(self, msg, node, *args, **kwargs):

sphinx.environment.BuildEnvironment.warn_node = _warn_node

if os.environ.get('READTHEDOCS', None) == 'True':
# on_rtd is whether we are on readthedocs.org, this line of code grabbed from docs.readthedocs.org
Copy link
Collaborator

Choose a reason for hiding this comment

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

Before merging, we'll need to identify how to verify the merging of the final version of this branch doesn't break Luigi's readthedocs.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@hirosassa , how you thought how we can be sure that we don't break RTD when merging this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it is a little bit difficult because it depends on webhook of this repo.
I confirmed that a local build of documents using Sphinx is succeeded.

on_rtd = os.environ.get('READTHEDOCS', None) == 'True'

if on_rtd:
# Run sphinx-apidoc automatically in readthedocs
# Taken from this: https://lists.torproject.org/pipermail/tor-commits/2012-September/046695.html
os.system('sphinx-apidoc -o api -T ../luigi --separate')
Expand All @@ -83,7 +86,7 @@ def _warn_node(self, msg, node, *args, **kwargs):
# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
needs_sphinx = '1.4.4' # Value mirrored in doc/conf.py
needs_sphinx = '1.4.4' # Value mirrored in pyproject.toml

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
Expand Down Expand Up @@ -167,9 +170,6 @@ def _warn_node(self, msg, node, *args, **kwargs):
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.

# on_rtd is whether we are on readthedocs.org, this line of code grabbed from docs.readthedocs.org
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'

if not on_rtd: # only import and set the theme if we're building docs locally
try:
import sphinx_rtd_theme
Expand Down
3 changes: 2 additions & 1 deletion luigi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
Package containing core luigi functionality.
"""

from luigi.__meta__ import __version__
from luigi.__version__ import VERSION

from luigi import task
from luigi.task import (
Expand Down Expand Up @@ -56,6 +56,7 @@
from luigi.event import Event


__version__ = VERSION
__all__ = [
'task', 'Task', 'Config', 'ExternalTask', 'WrapperTask', 'namespace', 'auto_namespace',
'DynamicRequirements',
Expand Down
11 changes: 0 additions & 11 deletions luigi/__meta__.py

This file was deleted.

3 changes: 3 additions & 0 deletions luigi/__version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# coding: utf-8

VERSION = '3.6.0'
Loading
Loading