nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: takluyver/flit
Pull request #130 (2017-08-10 04:43:18)

Allow blank lines in classifiers.
Closes 1/3 of #129 

Not doing all because 
1) it's late
2) I should work on other stuff
3) this just show the example for a potential extra contributor if @takluyver thinks allowing blank lines is ok.


Patch:
diff --git a/flit/inifile.py b/flit/inifile.py
index 5d34acc..3d740f2 100644
--- a/flit/inifile.py
+++ b/flit/inifile.py
@@ -201,6 +201,7 @@ def _validate_config(cp, path):
         md_dict['name'] = md_dict.pop('dist_name')
 
     if 'classifiers' in md_dict:
+        md_dict['classifiers'] = [c for c in md_dict['classifiers'] if c.strip()]
         verify_classifiers(md_dict['classifiers'])
 
     # Scripts ---------------


Test patch:
diff --git a/tests/samples/classifiers_with_space.ini b/tests/samples/classifiers_with_space.ini
new file mode 100644
index 0000000..c83bb7e
--- /dev/null
+++ b/tests/samples/classifiers_with_space.ini
@@ -0,0 +1,29 @@
+[metadata]
+module=module1
+author=Sir Robin
+author-email=robin@camelot.uk
+home-page=http://github.com/sirrobin/module1
+classifiers=
+	Development Status :: 3 - Alpha
+	
+	# Indicate who your project is intended for
+	Intended Audience :: Developers
+	Intended Audience :: Information Technology
+	Intended Audience :: Science/Research
+	
+	Topic :: Internet
+	Topic :: Scientific/Engineering
+	Topic :: System :: Filesystems
+	Topic :: System :: Networking
+	
+	# Pick your license as you wish (should match "license" above)
+	License :: OSI Approved :: MIT License
+	
+	# Specify the Python versions you support here. In particular, ensure
+	# that you indicate whether you support Python 2, Python 3 or both.
+	Programming Language :: Python :: 2
+	Programming Language :: Python :: 2.7
+	Programming Language :: Python :: 3
+	Programming Language :: Python :: 3.4
+	Programming Language :: Python :: 3.5
+	Programming Language :: Python :: 3.6
diff --git a/tests/test_inifile.py b/tests/test_inifile.py
index 059044f..f41044c 100644
--- a/tests/test_inifile.py
+++ b/tests/test_inifile.py
@@ -10,6 +10,13 @@ def test_invalid_classifier():
     with pytest.raises(ConfigError):
         read_pkg_ini(samples_dir / 'invalid_classifier.ini')
 
+def test_classifiers_with_space():
+    """
+    Check that any empty lines (including the first one) for
+    classifiers are stripped
+    """
+    read_pkg_ini(samples_dir / 'classifiers_with_space.ini')
+
 def test_missing_entrypoints():
     with pytest.raises(FileNotFoundError):
         read_pkg_ini(samples_dir / 'entrypoints_missing.ini')
Repository: takluyver/flit
Pull request #139 (2017-10-10 10:13:29)

Ignore empty lines in all metadata list fields
This addresses https://github.com/takluyver/flit/issues/129.


Patch:
diff --git a/flit/inifile.py b/flit/inifile.py
index 3d740f2..2ed53f5 100644
--- a/flit/inifile.py
+++ b/flit/inifile.py
@@ -187,7 +187,7 @@ def _validate_config(cp, path):
 
         k2 = key.replace('-', '_')
         if key in metadata_list_fields:
-            md_dict[k2] = value.splitlines()
+            md_dict[k2] = [l for l in value.splitlines() if l.strip()]
         else:
             md_dict[k2] = value
 
@@ -201,7 +201,6 @@ def _validate_config(cp, path):
         md_dict['name'] = md_dict.pop('dist_name')
 
     if 'classifiers' in md_dict:
-        md_dict['classifiers'] = [c for c in md_dict['classifiers'] if c.strip()]
         verify_classifiers(md_dict['classifiers'])
 
     # Scripts ---------------


Test patch:
diff --git a/tests/samples/dev_requires_with_empty_lines.ini b/tests/samples/dev_requires_with_empty_lines.ini
new file mode 100644
index 0000000..31653d2
--- /dev/null
+++ b/tests/samples/dev_requires_with_empty_lines.ini
@@ -0,0 +1,7 @@
+[metadata]
+module=module1
+author=Sir Robin
+author-email=robin@camelot.uk
+home-page=http://github.com/sirrobin/module1
+dev-requires=
+	foo
diff --git a/tests/samples/requires_with_empty_lines.ini b/tests/samples/requires_with_empty_lines.ini
new file mode 100644
index 0000000..212e777
--- /dev/null
+++ b/tests/samples/requires_with_empty_lines.ini
@@ -0,0 +1,8 @@
+[metadata]
+module=module1
+author=Sir Robin
+author-email=robin@camelot.uk
+home-page=http://github.com/sirrobin/module1
+requires=foo
+	# Here's a comment!
+	bar
diff --git a/tests/test_inifile.py b/tests/test_inifile.py
index f41044c..d99720b 100644
--- a/tests/test_inifile.py
+++ b/tests/test_inifile.py
@@ -17,6 +17,14 @@ def test_classifiers_with_space():
     """
     read_pkg_ini(samples_dir / 'classifiers_with_space.ini')
 
+@pytest.mark.parametrize(('filename', 'key', 'expected'), [
+    ('requires_with_empty_lines.ini', 'requires_dist', ['foo', 'bar']),
+    ('dev_requires_with_empty_lines.ini', 'dev_requires', ['foo']),
+])
+def test_requires_with_empty_lines(filename, key, expected):
+    ini_info = read_pkg_ini(samples_dir / filename)
+    assert ini_info['metadata'][key] == expected
+
 def test_missing_entrypoints():
     with pytest.raises(FileNotFoundError):
         read_pkg_ini(samples_dir / 'entrypoints_missing.ini')
Repository: takluyver/flit
Pull request #289 (2019-10-24 19:41:08)

make Author-email field optional
The core metadata spec says it should be optional  https://packaging.python.org/specifications/core-metadata/#author-email

Related: https://github.com/takluyver/flit/issues/236

Anecdotally, I've seen people confused about what to do when they don't want a public email associated (currently they can only use flit by entering a fake email address there)


Patch:
diff --git a/flit/common.py b/flit/common.py
index 178afb7..58fdff2 100644
--- a/flit/common.py
+++ b/flit/common.py
@@ -234,7 +234,7 @@ class Metadata:
     def __init__(self, data):
         self.name = data.pop('name')
         self.version = data.pop('version')
-        self.author_email = data.pop('author_email')
+        self.author_email = data.pop('author_email', None)
         self.summary = data.pop('summary')
 
         for k, v in data.items():
diff --git a/flit/inifile.py b/flit/inifile.py
index 2c5b66d..1ee2e72 100644
--- a/flit/inifile.py
+++ b/flit/inifile.py
@@ -40,7 +40,6 @@ metadata_allowed_fields = {
 metadata_required_fields = {
     'module',
     'author',
-    'author-email',
 }
 
 
diff --git a/flit/init.py b/flit/init.py
index 2fc52ac..fde751d 100644
--- a/flit/init.py
+++ b/flit/init.py
@@ -65,7 +65,7 @@ class IniterBase:
 
     def validate_email(self, s):
         # Properly validating an email address is much more complex
-        return bool(re.match(r'.+@.+', s))
+        return bool(re.match(r'.+@.+', s)) or s == ""
 
     def validate_homepage(self, s):
         return not s or s.startswith(('http://', 'https://'))
@@ -179,8 +179,9 @@ class TerminalIniter(IniterBase):
         metadata = OrderedDict([
             ('module', module),
             ('author', author),
-            ('author-email', author_email),
         ])
+        if author_email:
+            metadata['author-email'] = author_email
         if home_page:
             metadata['home-page'] = home_page
         if license != 'skip':


Test patch:
diff --git a/tests/test_init.py b/tests/test_init.py
index 6d6fbe9..f920333 100644
--- a/tests/test_init.py
+++ b/tests/test_init.py
@@ -148,3 +148,25 @@ def test_init_homepage_validator():
         'home-page': 'https://www.example.org',
         'module': 'test_module_name',
     }
+
+def test_author_email_field_is_optional():
+    responses = ['test_module_name',
+                 'Test Author',
+                 '',  # Author-email field is skipped
+                 'https://www.example.org',
+                 '4',
+                ]
+    with TemporaryDirectory() as td, \
+          patch_data_dir(), \
+          faking_input(responses):
+        ti = init.TerminalIniter(td)
+        ti.initialise()
+        with Path(td, 'pyproject.toml').open() as f:
+            data = pytoml.load(f)
+        assert not Path(td, 'LICENSE').exists()
+    metadata = data['tool']['flit']['metadata']
+    assert metadata == {
+        'author': 'Test Author',
+        'module': 'test_module_name',
+        'home-page': 'https://www.example.org',
+    }