diff --git a/.gitignore b/.gitignore
index add68a0..4db9f6b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,3 +16,5 @@ nose*.egg/
pylint.txt
valgrind-python.supp
violations.pyflakes.txt
+CMakeCache.txt
+CMakeFiles/
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..84239cc
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,8 @@
+cmake_minimum_required(VERSION 3.18...3.22)
+
+project(${SKBUILD_PROJECT_NAME} LANGUAGES C)
+
+find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
+
+Python_add_library(GeoIP MODULE py_GeoIP.c WITH_SOABI)
+install(TARGETS GeoIP DESTINATION .)
diff --git a/MANIFEST.in b/MANIFEST.in
index 881cb08..7be06bb 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,3 +1,3 @@
-include ChangeLog.md LICENSE README.rst py_GeoIP.c
+include ChangeLog.md LICENSE README.rst CMakeLists.txt py_GeoIP.c
recursive-include examples *.py
recursive-include tests *.py
diff --git a/README.rst b/README.rst
index ac0974b..b9bedf8 100644
--- a/README.rst
+++ b/README.rst
@@ -16,6 +16,15 @@ from Python using `our GeoIP2 Python API `_
for more information.
+Scikit-build-core fork
+----------------------
+
+Setuptools is known for its poor backward compatibility. Some newer versions of
+setuptools fail to handle the metadata of the GeoIP package during the build
+process. This is a fork of the original GeoIP package that uses
+`scikit-build-core `_ to build the C
+extension instead of setuptools.
+
Requirements
------------
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..82629de
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,32 @@
+[build-system]
+requires = ["scikit-build-core"]
+build-backend = "scikit_build_core.build"
+
+[project]
+name = "GeoIP"
+version = "1.3.2"
+description = "MaxMind GeoIP Legacy Database - Python API"
+readme = "README.rst"
+license = { file = "LICENSE" }
+authors = [
+ { name = "MaxMind, Inc.", email = "support@maxmind.com" }
+]
+maintainers = [
+ { name = "Andrew Grigorev", email = "andrew@ei-grad.ru" }
+]
+classifiers = [
+ "Development Status :: 6 - Mature",
+ "Environment :: Web Environment",
+ "Intended Audience :: Developers",
+ "Intended Audience :: System Administrators",
+ "Programming Language :: Python",
+ "Topic :: Internet"
+ "Topic :: Internet :: Proxy Servers",
+]
+
+[project.optional-dependencies]
+test = ["pynose"]
+
+[project.urls]
+Homepage = "https://github.com/ei-grad/geoip-api-python"
+"Bug Tracker" = "https://github.com/ei-grad/geoip-api-python/issues"
diff --git a/setup.py b/setup.py
deleted file mode 100644
index d14ea69..0000000
--- a/setup.py
+++ /dev/null
@@ -1,50 +0,0 @@
-import sys
-
-try:
- from setuptools import setup, Extension
-except ImportError:
- from distutils.core import setup, Extension
-
-libs = ['GeoIP']
-
-if sys.platform == 'win32':
- libs.append('ws2_32')
-
-compile_args = []
-# http://bugs.python.org/issue969718
-if sys.version_info[0] == 2:
- compile_args.append('-fno-strict-aliasing')
-
-module1 = Extension('GeoIP',
- libraries=libs,
- sources=['py_GeoIP.c'],
- extra_compile_args=compile_args)
-
-setup(
- name='GeoIP',
- version='1.3.2',
- description='MaxMind GeoIP Legacy Database - Python API',
- long_description=open('README.rst').read(),
- author="MaxMind, Inc.",
- author_email="support@maxmind.com",
- url='http://www.maxmind.com/',
- bugtrack_url='https://github.com/maxmind/geoip-api-python/issues',
- license=open('LICENSE').read(),
- ext_modules=[module1],
- tests_require=['nose'],
- test_suite='nose.collector',
- classifiers=(
- 'Development Status :: 6 - Mature',
- 'Environment :: Web Environment',
- 'Intended Audience :: Developers',
- 'Intended Audience :: System Administrators',
- 'License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)',
- 'Programming Language :: Python :: 2.6',
- 'Programming Language :: Python :: 2.7',
- 'Programming Language :: Python :: 3.3',
- 'Programming Language :: Python :: 3.4',
- 'Programming Language :: Python',
- 'Topic :: Internet :: Proxy Servers',
- 'Topic :: Internet',
- ),
-)