Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Oct 4, 2023
2 parents d5dbe28 + 9762f66 commit a5b9886
Show file tree
Hide file tree
Showing 28 changed files with 44 additions and 50 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/pypi.yml
@@ -0,0 +1,23 @@
name: Publish to PyPI
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- run: pip install --upgrade build
- run: python -m build --sdist --wheel
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
skip-existing: true
- name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
2 changes: 2 additions & 0 deletions CHANGELOG.rst
@@ -1,6 +1,8 @@
Unreleased
----------

* fix: :doc:`/scripts/csvjoin` uses the correct columns when performing a ``--right`` join.
* Add SQLAlchemy 2 support.
* Drop Python 3.7 support (end-of-life was June 5, 2023).

1.1.1 - February 22, 2023
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Expand Up @@ -4,7 +4,7 @@

.. image:: https://coveralls.io/repos/wireservice/csvkit/badge.svg?branch=master
:target: https://coveralls.io/r/wireservice/csvkit
:alt: Coverage Status
:alt: Coverage status

.. image:: https://img.shields.io/pypi/dm/csvkit.svg
:target: https://pypi.python.org/pypi/csvkit
Expand Down
2 changes: 1 addition & 1 deletion csvkit/utilities/csvjoin.py
Expand Up @@ -98,7 +98,7 @@ def main(self):
remaining_tables.reverse()

for i, table in enumerate(remaining_tables):
jointab = agate.Table.join(jointab, table, join_column_ids[-(i + 2)], join_column_ids[-1])
jointab = agate.Table.join(jointab, table, join_column_ids[-1], join_column_ids[-(i + 2)])
elif self.args.outer_join:
# Full outer join
for i, table in enumerate(tables[1:]):
Expand Down
6 changes: 3 additions & 3 deletions csvkit/utilities/csvsql.py
Expand Up @@ -191,7 +191,7 @@ def _failsafe_main(self):
if self.connection:
if self.args.before_insert:
for query in self.args.before_insert.split(';'):
self.connection.execute(query)
self.connection.exec_driver_sql(query)

table.to_sql(
self.connection,
Expand All @@ -209,7 +209,7 @@ def _failsafe_main(self):

if self.args.after_insert:
for query in self.args.after_insert.split(';'):
self.connection.execute(query)
self.connection.exec_driver_sql(query)

# Output SQL statements
else:
Expand Down Expand Up @@ -237,7 +237,7 @@ def _failsafe_main(self):

for query in queries:
if query.strip():
rows = self.connection.execute(query)
rows = self.connection.exec_driver_sql(query)

# Output the result of the last query as CSV
if rows.returns_rows:
Expand Down
2 changes: 1 addition & 1 deletion csvkit/utilities/sql2csv.py
Expand Up @@ -69,7 +69,7 @@ def main(self):

self.input_file.close()

rows = connection.execution_options(no_parameters=True).execute(query)
rows = connection.execution_options(no_parameters=True).exec_driver_sql(query)
output = agate.csv.writer(self.output_file, **self.writer_kwargs)

if rows.returns_rows:
Expand Down
6 changes: 5 additions & 1 deletion docs/conf.py
Expand Up @@ -33,7 +33,11 @@

htmlhelp_basename = 'csvkitdoc'

autodoc_member_order = 'bysource'
autodoc_default_options = {
'members': None,
'member-order': 'bysource',
'show-inheritance': True,
}

intersphinx_mapping = {
'python': ('https://docs.python.org/3', None),
Expand Down
Empty file modified examples/realdata/census_2000/VROUTFSJ.TXt 100755 → 100644
Empty file.
9 changes: 4 additions & 5 deletions setup.py
Expand Up @@ -59,7 +59,10 @@
'agate>=1.6.1',
'agate-excel>=0.2.2',
'agate-dbf>=0.2.2',
'agate-sql<0.6.0',
'agate-sql>=0.5.3',
'openpyxl',
'sqlalchemy',
'xlrd',
# “selectable” entry points were introduced in Python 3.10.
# https://docs.python.org/3/library/importlib.metadata.html
'importlib_metadata; python_version < "3.10"',
Expand All @@ -70,9 +73,5 @@
'pytest',
'pytest-cov',
],
'docs': [
'sphinx>=1.0.7',
'sphinx_rtd_theme',
],
},
)
2 changes: 0 additions & 2 deletions tests/test_cleanup.py
@@ -1,5 +1,3 @@
#!/usr/bin/env python

import unittest

from csvkit.cleanup import join_rows
Expand Down
2 changes: 0 additions & 2 deletions tests/test_cli.py
@@ -1,5 +1,3 @@
#!/usr/bin/env python

import unittest

from csvkit.cli import match_column_identifier, parse_column_identifiers
Expand Down
2 changes: 0 additions & 2 deletions tests/test_convert/test_convert.py
@@ -1,5 +1,3 @@
#!/usr/bin/env python

import unittest

from csvkit import convert
Expand Down
2 changes: 0 additions & 2 deletions tests/test_convert/test_fixed.py
@@ -1,5 +1,3 @@
#!/usr/bin/env python

from io import StringIO

from csvkit.convert import fixed
Expand Down
2 changes: 0 additions & 2 deletions tests/test_grep.py
@@ -1,5 +1,3 @@
#!/usr/bin/env python

import re
import unittest

Expand Down
2 changes: 0 additions & 2 deletions tests/test_utilities/test_csvclean.py
@@ -1,5 +1,3 @@
#!/usr/bin/env python

import os
import sys
from io import StringIO
Expand Down
2 changes: 0 additions & 2 deletions tests/test_utilities/test_csvcut.py
@@ -1,5 +1,3 @@
#!/usr/bin/env python

import sys
from unittest.mock import patch

Expand Down
2 changes: 0 additions & 2 deletions tests/test_utilities/test_csvformat.py
@@ -1,5 +1,3 @@
#!/usr/bin/env python

import sys
from io import StringIO
from unittest.mock import patch
Expand Down
2 changes: 0 additions & 2 deletions tests/test_utilities/test_csvgrep.py
@@ -1,5 +1,3 @@
#!/usr/bin/env python

import sys
from unittest.mock import patch

Expand Down
6 changes: 4 additions & 2 deletions tests/test_utilities/test_csvjoin.py
@@ -1,5 +1,3 @@
#!/usr/bin/env python

import sys
from unittest.mock import patch

Expand Down Expand Up @@ -31,6 +29,10 @@ def test_right(self):
output = self.get_output_as_io(['-c', 'a', '--right', 'examples/join_a.csv', 'examples/join_b.csv'])
self.assertEqual(len(output.readlines()), 4)

def test_right_indices(self):
output = self.get_output_as_io(['-c', '1,4', '--right', 'examples/join_a.csv', 'examples/blanks.csv'])
self.assertEqual(len(output.readlines()), 2)

def test_outer(self):
output = self.get_output_as_io(['-c', 'a', '--outer', 'examples/join_a.csv', 'examples/join_b.csv'])
self.assertEqual(len(output.readlines()), 6)
Expand Down
2 changes: 0 additions & 2 deletions tests/test_utilities/test_csvjson.py
@@ -1,5 +1,3 @@
#!/usr/bin/env python

import json
import sys
from io import StringIO
Expand Down
2 changes: 0 additions & 2 deletions tests/test_utilities/test_csvlook.py
@@ -1,5 +1,3 @@
#!/usr/bin/env python

import sys
from io import StringIO
from unittest.mock import patch
Expand Down
2 changes: 0 additions & 2 deletions tests/test_utilities/test_csvsort.py
@@ -1,5 +1,3 @@
#!/usr/bin/env python

import sys
from io import StringIO
from unittest.mock import patch
Expand Down
2 changes: 0 additions & 2 deletions tests/test_utilities/test_csvsql.py
@@ -1,5 +1,3 @@
#!/usr/bin/env python

import os
import sys
from io import StringIO
Expand Down
2 changes: 0 additions & 2 deletions tests/test_utilities/test_csvstack.py
@@ -1,5 +1,3 @@
#!/usr/bin/env python

import sys
from unittest.mock import patch

Expand Down
2 changes: 0 additions & 2 deletions tests/test_utilities/test_csvstat.py
@@ -1,5 +1,3 @@
#!/usr/bin/env python

import sys
from unittest.mock import patch

Expand Down
2 changes: 0 additions & 2 deletions tests/test_utilities/test_in2csv.py
@@ -1,5 +1,3 @@
#!/usr/bin/env python

import os
import sys
from io import StringIO
Expand Down
2 changes: 0 additions & 2 deletions tests/test_utilities/test_sql2csv.py
@@ -1,5 +1,3 @@
#!/usr/bin/env python

import os
import sys
from io import StringIO
Expand Down
2 changes: 0 additions & 2 deletions tests/utils.py
@@ -1,5 +1,3 @@
#!/usr/bin/env python

"""
To test standard input (without piped data), run each of:
Expand Down

0 comments on commit a5b9886

Please sign in to comment.