Skip to content

Commit

Permalink
chore: add pyproject.toml file, remove requirements-build.txt and upd…
Browse files Browse the repository at this point in the history
…ate README
  • Loading branch information
bolinocroustibat committed Dec 21, 2024
1 parent 7123500 commit 68d8eb4
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 23 deletions.
4 changes: 4 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ jobs:
command: |
virtualenv venv
source venv/bin/activate
# Install build dependencies
pip install build
# Install project locked dependencies
pip install -r requirements.txt
# Install the package in editable mode
pip install -e .
- save_cache:
key: << pipeline.parameters.cache-prefix >>-{{ arch }}-{{ checksum "requirements.txt" }}
Expand Down
32 changes: 28 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,25 @@ You can also directly feed the URL of a remote file (from data.gouv.fr for insta

You need to have python >= 3.7 installed. We recommend using a virtual environement.

```
```shell
pip install csv-detective
```

### Create a lock file

If you want to ensure reproducible installations, you can create a lock file from the `pyproject.toml`:

Using pip:
```shell
pip install pip-tools
pip-compile pyproject.toml --output-file requirements.txt
```

Using uv:
```shell
uv pip compile pyproject.toml -o requirements.txt
```

### Detect some columns

Say you have a tabular file located at `file_path`. This is how you could use `csv_detective`:
Expand Down Expand Up @@ -44,7 +59,7 @@ inspection_results = routine(

The program creates a `Python` dictionnary with the following information :

```
```python
{
"encoding": "windows-1252", # Encoding detected
"separator": ";", # Detected CSV separator
Expand Down Expand Up @@ -183,9 +198,18 @@ An early version of this analysis of all resources on data.gouv.fr can be found
## Release

The release process uses `bumpr`.
`bumpr` will be installed as a build dependency.

### Install build dependencies

Using pip:
```shell
pip install build
```

Using uv:
```shell
pip install -r requirements-build.txt
uv pip install build
```

### Process
Expand All @@ -212,7 +236,7 @@ bumpr -v

See bumpr options for minor and major:

```
```shell
$ bumpr -h
usage: bumpr [-h] [--version] [-v] [-c CONFIG] [-d] [-st] [-b | -pr] [-M] [-m] [-p]
[-s SUFFIX] [-u] [-pM] [-pm] [-pp] [-ps PREPARE_SUFFIX] [-pu]
Expand Down
63 changes: 63 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
[project]
name = "csv_detective"
dynamic = ["version"]
requires-python = ">=3.7, <3.13"
authors = [
{name = "data.gouv.fr", email = "[email protected]"},
]
description = "Detect CSV column content"
readme = "README.md"
license = {text = "GNU Affero General Public License v3"}
classifiers = [
"Development Status :: 2 - Pre-Alpha",
"License :: OSI Approved :: GNU Affero General Public License v3",
"Operating System :: POSIX",
"Programming Language :: Python :: 3",
"Topic :: Scientific/Engineering :: Information Analysis",
]
keywords = ["CSV", "data processing", "encoding", "guess", "parser", "tabular"]
dependencies = [
"boto3>=1.34.0",
"dateparser>=1.2.0",
"faust-cchardet>=2.1.19",
"pandas>=2.2.0",
"pytest>=8.3.0",
"python-dateutil>=2.8.2",
"Unidecode>=1.3.6",
"openpyxl>=3.1.5",
"xlrd>=2.0.1",
"odfpy>=1.4.1",
"requests>=2.32.3",
"responses>=0.25.0",
"python-magic>=0.4.27",
"faker>=33.0.0",
"rstr<=3.2.2",
]

[project.urls]
Homepage = "https://github.com/etalab/csv_detective"

[project.scripts]
csv_detective = "csv_detective.cli:run"

[tool.setuptools]
packages = ["csv_detective"]

[tool.setuptools.dynamic]
version = {attr = "csv_detective.__version__"}

[tool.setuptools.data-files]
"share/csv_detective" = [
"CHANGELOG.md",
"LICENSE.AGPL.txt",
"README.md",
]

[build-system]
requires = [
"setuptools>=61.0",
"wheel",
"twine",
"bumpr>=0.3.8"
]
build-backend = "setuptools.build_meta"
4 changes: 0 additions & 4 deletions requirements-build.txt

This file was deleted.

30 changes: 15 additions & 15 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
boto3>=1.34.0
dateparser>=1.2.0
faust-cchardet>=2.1.19
pandas>=2.2.0
pytest>=8.3.0
python-dateutil>=2.8.2
Unidecode>=1.3.6
openpyxl>=3.1.5
xlrd>=2.0.1
odfpy>=1.4.1
requests>=2.32.3
responses>=0.25.0
python-magic>=0.4.27
boto3==1.34.0
dateparser==1.2.0
faust-cchardet==2.1.19
pandas==2.2.0
pytest==8.3.0
python-dateutil==2.8.2
Unidecode==1.3.6
openpyxl==3.1.5
xlrd==2.0.1
odfpy==1.4.1
requests==2.32.3
responses==0.25.0
python-magic==0.4.27
frformat==0.4.0
faker>=33.0.0
rstr<=3.2.2
faker==33.0.0
rstr==3.2.2

0 comments on commit 68d8eb4

Please sign in to comment.