diff --git a/.bumpversion.cfg b/.bumpversion.cfg index e4b6dd7e..89c4ea43 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -4,8 +4,8 @@ commit = True tag = True message = release(project): {current_version} → {new_version} -[bumpversion:file:pyproject.toml] -search = version = "{current_version}" -replace = version = "{new_version}" +[bumpversion:file:setup.py] +search = version="{current_version}" +replace = version="{new_version}" [bumpversion:file:diamond_miner/__init__.py] diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b991239a..5eafefd4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,13 +14,14 @@ jobs: - uses: actions/setup-python@v4 with: python-version: "3.x" - - uses: dioptra-io/setup-poetry-action@v1 - name: Install package - run: poetry install + run: | + python -m venv venv + ./venv/bin/pip install .[dev] - name: Insert test data - run: poetry run tests/data/insert.py + run: ./venv/bin/python tests/data/insert.py - name: Run tests - run: poetry run pytest --cov=diamond_miner --cov-report=xml + run: ./venv/bin/pytest --cov=diamond_miner --cov-report=xml - uses: codecov/codecov-action@v3 mkdocs: @@ -30,13 +31,14 @@ jobs: - uses: actions/setup-python@v4 with: python-version: "3.x" - - uses: dioptra-io/setup-poetry-action@v1 - name: Install package - run: poetry install + run: | + python -m venv venv + pip install .[dev] - name: Build documentation - run: poetry run mkdocs build --strict + run: ./venv/bin/mkdocs build --strict - name: Publish documentation - run: poetry run mkdocs gh-deploy --force --no-history --strict + run: ./venv/bin/mkdocs gh-deploy --force --no-history --strict if: ${{ startsWith(github.ref, 'refs/tags/v') }} pypi: diff --git a/build_ext.py b/build_ext.py deleted file mode 100644 index e7715ce1..00000000 --- a/build_ext.py +++ /dev/null @@ -1,15 +0,0 @@ -from Cython.Build import cythonize -from setuptools.command.build_ext import build_ext - - -def build(setup_kwargs): - setup_kwargs.update( - { - "cmdclass": {"build_ext": build_ext}, - "ext_modules": cythonize( - "diamond_miner/**/*.pyx", - compiler_directives={"binding": True, "embedsignature": True}, - language_level=3, - ), - } - ) diff --git a/docs/dev.md b/docs/dev.md index df5112fd..d4ebb0d8 100644 --- a/docs/dev.md +++ b/docs/dev.md @@ -6,25 +6,29 @@ This library is developed on GitHub in the [`dioptra-io/diamond-miner`](https:// git clone git@github.com:dioptra-io/diamond-miner.git cd diamond-miner/ +# Create and enter a virtual environment +python -m venv venv +source venv/bin/activate + # Compile the Cython code and install the dependencies (once) -poetry install +pip install -e . # Install the pre-commit hooks (once) -poetry run pre-commit install +pre-commit install # Edit some files... -# Run poetry install again if you have edited Cython files (`.pyx`) +# Run pip install again if you have edited Cython files (`.pyx`) # Run the tests -poetry run pytest +pytest # Preview the documentation -poetry run mkdocs serve --watch diamond_miner --watch docs +mkdocs serve --watch diamond_miner --watch docs # Commit... # Tag a new version -poetry run bumpversion patch # or minor/major +bumpversion patch # or minor/major ``` ## Test data @@ -33,7 +37,7 @@ Most tests require a running instance of ClickHouse with pre-populated tables. To start a ClickHouse server and insert the test data: ```bash docker run --rm -d -p 8123:8123 clickhouse/clickhouse-server:22.6 -poetry run tests/data/insert.py +python tests/data/insert.py ``` To use a different server, set the `DIAMOND_MINER_TEST_DATABASE_URL` environment variable (`http://localhost:8123` by default). diff --git a/pyproject.toml b/pyproject.toml index 373c0e48..f2922430 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,46 +1,6 @@ -[tool.poetry] -name = "diamond-miner" -version = "1.0.3" -description = "High-speed, Internet-scale, load-balanced paths discovery." -license = "MIT" -authors = [ - "Kevin Vermeulen ", - "Matthieu Gouel ", - "Maxime Mouchet " -] -readme = "README.md" -homepage = "https://github.com/dioptra-io/diamond-miner" -classifiers = [ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Science/Research", - "Operating System :: MacOS :: MacOS X", - "Operating System :: POSIX :: Linux", - "Topic :: Internet", - "Typing :: Typed" -] - -[tool.poetry.build] -# https://github.com/python-poetry/poetry/issues/7470 -script = "build_ext.py" -generate-setup-file = true - -[tool.poetry.dependencies] -python = ">=3.10,<4.0" -pych-client = "^0.3.1" -pygfc = "^1.0.5" -zstandard = ">=0.15.2,<0.19.0" - -[tool.poetry.dev-dependencies] -bumpversion = "^0.6.0" -coverage = {extras = ["toml"], version = "^7.1.0"} -Cython = "^0.29.33" -hypothesis = "^6.68.2" -mkdocs-bibtex = "^2.8.13" -mkdocs-material = "^9.0.13" -mkdocstrings = {extras = ["python"], version = "^0.20.0"} -mypy = "^1.0.1" -pytest = "^7.2.1" -pytest-cov = "^4.0.0" +[build-system] +requires = ["setuptools", "Cython"] +build-backend = "setuptools.build_meta" [tool.pytest.ini_options] addopts = "--capture=no --doctest-modules --ignore=examples --log-cli-level=info --strict-markers --verbosity=2" @@ -80,10 +40,3 @@ archs = ["x86_64", "aarch64"] [tool.cibuildwheel.macos] archs = ["universal2"] - -[build-system] -requires = ["poetry-core>=1.0.0", "setuptools>=40.6.0", "Cython>=0.29.0"] -build-backend = "poetry.core.masonry.api" - -[project] -requires-python = ">=3.10" diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..da17871b --- /dev/null +++ b/setup.py @@ -0,0 +1,43 @@ +from Cython.Build import cythonize +from setuptools import setup + +setup( + name="diamond-miner", + version="1.0.3", + description="High-speed, Internet-scale, load-balanced paths discovery.", + author="Kevin Vermeulen, Matthieu Gouel, Maxime Mouchet", + url="https://github.com/dioptra-io/diamond-miner", + license="MIT", + ext_modules=cythonize( + "diamond_miner/**/*.pyx", + compiler_directives={"binding": True, "embedsignature": True}, + language_level=3, + ), + python_requires=">=3.10", + install_requires=[ + "pych-client~=0.3.1", + "pygfc~=1.0.5", + "zstandard>=0.15.2,<0.19.0", + ], + extras_require={ + "dev": [ + "bumpversion~=0.6.0", + "coverage[toml]~=7.1.0", + "hypothesis~=6.68.2", + "mkdocs-bibtex~=2.8.13", + "mkdocs-material~=9.0.13", + "mkdocstrings[python]~=0.20.0", + "mypy~=1.0.1", + "pytest~=7.2.1", + "pytest-cov~=4.0.0", + ] + }, + classifiers=[ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Science/Research", + "Operating System :: MacOS :: MacOS X", + "Operating System :: POSIX :: Linux", + "Topic :: Internet", + "Typing :: Typed", + ], +)