Skip to content

Commit 470bf31

Browse files
NT: Update build process to use pyproject.toml (#7)
* update build process to use pyproject.toml * pr review changes
1 parent 9045655 commit 470bf31

10 files changed

Lines changed: 132 additions & 271 deletions

File tree

.github/workflows/ci.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ jobs:
2525
- name: Install dependencies
2626
run: |
2727
python -m pip install --upgrade pip
28-
pip install -e ".[test]"
29-
pip install flake8 black
28+
pip install -e .[test]
29+
pip install flake8 black build
3030
3131
- name: Format code with Black (non-blocking)
3232
run: |
@@ -43,6 +43,11 @@ jobs:
4343
run: |
4444
python -m pytest tests/ -v --cov=plugin --cov-report=xml
4545
46+
- name: Build package
47+
run: |
48+
python -m build
49+
ls -1 dist
50+
4651
- name: Upload coverage to Codecov
4752
uses: codecov/codecov-action@v3
4853
with:

.github/workflows/release.yml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ jobs:
2121
steps:
2222
- name: Checkout
2323
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
2426
- name: Set up Python
2527
uses: actions/setup-python@v5
2628
with:
@@ -29,19 +31,8 @@ jobs:
2931
- name: Install build tooling
3032
run: |
3133
python -m pip install --upgrade pip
32-
pip install build wheel setuptools
34+
pip install build wheel setuptools setuptools-scm
3335
34-
- name: Verify version matches tag
35-
shell: bash
36-
run: |
37-
set -euo pipefail
38-
TAG_VERSION="${GITHUB_REF_NAME#v}"
39-
PKG_VERSION=$(python setup.py --version)
40-
echo "Package version: ${PKG_VERSION} | Tag version: ${TAG_VERSION}"
41-
test "${PKG_VERSION}" = "${TAG_VERSION}" || {
42-
echo "Version mismatch: setup.py (${PKG_VERSION}) != tag (${TAG_VERSION})"
43-
exit 1
44-
}
4536
4637
- name: Build package (sdist + wheel)
4738
run: |

.gitignore

Lines changed: 7 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -1,138 +1,10 @@
1-
# Byte-compiled / optimized / DLL files
2-
__pycache__/
3-
*.py[cod]
4-
*$py.class
1+
# Local virtual environment
2+
.venv/
53

6-
# C extensions
7-
*.so
8-
9-
# Distribution / packaging
10-
.Python
11-
build/
12-
develop-eggs/
4+
# Build outputs
135
dist/
14-
downloads/
15-
eggs/
16-
.eggs/
17-
lib/
18-
lib64/
19-
parts/
20-
sdist/
21-
var/
22-
wheels/
23-
*.egg-info/
24-
.installed.cfg
25-
*.egg
26-
MANIFEST
27-
*.tar.gz
28-
*.whl
29-
30-
# PyInstaller
31-
*.manifest
32-
*.spec
33-
34-
# Installer logs
35-
pip-log.txt
36-
pip-delete-this-directory.txt
37-
38-
# Unit test / coverage reports
39-
htmlcov/
40-
.tox/
41-
.nox/
42-
.coverage
43-
.coverage.*
44-
.cache
45-
nosetests.xml
46-
coverage.xml
47-
*.cover
48-
.hypothesis/
49-
.pytest_cache/
50-
51-
# Translations
52-
*.mo
53-
*.pot
54-
55-
# Django stuff:
56-
*.log
57-
local_settings.py
58-
db.sqlite3
59-
60-
# Flask stuff:
61-
instance/
62-
.webassets-cache
63-
64-
# Scrapy stuff:
65-
.scrapy
66-
67-
# Sphinx documentation
68-
docs/_build/
69-
70-
# PyBuilder
71-
target/
72-
73-
# Jupyter Notebook
74-
.ipynb_checkpoints
75-
76-
# IPython
77-
profile_default/
78-
ipython_config.py
6+
mlflow_cloudsmith_plugin.egg-info/
797

80-
# pyenv
81-
.python-version
82-
83-
# celery beat schedule file
84-
celerybeat-schedule
85-
86-
# SageMath parsed files
87-
*.sage.py
88-
89-
# Environments
90-
.env
91-
.venv
92-
env/
93-
venv/
94-
ENV/
95-
env.bak/
96-
venv.bak/
97-
.python-venv/
98-
.direnv/
99-
100-
# Spyder project settings
101-
.spyderproject
102-
.spyproject
103-
104-
# Rope project settings
105-
.ropeproject
106-
107-
# mkdocs documentation
108-
/site
109-
110-
# mypy
111-
.mypy_cache/
112-
.dmypy.json
113-
dmypy.json
114-
115-
# Pyre type checker
116-
.pyre/
117-
118-
# IDEs
119-
.vscode/
120-
.idea/
121-
*.swp
122-
*.swo
123-
*~
124-
.DS_Store
125-
.AppleDouble
126-
.LSOverride
127-
128-
# OS
129-
.DS_Store
130-
Thumbs.db
131-
132-
# Project specific
133-
config_settings.conf
134-
demo_output/
135-
*.tmp
136-
*.log
137-
*.local
138-
*.env.local
8+
# Python bytecode
9+
__pycache__/
10+
*.py[cod]

CONTRIBUTING.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
## Contributing
2+
3+
We welcome contributions!
4+
5+
**Setup**
6+
7+
```bash
8+
python -m venv .venv
9+
source .venv/bin/activate
10+
pip install -e '.[dev]'
11+
```
12+
13+
**Run Checks**
14+
15+
```bash
16+
# Lint & Format
17+
flake8 plugin
18+
black --check plugin tests
19+
20+
# Tests
21+
pytest -q
22+
```
23+
24+
---
25+
26+
## Continuous Integration
27+
28+
* **GitHub Actions** runs:
29+
30+
* `flake8`
31+
* `black --check`
32+
* `pytest` (with coverage)
33+
* Python versions: **3.8–3.12**
34+
35+
---

MANIFEST.in

Lines changed: 0 additions & 10 deletions
This file was deleted.

README.md

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ repo.log_artifact("model.pkl", "models/production")
5353
for info in repo.list_artifacts("models"):
5454
print(info.path, info.file_size, info.is_dir)
5555
```
56+
### Example startup:
57+
58+
```bash
59+
mlflow server \
60+
--host 127.0.0.1 \
61+
--port 5000 \
62+
--artifacts-destination cloudsmith://<CLOUDSMITH_NAMESPACE>/<CLOUDSMITH_REPO>
63+
```
64+
5665

5766
---
5867

@@ -187,37 +196,7 @@ CLOUDSMITH_API_KEY="" CLOUDSMITH_OWNER=myorg CLOUDSMITH_REPO=myrepo \
187196

188197
## Contributing
189198

190-
We welcome contributions!
191-
192-
**Setup**
193-
194-
```bash
195-
# Create & activate virtual environment
196-
pip install -e .
197-
pip install -r requirements.txt
198-
```
199-
200-
**Run Checks**
201-
202-
```bash
203-
# Lint & Format
204-
flake8 plugin
205-
black --check plugin tests
206-
207-
# Tests
208-
pytest -q
209-
```
210-
211-
---
212-
213-
## Continuous Integration
214-
215-
* **GitHub Actions** runs:
216-
217-
* `flake8`
218-
* `black --check`
219-
* `pytest` (with coverage)
220-
* Python versions: **3.8–3.12**
199+
We welcome contributions! Please see [CONTRIBUTING](CONTRIBUTING.md) for more details.
221200

222201
---
223202

pyproject.toml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
[build-system]
2+
requires = ["setuptools>=69", "wheel", "setuptools-scm>=8"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "mlflow-cloudsmith-plugin"
7+
dynamic = ["version"]
8+
description = "MLflow plugin for storing artifacts in Cloudsmith repositories"
9+
readme = "README.md"
10+
license = { file = "LICENSE" }
11+
authors = [{ name = "Cloudsmith Customer Engineering", email = "support@cloudsmith.com" }]
12+
requires-python = ">=3.8"
13+
dependencies = [
14+
"requests>=2.25.0",
15+
"mlflow>=2.12.0",
16+
]
17+
classifiers = [
18+
"Development Status :: 3 - Alpha",
19+
"Programming Language :: Python :: 3",
20+
]
21+
22+
23+
[project.optional-dependencies]
24+
dev = [
25+
"pytest>=6.0",
26+
"pytest-cov>=2.0",
27+
"black>=22.0",
28+
"flake8>=4.0",
29+
"mypy>=0.950",
30+
"build>=1.0.0",
31+
]
32+
test = ["pytest>=6.0", "pytest-cov>=2.0"]
33+
34+
[project.entry-points."mlflow.artifact_repository"]
35+
cloudsmith = "plugin.cloudsmith_repository:CloudsmithArtifactRepository"
36+
37+
[project.urls]
38+
"Source" = "https://github.com/cloudsmith-io/mlflow-cloudsmith-plugin"
39+
"Bug Tracker" = "https://github.com/cloudsmith-io/mlflow-cloudsmith-plugin/issues"
40+
"Documentation" = "https://github.com/cloudsmith-io/mlflow-cloudsmith-plugin#readme"
41+
42+
[tool.setuptools]
43+
packages = { find = { exclude = ["tests", "tests.*"] } }
44+
45+
[tool.setuptools_scm]
46+
version_scheme = "release-branch-semver"
47+
local_scheme = "no-local-version"
48+
fallback_version = "0.0.0"
49+
50+
[tool.pytest.ini_options]
51+
addopts = "-ra --cov=plugin --cov-report=term-missing"
52+
testpaths = ["tests"]
53+
filterwarnings = [
54+
"ignore:Failure attempting to register artifact repository for scheme \"cloudsmith\":UserWarning",
55+
]
56+
57+
[tool.black]
58+
line-length = 100
59+
target-version = ["py38"]
60+
61+
[tool.flake8]
62+
max-line-length = 100
63+
extend-ignore = ["E203"]
64+
65+
[tool.mypy]
66+
python_version = "3.8"
67+
warn_unused_ignores = true
68+
warn_return_any = true
69+
warn_redundant_casts = true
70+
warn_unreachable = true

pytest.ini

Lines changed: 0 additions & 5 deletions
This file was deleted.

requirements.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)