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

Add pyproject.toml and packaging config #10

Merged
merged 6 commits into from
Oct 21, 2024
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
13 changes: 7 additions & 6 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,17 @@ jobs:
- name: Show action trigger
run: echo "= The job was automatically triggered by a ${{github.event_name}} event."

- name: Setting up Python 3.12
uses: actions/setup-python@v5
- name: Install a specific version of uv
uses: astral-sh/setup-uv@v3
with:
python-version: "3.12"
version: "0.4.x"
enable-cache: true

- name: Installing dtspy dependencies (${{ matrix.os }})
run: python3 -m pip install -r requirements.txt
- name: Install Python 3.12
run: uv python install 3.12

- name: Build
run: mkdocs build --verbose
run: uv run --dev mkdocs build --verbose

- if: ${{ github.event_name == 'push' }}
name: GitHub Pages action
Expand Down
43 changes: 37 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,17 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
submodules: recursive

- name: Setting up Python 3.12 (${{ matrix.os }})
uses: actions/setup-python@v5
- name: Install a specific version of uv
uses: astral-sh/setup-uv@v3
with:
python-version: "3.12"
version: "0.4.x"
enable-cache: true

- name: Installing dtspy dependencies (${{ matrix.os }})
run: python3 -m pip install -r requirements.txt
- name: Install Python 3.12
run: uv python install 3.12

- name: Running tests (${{ matrix.os }})
run: coverage run -m unittest discover
run: uv run --dev coverage run -m unittest discover
env:
DTS_KBASE_DEV_TOKEN: ${{ secrets.DTS_KBASE_DEV_TOKEN }}

Expand All @@ -46,3 +47,33 @@ jobs:
# uses: codecov/[email protected]
# with:
# token: ${{ secrets.CODECOV_TOKEN }}

publish:
runs-on: ubuntu-latest

# Steps for running tests and analysis.
steps:
- name: Checking out repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
submodules: recursive

- name: Install a specific version of uv
uses: astral-sh/setup-uv@v3
with:
version: "0.4.x"
enable-cache: true

- name: Install Python 3.12
run: uv python install 3.12

- name: Build package
run: uv build

- name: Check package can be imported
run: uv run --with dist/dtspy-*-py3-none-any.whl --no-project -- python -c "import dts"

# when ready to upload to PyPI
# name: upload to PyPI
# run: uv publish
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
29 changes: 29 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[build-system]
requires = ["setuptools >= 61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "dtspy"
version = "0.1.0"
description = "Python client for the Data Transfer Service"
authors = [
{ name = "Jeffrey N. Johnson", email = "[email protected]" },
]
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"frictionless>=5.17.0,<6",
"requests>=2.32.3,<3",
]
Comment on lines +14 to +17
Copy link
Collaborator

Choose a reason for hiding this comment

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

have you tried running dtspy from a clean py3.12 install? The requirements file is quite long - are these the only two deps? I hope that the testing and doc generation aren't responsible for all the rest!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These two are the top-level dependencies, most of the ones listed in the requirements file come from them indirectly.

To see the equivalent requirements.txt based on the uv lock file, you can run
uv pip compile pyproject.toml
(and maybe add --no-annotate to make it easier to diff with current requirements.txt)

But yes, there are many that are testing/doc deps...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

And I'm already using as a dep in a project with

[project]
dependencies = [
  "dtspy @ https://github.com/luizirber/dtspy/archive/724f2884e14fee4cc9f9019e3bdf63a46aecf487.tar.gz"
]

which points to this PR, and it is all working


[tool.uv]
dev-dependencies = [
# testing
"coverage >=7.6.3,<8",

# docs
"mkdocs-material>=9.5.41",
"mkdocs>=1.6.1",
"mkdocstrings-python>=1.12.1",
"mkdocstrings>=0.26.2",
]
Loading
Loading