Skip to content

Commit

Permalink
feat: add README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
hearot committed Sep 9, 2020
1 parent ee25646 commit f06afc3
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 21 deletions.
45 changes: 44 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,45 @@
# primecount
A Python wrapper for primecount.
A Python wrapper for [primecount](https://github.com/kimwalisch/primecount).

### Documentation

This package follows the documentation provided by [the C API reference](https://github.com/kimwalisch/primecount), generating three methods: `primecount.nth_prime`, `primecount.pi` and `primecount.phi`.

### Installation

In the first place, you have to download [the source code of the library](https://github.com/kimwalisch/primecount) and build it. Make sure you have installed [cmake](https://cmake.org/), [git](https://git-scm.com/) and [make](https://www.gnu.org/software/make/). You might have to make use of `sudo` if `make install` ever fails.

```
git clone https://github.com/kimwalisch/primecount
cd primecount
cmake . -DBUILD_SHARED_LIBS=ON
make -j
make install
```

After having installed the library, it's time to install the Python wrapper by cloning this repository. Make sure you have installed [pip](https://pypi.org/project/pip/) and that `primecount` is reachable as a shared library using a compiler.

```
git clone https://github.com/hearot/primecount
cd primecount
pip install .
```

Instead of the last command, you can type `python setup.py install` as well.

### Commit messages

> See [Conventional Commits](https://www.conventionalcommits.org).
### Contributing

> See [CONTRIBUTING.md](./CONTRIBUTING.md).
### Versioning

> See [PEP 440](https://www.python.org/dev/peps/pep-0440/).
### Copyright & License

- Copyright (C) 2020 [Hearot](https://github.com/hearot).
- Licensed under the terms of the [BSD 2-Clause License](./LICENSE).
48 changes: 28 additions & 20 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# POSSIBILITY OF SUCH DAMAGE.

import re
from distutils.core import Extension, setup
from setuptools import Extension, setup

CLASSIFIERS = [
"Development Status :: 5 - Production/Stable",
Expand All @@ -56,6 +56,7 @@
]
KEYWORDS = "c calculation computation extension primecount primes"
GITHUB_REPOSITORY = "https://github.com/hearot/primecount/blob/v%s/"
GITHUB_URL = "https://github.com/hearot/primecount"
LICENSE = "BSD2"
PACKAGE_NAME = "primecount"
SOURCE_FILE = "primecount.c"
Expand All @@ -80,22 +81,29 @@
long_description = f.read().replace("./", GITHUB_REPOSITORY % version)


setup(
author=author,
author_email=author_email,
classifiers=CLASSIFIERS,
description=description,
ext_modules=[primecount_module],
keywords=KEYWORDS,
license="BSD2",
long_description=long_description,
long_description_content_type="text/markdown",
name=PACKAGE_NAME,
project_urls={
"Tracker": "https://github.com/hearot/primecount/issues",
"Source": "https://github.com/hearot/primecount",
},
python_requires=">=3.6.*",
url=url,
version=version,
)
try:
setup(
author=author,
author_email=author_email,
classifiers=CLASSIFIERS,
description=description,
ext_modules=[primecount_module],
keywords=KEYWORDS,
license="BSD2",
long_description=long_description,
long_description_content_type="text/markdown",
name=PACKAGE_NAME,
project_urls={
"Tracker": GITHUB_URL + "/issues",
"Source": GITHUB_URL,
},
python_requires=">=3.6.*",
url=url,
version=version,
)
except SystemExit:
print(
"\nIt seems the installation didn't end well.\n"
"Have you installed primecount as library?\n"
f"Follow the guide on {GITHUB_URL}."
)

0 comments on commit f06afc3

Please sign in to comment.